eeprom problems : fm24C16A-P
ion
Posts: 101
I am using an eeprom on my project and I found out some strange behaviors.
Some how , data written to a location with i2cout was written to multiple locations, at 256 bytes interval.
To test , I just put one i2cout command to address 0, value =1234, then I read all 2047 locations with a loop.
The sample code is at the end.
When I look at debug screen I can see at address 0,256,512 and so on ·,the read values was 1234.
What I do wrong ? I tried to replace the eeprom, with some other brand new one· ( I bought 10), and the result is the same. I spoke with the eeprom manufacturer Ramtron,
http://www.ramtron.com/ and they told me that is nothing wrong with the chip, the problem is how i2cout handle the protocol.
I need help please .
Thank you
·
' {$STAMP BS2pe}
' {$PBASIC 2.5}
' {$PORT COM2}
·
·
new········ VAR···· Word
addr······· VAR···· Word
VALUE······ VAR···· Word
·
VALUE=· 1234
·
·I2COUT 0, $A0, 0, [noparse][[/noparse]DEC4 value]
·DEBUG "DONE",CR
·
PAUSE 1000
Read_From_EEPROM:
· FOR addr = 0 TO 2047
I2CIN 0,$A1,ADDR, [noparse][[/noparse]HEX4· new]
··· DEBUG "Addr: " ,DEC4 addr, "·· ",
········· "READ: ", HEX4 new,CR
· ADDR=ADDR+3
· NEXT
· END
·
This is the short form of debug screen. I deleted the lines with 0000 in between
DONE
Addr: 0000·· READ: 1234
Addr: 0004·· READ: 0000
·
Addr: 0252·· READ: 0000
Addr: 0256·· READ: 1234
Addr: 0260·· READ: 0000
·
Addr: 0508·· READ: 0000
Addr: 0512·· READ: 1234
Addr: 0516·· READ: 0000
·
Addr: 0764·· READ: 0000
Addr: 0768·· READ: 1234
Addr: 0772·· READ: 0000
·
Addr: 1020·· READ: 0000
Addr: 1024·· READ: 1234
Addr: 1028·· READ: 0000
·
Addr: 1276·· READ: 0000
Addr: 1280·· READ: 1234
Addr: 1284·· READ: 0000
·
Addr: 1532·· READ: 0000
Addr: 1536·· READ: 1234
Addr: 1540·· READ: 0000
·
Addr: 1788·· READ: 0000
Addr: 1792·· READ: 1234
Addr: 1796·· READ: 0000
Some how , data written to a location with i2cout was written to multiple locations, at 256 bytes interval.
To test , I just put one i2cout command to address 0, value =1234, then I read all 2047 locations with a loop.
The sample code is at the end.
When I look at debug screen I can see at address 0,256,512 and so on ·,the read values was 1234.
What I do wrong ? I tried to replace the eeprom, with some other brand new one· ( I bought 10), and the result is the same. I spoke with the eeprom manufacturer Ramtron,
http://www.ramtron.com/ and they told me that is nothing wrong with the chip, the problem is how i2cout handle the protocol.
I need help please .
Thank you
·
' {$STAMP BS2pe}
' {$PBASIC 2.5}
' {$PORT COM2}
·
·
new········ VAR···· Word
addr······· VAR···· Word
VALUE······ VAR···· Word
·
VALUE=· 1234
·
·I2COUT 0, $A0, 0, [noparse][[/noparse]DEC4 value]
·DEBUG "DONE",CR
·
PAUSE 1000
Read_From_EEPROM:
· FOR addr = 0 TO 2047
I2CIN 0,$A1,ADDR, [noparse][[/noparse]HEX4· new]
··· DEBUG "Addr: " ,DEC4 addr, "·· ",
········· "READ: ", HEX4 new,CR
· ADDR=ADDR+3
· NEXT
· END
·
This is the short form of debug screen. I deleted the lines with 0000 in between
DONE
Addr: 0000·· READ: 1234
Addr: 0004·· READ: 0000
·
Addr: 0252·· READ: 0000
Addr: 0256·· READ: 1234
Addr: 0260·· READ: 0000
·
Addr: 0508·· READ: 0000
Addr: 0512·· READ: 1234
Addr: 0516·· READ: 0000
·
Addr: 0764·· READ: 0000
Addr: 0768·· READ: 1234
Addr: 0772·· READ: 0000
·
Addr: 1020·· READ: 0000
Addr: 1024·· READ: 1234
Addr: 1028·· READ: 0000
·
Addr: 1276·· READ: 0000
Addr: 1280·· READ: 1234
Addr: 1284·· READ: 0000
·
Addr: 1532·· READ: 0000
Addr: 1536·· READ: 1234
Addr: 1540·· READ: 0000
·
Addr: 1788·· READ: 0000
Addr: 1792·· READ: 1234
Addr: 1796·· READ: 0000
Comments
When in doubt, consult the Help file -- it will show you the correct syntax and examples for using it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
I still do not understand the mechanism of this i2c command. I thought that it will be simple to write i2cout and just put the location and the software will deal with low and high bytes.
Can you please send me a link where I can find more to read for a beginner. I have a nice collection of stamps books from Parallax, 6 or 7 but I did not find the answer to my question.
Thank you
Ion
·
You can rerun your test program with the corrected syntax I showed you above and you should see that it is now correct. Here's how I would write it (using Parallax programming standards):
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 8/18/2004 9:41:18 PM GMT
here is the sample modified, but the result is the same.
new VAR Word
addr VAR Word
VALUE VAR Word
addr= 10
VALUE= 1234
I2COUT 0, $A0, addr.BYTE1\addr.BYTE0, [noparse][[/noparse]DEC4 value]
''I2COUT 0, $A0, 0, [noparse][[/noparse]DEC4 value]
DEBUG "DONE",CR
PAUSE 1000
Read_From_EEPROM:
FOR addr = 0 TO 2047
''I2CIN 0,$A1,ADDR, [noparse][[/noparse]HEX4 new]
I2CIN 0, $A1, addr.BYTE1\addr.BYTE0, [noparse][[/noparse]DEC4 new]
DEBUG "Addr: " ,DEC4 addr, " ",
"READ: ", DEC4 new,CR
ADDR=ADDR+3
NEXT
END
Wher i am wrong?
Thanks
Ion
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
What i got on your answer just few minutes ago it is completly diferent then what i see now. Initialy it was my pieces of code, and now i see it is changed. Please disregard the previous reply
Thanks
IOn
not 24C16 which partitioned to 8 pages of 256byte !
you may seen on datasheet that slave address not just $A0,
but $A2/$A4/$A6/$A8,$AC and $AE also used too..
is %1010 follow with A2 A1 A0 R/W..
then read code section should to be
Read_From_EEPROM:
FOR addr = 0 TO 2047
I2CIN 0,$A1+((addr/256)<<1),(ADDR//256), [noparse][[/noparse]HEX4 new] ' modified code here
DEBUG "Addr: " ,DEC4 addr, " ",
"READ: ", HEX4 new,CR
ADDR=ADDR+3
NEXT
I will read the manual or data sheet more carefuly
Thanks again
Ion