Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
06/14/12 14:37
Read: 584 times

Msg Score: +1
 +1 Good Answer/Helpful
#187708 - Responding to Bert's and Rob's prior messages
Responding to: Rob Klein's previous message
The reason for the multitude of "VDD monitor enables" is to ensure that if the program counter gets into the flash routine accidentally, from errant CPU operation due to a power failure for example, the VDD monitor has a chance to reset the device before a potential flash corruption event. This can happen if the VDD monitor was accidentally disabled earlier in the code.

Regarding Bert's problem, if the VDD monitor was off prior to entry into WriteFlashByte, the order of "enable VDD monitor as reset source" followed by "enable VDD monitor" could cause a reset event if the VDD monitor "bounced" as it was coming up. That's why we recommend a delay between enabling the VDD monitor and enabling it as a reset source, to prevent spurious resets. HOWEVER, we recommend that the delay be removed if code contains routines that write or erase flash memory.

I'd recommend enabling the VDD monitor at the beginning of code and leaving it on, with no further writes to VDM0CN. I'd also recommend removing the "mov RSTSRC, #00h", as this disables the VDD mon as a reset source.

Also, flash write and erase operations will fail if targeting an invalid address. You might confirm the dptr register contents prior to execution of the movx @dptr, a instruction.

If you are implementing a bootloader, you might consider putting part of the bootloader in the flash page containing the Lock byte (the page right before the end of flash). That page cannot be erased by firmware.


List of 8 messages in thread
Problem writing to C8051F504 flash from firmware      Bert Van Den Berg      06/13/12 20:41      
   Some comments      Rob Klein      06/14/12 07:52      
      C code sample from Silab website      Bert Van Den Berg      06/14/12 12:13      
         the dog bites      Erik Malund      06/14/12 14:21      
      Responding to Bert's and Rob's prior messages        Brent Wilson      06/14/12 14:37      
         Wow      Rob Klein      06/14/12 15:08      
            Wow to you!      Brent Wilson      06/14/12 16:20      
   Problem solved        Bert Van Den Berg      06/14/12 17:49      

Back to Subject List