Go Down

Topic: EEPROM Chip resets when arduino is reset (Read 1 time) previous topic - next topic

basscase

I am currently building and writing code for a data logger that reads 4 analog inputs, then stores this data on an external EEPROM chip (24L256), which can be read off of the chip at a later time. So the program works flawlessly until i reset the power. Once the power is reset, the read data command gives nothing, suggesting that the data has been erased in the power off. I think there is something wrong with how I have set up the eeprom chip, but I'm not sure what.

The code and circuit diagrams I designed are at the following link.
http://truweatherballoon.blogspot.com

Thanks in advance for the help.

johnwasser

Your circuit diagram shows no connection to the Vcc pin of the 24L256.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

basscase

That is a mistake. Vcc is set to 5 volts (pin 8) and the write protects is set to gnd (pin 7). I will update picture asap.

johnwasser

"Wire.available()

Description
Returns the number of bytes available for retrieval with receive(). This should be called on a master device after a call to requestFrom() or on a slave inside the onReceive() handler."
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

basscase

So I should use this to return the number of available bytes I can read? I don't understand how this command will stop my EEPROM chip from being erased upon reset.

johnwasser

You are attempting to read data from the buffer (result = Wire.receive();) before you check to see if there is any data in the buffer (Wire.available()).  Perhaps the library is returning an error due to a buffer under-run.  It is possible that your data is in the EEPROM but your reading code is incorrect.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

basscase

The thing is i can write data to the chip, then read it 100 times and it works perfectly. As soon as I turn off the bread board and turn it back on and try to read the data i just stored on it, nothing comes up. So its not like the code doesn't work, it seems more like the chip doesn't work, which makes me think there is something wrong with my pull up resistor or something.

basscase

Ok the problem has to be in the code. I have reset the power in the eeprom chip alone and it still reads the data off of it fine. Is there something at the start of the code that would be initializing the eeprom chip?

basscase

Nevermind, I found the problem. Everytime I turn on the chip, endloop is reset, causing my read loop to reset at 0, so the chip is not infact blank, but my loop was reading nothing.

Go Up