I needed to backup original firmware of my favorite Chinese wireless router but I didn’t want to spend much time with hacking the embedded Linux. So I have ordered this cheap USB serial EEPROM programmer on ebay. You can easily find the original utility & driver for Windows on the Internet but the chip manufacturer doesn’t provide software for Linux.
After examining the board I found out that the chip is CH341A (datasheet) so I googled for some Linux software and I’ve found 2 opensource drivers:
The first one can be used for programming 24C… I2C EEPROMs. The second one is for 25Q… SPI flash chips so it was my choice. After compiling and connecting my chip, I was able to read info about my flash.
Unfortunately, when I tried to read memory contents I was only able to get first few bytes of my memory, probably because the chip was detected incorrectly. So I forked the original github repo and added an option to manually set memory length. After setting the length manually, I was able to download complete data from my flash.
After some time I also needed to use it for 24C… programming. There are two forks of ch341eeprom on github. One which does pretend to support eeproms smaller than 128kb ( this one ) and one which really does ( this one ). Until I have found the second one, I also used a kernel module which adds /dev/i2c-x interface driver and wrote a script for writing eeproms here:
Enjoy whichever method you like.