Using AT24C02A EEPROM #4548
Replies: 1 comment
-
Posted at 2015-03-31 by @gfwilliams Have you added pullup resistors on SCL and SDA? That's the No.1 problem with I2c usually :) Posted at 2015-03-31 by DrAzzy You need pullups on SDA and SCL if you don't have them already. 10k ohm resistor from SDA to Vcc, and SCL to Vcc.
Posted at 2015-03-31 by fobus Yes, I had many mistakes on code; Also I had misakes on wiring. Here is the correct one EEPROM VCC -> Board 5V Also I have placed two 10k ohm resistors between VCC -> SCL and VCC ->SDA
line console.log(eeprom.write(0x64,"Merhaba")); outputs 7 but console.log(eeprom.read(0x64,7)); delays 10-12 seconds and outputs this error;
Posted at 2015-04-01 by DrAzzy Try (or executing it one line at a time in the console - point being just to get a delay between the read and write)
When you write a single page, it just returns - it doesn't wait out the 10ms internally timed write cycle, so it may still be unresponsive in write cycle if you try to access it immediately after that. Posted at 2015-04-01 by fobus No way. I have tried on the console manually. And tried as you give with setTimeout. But still the same error. I'm not soldering it, may this cause the problem? I'm pluging pins and cables on the board. Posted at 2015-04-01 by DrAzzy Oh, I see the problem - the module is expecting capacity in kbits, (so you can just use the number from the part number). Should be 2, not 256 as the capacity. This confuses it, because the larger ones use 2 bytes + a few for the address, instead of 1. So write works (it's writing "dMerhaba" (d being 0x64) to address 0, but the read attempt is invalid, because it's expecting the master to read after 1 byte of address, but the master keeps sending data for another byte. Posted at 2015-04-01 by fobus @drazzy Thanks for your response, I have revised the code like this;
But It is the same result. Posted at 2015-04-01 by DrAzzy This is strange - what really confuses me is that the write doesn't fail, but the read does. Failing that Run this and report results:
I've got a small AT24-series chip at home that I can check this on, but unless something broke very recently, i don't know what it could be. Posted at 2015-04-01 by fobus @drazzy I have not decoupling cap, I'm going to buy and apply it.
Also I don't know does it care but here is some results about addressing ;
One more test result is below, I think it writes and reads when I try manually
Posted at 2015-04-02 by DrAzzy eeprom.a() should return a 1 or 2 byte string, not a native code function. In this case it should return: "P". This is pure JS - it has nothing to do with the connected device. I also cannot reproduce that behavior on my system - I get the correct results...
What version of Espruino firmware are you using? I'm also PMing Gordon, maybe he might have some insight here. Posted at 2015-04-02 by fobus my process.version output is "1v72" By the way I'm not using this module : http://www.espruino.com/modules/AT24.js Posted at 2015-04-02 by @gfwilliams Ok, that's a strange one... First off I'd advise you update your firmware to the latest version (1v75) and see if it still happens - it's available from the Download page. If you've got Posted at 2015-04-02 by DrAzzy There is no built-in AT24 module. If you put require("AT24") on the right side of the IDE, and tell it to send, there are only three places it could get the AT24 module from. Either it's using the one from espruino.com/modules, or you have an AT24.js on an SD card and the board supports that (I don't know if that board does), or you have the sandbox enabled and an AT24.js or AT24.min.js in the modules directory in your espruino sandbox directory. Please make sure you are using the version from espruino.com/modules (you can do require("http://espruino.com/modules/AT24.js").connect(...) from the right side of the IDE, and it will make sure to get it from there - though I suspect that's already where it's coming from; i'd be very surprised if there were weird versions of my module floating around). (note - if you examine the code, it won't look the same as in the .js , because the IDE sends the minified versions of the modules (.min.js ), to reduce memory use) I would definitely update firmware to latest available, though I would expect it to work on v72 (but not anything before that). Finally, if all that doesn't change behavior, can I see a console.log(eeprom.a)? That should print out the js function that's somehow returning native function. Posted at 2015-04-02 by fobus @gfwilliams OK, I'm going to update firmware. I have realized that E.toString() return value as native code
Posted at 2015-04-02 by fobus I have updated the firmware here is the test results
I think it has been done. Posted at 2015-04-02 by DrAzzy Hurray! Posted at 2015-04-03 by @gfwilliams Great! I see what was happening now - If I'm honest, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-03-31 by fobus
Hello,
I'm trying to wire up and 24C02A EEPROM and read-write data on it.
I'm using this datasheet : http://pdf.datasheetcatalog.com/datasheets/90/80419_DS.pdf
I'm using SMT32F4 Discovery.
I have vired as this
EEPROM VCC -> Board 5V
EEPROM CSS -> Board Ground
EEPROM SCL -> Board SCL (B8)
EEPROM SDA -> Board SDA (B9)
Then I'm using this code;
But I'm getting this error :
What I'm doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions