Dear EEVBlog members, I saw this link: I need to read AT24cxx eeproms data to a file on my PClaptop (.txt for example) and also writes a certain file to another EEPROM. Like copying one of them then programming the other one. I didn't find in that link or any other how to do that part which involves storing the values in a txt file not just on serial because some chips has too many lines, also writing will not happen if I have the data on a txt file using that sketch alone. Looking forward to your generous help! Best regards, Vegeta. That library code reads and writes the EEPROM, nothing else. In setup there is an example of writing a string to the EEPROM starting at address 0x0000.
Quick and dirty 24LC56 & 24LC512 programmer. Contribute to sparx266/Arduino-I2C-EEPROM-Programmer development by creating an account on GitHub.
In loop there is an example of reading the contents starting at address 0x0000 on up until a 0x00 is read (end of string written above). Getting EEPROM data into and out of the Arduino is one thing, writing a text file out in PC land is an entirely different matter. There are a number of projects on the Internet where the user wants to capture text data from the Arduino. That is pretty easy! I would have the Arduino convert the bytes to the Intel Hex format before transmission. That includes calculating the checksum which will allow the PC to verify the transmission. What's hard is having the PC send data to the Arduino serial port.
The hardest part is for the Arduino to halt the PC while is processes a line of text. I'm not sure what the best way to do that will be.
I would write something in Python (I guess.) that reads the file converts it to Intel Hex format if not already done and sends one line to the Arduino. Then the Python code waits for an acknowledgement from the Arduino before sending the next line. The Arduino will eat the hex line, verify the checksum and strip out the bytes before writing the EEPROM with the library from above. Note that the Intel Hex format has an address field. This is kind of nice should the file be discontinuous. You know where to write the bytes based on the address field.
This field only covers 64k bytes so there is another record type that gives an address to add. If the hex file is coming from a compiler, the appropriate record type may already be determined. If what you have is a big heap of bytes, you can decide how to implement the Extended Linear Address record (type '04). The Arduino I2C is trivial, the rest of the project is going to take a little time.
This should be an interesting use of Arduino and Python (or whatever). There's another way to skin this cat - skip the Arduino and buy one of the FTDI FT2232 bridges. I haven't gone down this rabbit hole. One comment is that writing code is time consuming but there is a library wrapper (Linux based) I like breaking the project up into pieces. I would probably create the Arduino serial exchange with Intel Hex bit and the I2C library first and then worry about what to do with the PC end of the business. Any language can be used, Python isn't the only game in town.
What you do need is a serial library to talk to the Arduino VCOM port. I have found this tool which seems cheap: I guess that would work but I didn't do much research about it. I am not sure if it does program at24cxx eeproms or not. However, this seems to work according to description: I hoped to find a simple way using Arduino to save the file to a.txt and send it by serial port, then vise versa. I found some results but one github page is for linux with compiling software and stuff which won't help. I tried searching for using tools such as usbasp or serial to ttl converters but no use since it is I2C not serial data.
Using RPI now is not an option for me. I guess, according to your replies and my situation, buying one of these 5$ I2C EEPROM programmer is the choice (if anyone can confirm that they work). Messing with Arduino and stuff will take time and effort while I cannot provide due to my work (plus, I am not the one who will eventually work on these eeproms). I just hoped to have a simple Arduino code to dump stuff to PC via serial port or vice versa.
The major issue is reliable PC Arduino comms. As the Arduino makes no provision for hardware handshaking, you have three choices: 1. Keep the baud rate low enough so that even with the worst case delay to write to a file on the PC or to write a page to the EEPROM, neither the PC's or the Arduino's serial receive buffers will overflow.
As the worst case delay on the PC cant be guaranteed, you'll need to set the baud rate very conservatively and have some means of detecting if data has been lost. Use a higher level protocol that transfers the data as packets, with a unique packet number, length check and checksum so that retransmission can be requested for any packet that has lost or corrupted characters. This will have a considerable impact on the Arduino code, as you must wait for each packet's reception to be confirmed before you can reuse the packet buffer + you have to handle the overhead of building each packet. On the PC side, you'll probably need custom software, though it may be possible to reuse file transfer software designed to handle transfers via serial modem, with a well documented protocol and packet structure. Use Intel HEX as the data format, implement XON/XOFF handshaking for the PCArduino serial link, and code the Arduino loop function to be non-blocking so it can always respond to a received XOFF quickly.
Unfortunately the Arduino Wire (I2C) library uses blocking code so either you need to use a non-blocking Wire replacement or bypass the Wire library and use the AVR TWI hardware interface directly, otherwise you risk dropping data while waiting for an EEPRM byte or page write to complete. On the PC end, use any terminal that supports XON/XOFF handshaking, capture to, and transmission of a file. As there is no check that whole lines haven't been lost from the Intel HEX file, you also need a verify mode on the Arduino that compares received data against existing EEPROM contents, and repoorts any discrepancies and the total number of bytes checked.
Arduino-I2C-EEPROM-ProgrammerQuick and dirty 24LC256 & 24LC512 programmerRealising I needed to program some 24LC256 & 24LC512 I2C EEPROMS for some projects, there seemed to be no public programmers using an Arduino. Yet so many Arduino text books suggest using these chips.Here is a very rough but working programmer for these chips.what you will need:ArduinoI2C LCD (16 x 2 is probably easiest)PS2 style joystickSD card breakout boardSD card.bin or.BIN files on cardAll of these are easily available for cheap.It is assumed you know how to connect the display and chip to the Arduino. If not research Arduino I2C.The joystick connects to Gnd, +5V, A0, A1 & A2.SD board connects to digital 10, 11, 12 & 13.If you need to buy one, get one with a built in regulator, it should have a switch saying 3.3V and 5V. You need to switch it to 5V for MOST Arduinos including the Uno, Nano and Mega.this is because an SDcard is 3.3V and Arduinos are 5V devices.
Connection details are given in the listing.The program will detect the chip at address 0x50 and the LCD at 0x27. Change these if needed.it will then look for the SD card and report an error if not found.it will then look for.bin or.BIN files, binary files. It will list all those found, then report the number found.there can be a maximum of 20.bins's on a card.it will then ask which chip you want programmed. Left and right to select, press button to select.next, choose file to load, press button to select.It will start writing straight away. A 256 will take about 20 minutes to program and verify.
512 is untested at this time.The verify routine isn't great, it will report a pass and and error on Gail. If no error then it passed!This project is given freely in the hope it will help others learn or create something cool, amazing, clever, interesting or beneficial in some way.You are free to improve the code in any way and if it proves useful, just say thanks!