Corrupt EEPROM values....External Reset???

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a device,using a Mega32, that keeps getting it's E2 data "trashed". Not sure if it's happening during power down or power up. I have a power supply cycling on/off every minute and see random results of corrupt data. The /RESET pin connects to my display reset line via 1k resistor (so it gets the same reset) and to the programming header. Basically though the line could be considered floating I guess. I have the watchdog turned on, brown-out is on, external crystal with bootup set to longest time.

I noticed today that if I use an econo-reset (Dallas DS1233-10) on the /RESET line, things seem to be ok. Question is why all of a sudden do I need this device? Why can't I fix this in software?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Why can't I fix this in software?

Short answer: Use the Brown-Out Detector (BOD).

Next answer: Search the forums for "eeprom corruption" and you will find many detailed discussions.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Short answer: Use the Brown-Out Detector (BOD).

Been there, done that...Tried both settings...doesn't help AT ALL!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm thinking maybe a long delay when I boot-up before I do anything???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Basically though the line could be considered floating I guess

Looks like a problem right there, why are you floating the reset line? Use a pullup resistor to make sure the reset signal is high, don't rely on the weak internal pullup.

Other tricks as outlined in the AVR app note on eeprom corruption:
don't use address 0
after you complete your eeprom access, point the address register to an unused location.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Been there, done that...Tried both settings...doesn't help AT ALL!!!

Quote:

Other tricks as outlined in the AVR app note on eeprom corruption:
don't use address 0
after you complete your eeprom access, point the address register to an unused location.


"both" settings? ??? I'll wager it is still a brown-out situation; the "evidence" is that the external BOD seems to cure the symptoms.

Without BOD, when the power is dropping at some point the AVR is running below specs, and anything can happen. A common symptom is that EEAR drops (hence address 0 gets "corrupted"), and rogue EE writes can be triggered (hence parking at an unused area helps).

IME with scores of AVR production apps that make heavy use of EEPROM, there are no corruption problems with the BOD enabled.

I suppose another possibility is a massive noise spike (e.g. unsnubbed contactor opening) at power-down. Again, the AVR is then out-of-spec (and with a noise spike out of Absolute Maximum Ratings) and weird things can happen.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The DS1233-10 reset on about 4.3V.
Have you set the BODLEVEL to 4.0V and BODEN enabled?

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I suppose another possibility is a massive noise spike (e.g. unsnubbed contactor opening) at power-down. Again, the AVR is then out-of-spec (and with a noise spike out of Absolute Maximum Ratings) and weird things can happen.

We believe this is the case. Unit is in a pump house with large motors...

If so... can I still rely on the BOD to do it's thing, or is this why the external one seems to works???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My guess is that you don't really have the AVR's BOD enabled properly. You can test that on the bench.

If indeed you have noise spikes then you must snub them--operating outside of max ratings can cause AVR damage as well as erratic operation.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've increased my boot-up delay. So it sits and waits a few moments before it tries to do anything with the eeprom. I also re-enabled the BOD fuse bit and set it for 4v. So far so good. I had the BOD active before (both at 4v and 2.7v), but I think this longer delay is what's helping. I'll know more after it cycles ON/OFF a few more dozen times....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

So it sits and waits a few moments before it tries to do anything with the eeprom.

I'd check your Vcc and /RESET during your normal startup operations. It may be power-on where the Vcc gets high enough to take the AVR out of reset, you app "starts" to do something useful, and then goes back in and out of reset one or more times. the same could be happening at power-off.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.