EmbeddedRelated.com
Forums

MSP430 Reset Vector Programming

Started by jan...@mmf.de October 21, 2011
I'm using IAR EWB and MSP430F5528. I have a strange problem when I write to the Reset Vector at 0xFFFE as the last step of a firmware update routine.
The problem occurs in this line:

(*((volatile int *) (RESET_VECTOR + 0xFF80))) = (RESET_VECTOR_Hi * 0x100) + RESET_VECTOR_Lo;

The value of RESET_VECTOR_Hi is 0x44 and RESET_VECTOR_Lo is 0x02. After executing above line, the contents of RESET_VECTOR does not become 0x4402 as I would expect but 0x4002.

When I tested the same with SYSNMI_VECTOR:

(*((volatile int *) (SYSNMI_VECTOR + 0xFF80))) = (RESET_VECTOR_Hi * 0x100) + RESET_VECTOR_Lo;
I get the expected result SYSNMI_VECTOR = 0x4402.

Is there anything special when writing to the reset vector?

Beginning Microcontrollers with the MSP430

Substitute (RESET_VECTOR_Hi * 0x100) + RESET_VECTOR_Lo

With (RESET_VECTOR_Hi << 8) | RESET_VECTOR_Lo

From: m... [mailto:m...] On Behalf Of j...@mmf.de
Sent: Friday, October 21, 2011 7:20 AM
To: m...
Subject: [msp430] MSP430 Reset Vector Programming

I'm using IAR EWB and MSP430F5528. I have a strange problem when I write to the Reset Vector at 0xFFFE as the last step of a firmware update routine.
The problem occurs in this line:

(*((volatile int *) (RESET_VECTOR + 0xFF80))) = (RESET_VECTOR_Hi * 0x100) + RESET_VECTOR_Lo;

The value of RESET_VECTOR_Hi is 0x44 and RESET_VECTOR_Lo is 0x02. After executing above line, the contents of RESET_VECTOR does not become 0x4402 as I would expect but 0x4002.

When I tested the same with SYSNMI_VECTOR:

(*((volatile int *) (SYSNMI_VECTOR + 0xFF80))) = (RESET_VECTOR_Hi * 0x100) + RESET_VECTOR_Lo;
I get the expected result SYSNMI_VECTOR = 0x4402.

Is there anything special when writing to the reset vector?



Thank you, Hugo. This doesn't change the result.

Jan

Simple.

1. Make sure you've not got a macro issue by parenthesizing: (x * 0x100) +
y may not always be the same as ((x) * 0x100) + (y).
2. Check that the reset vector is 0xffff immediately before the write.
3. Step at the low level to see what is actually written through that
pointer: is the value in the register correct?

Isn't this just Basic Debugging?

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore running Defender... http://www.vimeo.com/25709426

> -----Original Message-----
> From: m... [mailto:m...] On Behalf
> Of Jan Burgemeister
> Sent: 21 October 2011 13:04
> To: m...
> Subject: [msp430] Re: MSP430 Reset Vector Programming
>
> Thank you, Hugo. This doesn't change the result.
>
> Jan
>
>
>
>
>
>
>
>
Thank you for your quick help! RESET_VECTOR was not FFFFh. Really simple!