Eeprom corrupted

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

Working on Atmega1284P and used eeprom memory. Problem is some memory addresses bring corrupted data while others work fine. I'm working with float data types. Assistance is appreciated in time.

Crazy generation

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

Can you confirm you already read and acted upon this (that is you enabled BOD already)? ....

 

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

Thank you for quick response. I never never encountered the same problem with int data types. Again my supply voltage is 5v. Again why just some notorious address for which if i change to some different ones(good ones ik) they work out correctly. Somethings must have been hidden to the programmer, that's my bad feeling.

Crazy generation

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

There is nothing hidden to the programmer in this matter. With my all-seeing crystal ball, I'd lay 10:1 odds on it being your code.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Derrick, you avoided clawson's question about BOD.

 

Stating you have a supply of 5V does not quantify its quality. (Does it have ripple or noise spikes? How is the VCC power derived?)

 

I have applications storing floats, ints, bytes and have never experienced a problem (that wasn't my own fault).

The critical issue is proper design both hardware and software.

Do you have adequate bypass caps on and close to all VCC/GND pins?

David (aka frog_jr)

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

Also just for giggles let's see you EEPROM writing code - if it's C are you using (trusted) functions from your C compiler's library or is this some kind of "roll your own"?

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

eeprom update and eeprom read are compiler supplied functions, in short nowhere have I generated my own code!!!

Crazy generation

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

So have you enabled BOD or not?

 

If you haven't you are almost bound to get problems - often EEPROM location 0x0000 in fact.

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

I surely suspect the quality of the power supply. But l will also state that it Appears some memory addresses do not need very quality power supply! As some addresses worked some failed . I had to famble with the dirty power supply till six addresses worked successfully.

Crazy generation

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

But that's exactly what the not enabling the BOD is likely to cause, however you don't seem to want to answer that question.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Derick,

Cliff has provided you with the best solution, and has explained which address usually gets clobbered - to which I can also attest to based on experience.  Enabling the BOD solves this problem unless you have an absolutely horrendous power supply, or there is/are flaws in your code.

 

Since we cannot see either at this moment, would you post your code for review?

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

Okay I will be posting the code shortly.

Crazy generation

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

But you still haven't said whether you use BOD or not?!?

 

This is fairly easy: if you haven't enabled BOD (the way AVRs are supplied) you will get EEPROM corruption. If you have enabled it you won't. So have you or not?

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

I notice that my car starts to move when I park on an incline but it never does on a flat road.

 

What? Put it on park or apply the parking brake? That can't be it because it doesn't happen on all parking spots........must be something else...

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Crazy generation

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

Attachment(s): 

Crazy generation

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

2 things: You can paste photos directly to the thread, keep them at say 800 wide.

 

Learn how to use screen capture so that you don't need a camera. Either Control+Print Screen for full screen capture or Alt+Print Screen for the foreground screen only.

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Fri. Mar 17, 2017 - 09:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

or just attach your .c file using the add attachments button at the bottom of the page here if the file is too big. Or you can do a copy all from studio and then insert it to your post using the CODE button <> in the toolbar.

Jim

Edit: from your "screenshots" i can see how things get messed up as it appears you are manually addressing the eeprom. I would suggest maybe putting all your floats into a structure and then use eeprom update block(i think thats what its called) to do the work for you. Makes life much easier and can prevent you from overwriting cells.

Jim

 

Another Edit:

I see you are all over the place on this, and quite cheeky about it:

https://www.avrfreaks.net/comment...

 

Lighten up, we are not mind readers with such little information.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Sat. Mar 18, 2017 - 04:12 AM