Author Topic: microcontroller erasing itself  (Read 5565 times)

GeeMott

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
microcontroller erasing itself
« on: May 09, 2011, 11:06:14 am »
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

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: microcontroller erasing itself
« Reply #1 on: May 10, 2011, 12:44:05 am »
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.

JW

GeeMott

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: microcontroller erasing itself
« Reply #2 on: May 10, 2011, 08:39:01 am »
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???