[AVR] Eeprom data corruption in atmega32a

Status
Not open for further replies.

BHARGAVSHANKHALPARA

Junior Member level 3
Joined
May 6, 2010
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
GUJARAT INDIA
Visit site
Activity points
1,592
Hello all...!!

I am making one application in which i am controlling Two motors,there is too many measurements,current measurement of all 3 phase using CT and otherthings...!! I am using internal EEPROM of ATMEGA32A to store data.

My problem is..

When i restart my circuit many time,its internal EEPROM data corrupt. I enable Brownout reset after reading ATMEGA32A datasheet. I choose 4V for brown out reset. But than after my EEPROM data corrupt.

I use external crystal of 16MHz with 22pf capacitor for batter timing accuracy.

But when i choose internal oscillator at 8MHz from fuse bit setting , and than restart circuit many times but EEPROM data is safe.

No problem at all...!!

Please suggest what is problem with external crystal and internal EEPROM data...?

Thank you.
 

In such situations I would suggest the following things:
1. Increase the decoupling capacitors of Atmega32 VCC pins - put if possible tantalium capacitors 47 to 100uF/6V
2. Enable the brown out detection on power up - it's important to keep the processor in reset state when voltage is low
3. At the beginning of the program put 100-200ms delay before anything else you do, this will ensure that when you enter the main the voltages already settled down.
4. Avoid using location 00 of the eeprom, by some reason it tends to get corrupted data in time
5. After writing the data into EEPROM set the EEPROM address pointer to some unused location (for example 00)

I hope it helps
 
Have you stored some flag value in eeprom which you read on MCU start ? If you are reading more than 1 byte from eeprom then add a 20 ms delay between reads or writes. Also add 100 to 200 ms delay after PORT initialization and eeprom read.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…