microcontroller erasing itself

Started by GeeMott, May 09, 2011, 11:06:14 AM

Previous topic - Next topic


Another real hair-puller for me.  I have a mature, stable design based on the 89LV51RC2.  When that part was discontinued, I moved to the -RD2.  When I program them with the same old code, they work fine -- at first.  Some of them (3 so far out of 10) just spontaneously erased themselves after a few days.  I even tried setting the security bit and adding a serial number as write protection, to no avail.  I put the failed board on Flash Magic, and saw the security bit was still set, but the part was otherwise blank.

Suppose I have a stack leak or wandering program counter in my code, that was never found because the RC2 had less program space -- something that was benign before, but now isn't.  Is it possible to access a built-in "erase all" subroutine by accident?

Jan Waclawek

It sounds a bit unlikely.
Do you use any of the IAP facilities? Do you use the watchdog?
You also might want to double check the VCC decoupling/grounding quality, and also maybe reconsider your reset circuit.



There is no code that accesses the IAP stuff.  If that is happening it is by the most unlikely random chance. I don''t use the watchdog, maybe it is time to put that in at least as a diagnostic.  I am checking the VCC and reset generator as you suggest, but this is so intermittent and hard to reproduce, it's not showing anything.

But there is one more straw to grasp at.  It's possible that these parts were programmed with the Flash Magic tool set to the -RC2 part by default, rather than the proper -RD2.  Could that possibly affect the retention of the program???