EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Re: Watchdog during flash operations

Started by "Robert J. Wilson" December 31, 2006
--- In m..., "yuriz" wrote:
>
> All examples of flash operations in the msp430 user guide disable
> watchdog for the period of working with flash. Presumably, one can
> avoid watchdog timer expiry by resetting the wd timer right before
> each operation (assuming the wd expiry is reasonably long). Wouldn't
> that have exactly the same effect ?

Did you ever get a good answer?

The only thing I could think of is a timer interrupt may try to fetch
an interrupt vector while write voltages are on the flash. I'm using
the watchdog as an interval timer and write the data to flash during
the watchdog-interval timer event.

Bob Wilson

Beginning Microcontrollers with the MSP430

Actually, it's impossible to read flash during a write operation, but
the processing unit continues to try to fetch the next program
instruction while the flash byte is being burned. To handle this
problem, the designers of the MSP430 have the flash unit return a
JMP -1 command whenever the flash section is not available. So the
program counter just loops back to the same line of code until the
flash actually returns a real opcode. Now, if any kind of interupt
occurs, the processor will try to read the jump vector from flash and
will get the JMP -1 opcode and try to jump to that vector (something
like 0x7676) which almost certainly is not the correct vector and the
micro crashes. Therefore, you MUST disable all interrupts before
starting the flash write process.
You may think that it is a good idea to keep the watchdog running
just in case the flash write operation hangs up for some reason, but
in real life, if that happened, the watchdog still wouldn't know what
address to jump to so you still would be out of luck and need to
perform a hard reset.

Cheers!
John
--- In m..., "Robert J. Wilson"
wrote:
>
> --- In m..., "yuriz" wrote:
> >
> > All examples of flash operations in the msp430 user guide disable
> > watchdog for the period of working with flash. Presumably, one can
> > avoid watchdog timer expiry by resetting the wd timer right
before
> > each operation (assuming the wd expiry is reasonably long).
Wouldn't
> > that have exactly the same effect ?
>
> Did you ever get a good answer?
>
> The only thing I could think of is a timer interrupt may try to
fetch
> an interrupt vector while write voltages are on the flash. I'm using
> the watchdog as an interval timer and write the data to flash during
> the watchdog-interval timer event.
>
> Bob Wilson
>

The 2024 Embedded Online Conference