|
Forum Index : Microcontroller and PC projects : Here we go again with I2C EEPROM's....
| Author | Message | ||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10039 |
Trying to make a 24FC01 EEPROM co-operate with a PicoMite. PicoMite seems to know it is there, cos the test code on this thread produces the following result: ![]() So, the PM is getting ACK's from addresses &h50 to &h57, which is correct, as this EEPROM does not use the address pins/bits, and so does not care what you set them to or if they are floating even - it will respond on any of those addresses, and that is proven with the little test program. So, that's good. But I cannot get any kind of data into or out of the damn thing, even though the MM.I2C variable is reporting everything is good. My test code is: SetPin GP6,GP7,I2C2 I2C2 Open 100,100 Dim D$,E$ D$=Str$(&h00)+"1234567" 'Address of zero + the data bytes; 8-byte page I2C2 Write &h50,0,8,D$ Pause 10 'Allow time for EEPROM to do its page-write thing...(at least 5ms) Print MM.I2C Print "Attempting readback..." Pause 1000 I2C2 Write &h50,0,1,&h00 'Reset the byte address pointer thing Pause 10 I2C2 Read &h50,0,7,E$ Print MM.I2C Print E$ The result I get is: ![]() So, no NACK's, but the data does not come back 1234567 as expected. Can anyone see what I am doing wrong? I can hook up the logic analyzer if I have to, but perhaps someone can see what I am doing wrong without having to get that deep into things. 24FC01 has an 8-byte page-write ability, so I should be able to write 7 ASCII bytes, combined with the memory pointer byte to make our 8-byte page. I stop then, and MMBASIC should send the stop for me, and the EEPROM should then do the page write. MM.I2C seems to suggest this is all good, but I don't get the data back that I have tried to write. EEPROM powered from 3v3 Waveshare Zero module 3v3 output, 100n cap across the EEPROM, 4k7 pullups to SCL and SDA on that same 3v3 supply. I would love some pointers on what I should/could try next at this point. Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6603 |
Write protect not set right? VK7JH MMedit |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10039 |
IGNORE....Fixed it... Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10039 |
Write protect set correctly (pulled directly to GND) I had made a mistake using STR$(&h00) for my EEPROM index reference byte for the pointer thing. STR$(&h00) produces a zero, which is ASCII 48, which is &h30, so the EEPROM was writing at &h30, but I was trying to read it back from &h00.... Damn, computers are pedantic, aren't they?! (rhetorical) Changed the line to: D$=Chr$(&h00)+"1234567" That correctly makes byte 1 of the string decimal zero rather then decimal 48 disguised as a zero when printed on the screen! Time for a break, but I can come back and tinker around a bit more now that I have found my mistake! Edited 2022-12-16 16:41 by Grogster Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10039 |
UPDATE: Here is a result of outputting all 128 bytes from the EEPROM: ![]() Note that there is a "1234567" towards the right of the first line - this will be where I was accidentally writing to the wrong address. So it was working, I just didn't know it was. Onwards... Smoke makes things work. When the smoke gets out, it stops! |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1769 |
Hi Grogster, years ago I created an I2C EEPROM Library. Maybe an inspiration? Best regards Michael ‚My name is Ozymandias, king of kings Look on my works, ye Mighty, and despair!‘ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and ... |
||||
| Hans Senior Member Joined: 18/10/2022 Location: CanadaPosts: 117 |
Thank you for that code twofingers. It was perfect for me to understand how to access the memory chips on my I2C RTC. Again Thanks, Hans .... |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |