View previous topic :: View next topic |
Author |
Message |
ricx
Joined: 06 Jan 2008 Posts: 4
|
24c1024 write and read problem |
Posted: Tue May 20, 2008 2:32 am |
|
|
Hi. I have a problem on writing and reading 24c1024 serial eeprom with standard i2c routines with FORCE_SW option. This chip is stores the data which obtained by system. and serial eeprom and DS1307 RTC is on same i2c bus.
Sometimes writing to, sometimes reading from 24c1024 makes mistakes.
to solve this problem, i wrote self controll routines. this routine reads the data which is recently written, and compares if it is true. if not routine tries to write again. like this while reading, this routine firstly read the data from eeprom, and read again anad compares them between each other.
after this arrangement my problem reduced but not finished yet.
do you have any advise to solve my problem. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 20, 2008 10:40 am |
|
|
Remove RTC chip from the i2c bus. Remove all RTC code from your
program. Make a simple test program that writes and reads from the
24C1024 eeprom. Test it and improve the code or the hardware until
it runs perfectly. Then add the RTC chip to the i2c bus. See if the
eeprom still works OK. If so, then add the RTC code.
If you have interrupts in your code, remove that code temporarily,
to see if it is causing the problem.
Check the pull-up resistor size on the i2c bus. Verify that it is correct. |
|
![](templates/subSilver/images/spacer.gif) |
ricx
Joined: 06 Jan 2008 Posts: 4
|
|
Posted: Wed May 21, 2008 7:02 am |
|
|
thank you PCM programmer for your response.
I seperate the two i2c bus for RTC and 24C1024. Nowadays I have been examining system. But I have no chance to examine without RTC. Because the system is being used in industry.
Pull up resistors are 4.7K and i think it's ok. And i do not use interrupt for i2c.
but this morning i did an interesting test. I make some data to store with using circuit. And so it stored them in 24C1024. PIC send all stored data to serial port for debugging. I saw that all stored data are valid. After that I request to PIC for read all data from 24C1024 and send to serial port for debugging. After several reading and sending, some bytes start to read wrongly. For example 10. byte whose data is 0x08, become 0x28. And finally I start to communicate with computer over normal communication port. Computer receive this byte as 0x28. In my oppinion sometimes while reading, the stored data changes abnormally.
But same test do not destroy the stored data while working with a new 24C1024. |
|
![](templates/subSilver/images/spacer.gif) |
|