EEPROM CH341A programmer – Read and write data to chip on Linux

In this tutorial we will use CH341A programmer to read, write and erase data/firmware on attached chip. This is your getting started guide to CH341A programmer. CH341A programmer allows users to attach variety of chips in order to read or backup firmware or overwrite the exiting firmware.

In this tutorial you will learn:

  • How to compile ch341eeprom software
  • How to read data from chip via CH341A
  • How to write data to chip via CH341A
  • How to erase data from chip via CH341A

EEPROM CH341A programmer - Read and write data to chip on Linux

Software Requirements and Linux Command Line Conventions

Category
Requirements, Conventions or Software Version Used

System
Debian/Ubuntu

Software
ch341eeprom

Other
Privileged access to your Linux system as root or via the sudo command.

Conventions
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

EEPROM CH341A programmer on Linux

There is a plentiful of software available on Linux to deal with EEPROM CH341A  programmer. Many of them are available via standard Debian repository such as flashrom.

However, after multiple attempts I have not been able to use any of the tools to recognise my CH341A programmer and the chip. After days of searching I have settled with ch341eeprom software.

  1. Let’s get started with all prerequisites:
    # apt install git make libusb-1.0-0-dev clang
    
  2. In the next step we will clone the ch341eeprom repository.
     git clone https://github.com/plumbum/ch341eeprom.git
  3. Now navigate to a directory and execute the make command to compile the source code:
    $ cd ch341eeprom
    $ make
    
  4. Once you have compiled the software locate the executable ch341eeprom. Feel free to execute the newly compiled software now. The output should look as follows:
    $ ./ch341eeprom
    ch341eeprom - an i2c EEPROM programming tool for the WCH CH341a IC
    Version 0.5 copyright (c) 2011 asbokid <[email protected]>
    
    This program comes with absolutely no warranty; This is free software,
    and you are welcome to redistribute it under certain conditions:
    GNU GPL v3 License: http://www.gnu.org/licenses/gpl.html
    
    Usage:
     -h, --help             display this text
     -v, --verbose          verbose output
     -d, --debug            debug output
     -s, --size             size of EEPROM {24c01|24c02|24c04|24c08|24c16|24c32|24c64|24c128|24c256|24c512|24c1024}
     -e, --erase            erase EEPROM (fill with 0xff)
     -w, --write  write EEPROM with image from filename
     -r, --read   read EEPROM and save image to filename
    
    Example: ch341eeprom -v -s 24c64 -w bootrom.bin
    
  5. Insert the EEPROM CH341A programmer with the chip into the USB port. Following the above example execute the following commands while changing command arguments to fit your needs:

    READ(backup) CHIP with size 24c32

    $ ./ch341eeprom -v -s 24c32 -r firmware.bin
    

    WRITE to CHIP with size 24c128

    $ ./ch341eeprom -v -s 24c128 -w firmware.bin
    

    ERASE chip with size 24c128

    $ ./ch341eeprom -v -s 24c128 -e
    

    Write firmware with EEPROM CH341A programmer

Conclusion

In this tutorial, we saw how to read, write and erase data on the chip using EEPROM CH341A programmer. As already mentioned I was unable to use standard tools like flashrom to access chip via CH341A programmer. If you have different experience or other tools to work with EEPROM CH341A programmer leave the comments below.