CH341A USB serial EEPROM reader under Linux

I nprogrammereeded to backup original firmware of my favourite 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 the chip is CH341A (datasheet) so I googled for some linux software and I’ve found 2 opensource drivers:

The later comes from the concept of the former one and is more recent so I chose that one. 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 have forked the original github repo and added option to manually set memory length. After setting the length manually, I was able to download complete data from my flash.


12 thoughts on “CH341A USB serial EEPROM reader under Linux”

  1. i compiled your code but the read file contents are all zeros
    I read using the command ./ch341prog -l 8388608 -r test.bin)
    I have w25q64 , can you explain more about reading ?

      1. I am trying to unbrick the same Chinese router. I am trying to read the content for now, I get this:

        sudo ./ch341prog -l 8388608 -r test.bin
        Device reported its revision [4.03]
        Manufacturer ID: ff
        Memory Type: ff
        Capacity: ff
        Chip capacity is -2147483648

        cbBulkOut: error : 1

        cbBulkIn: error : 1
        ch341SpiRead: Failed to write 3 bytes ‘Interrupted system call’

  2. How do I debug this? Any ideas? I have a w25q128fv. And usb Ch341a

    root@stock:~/ch341/ch341prog-master# ./ch341prog -l 16777216 -r nand.dump
    Device reported its revision [4.03]
    Manufacturer ID: 00
    Memory Type: 00
    Capacity: 00
    Chip capacity is 1

    cbBulkOut: error : 2

    cbBulkIn: error : 2

Leave a Reply

Your email address will not be published. Required fields are marked *