User Tools

Site Tools


tutorials:hardware_hacking:ch341a

BIOS Flashing with the CH341A Mini Programmer

The CH341A is an inexpensive USB eeprom programmer capable of flashing various flash chips.
The CH341A is literally just plug and play on linux using flashrom.

Connect required pins

Each pin is labeled at the bottom of the PCB take extra care that you connect the right pins to your Test Clip.
In this example I am using a POMONA IC Test Clip.

Read Flash

With everything connected and powered up run the following command from your terminal. (You may need to be root or run as sudo)

flashrom --programmer ch341a_spi

1 of 2 things will happen

  1. It will fail to detect anything e.g (No EEPROM/flash device found.)
  2. It will detect and display chip information e.g (Found (ChipBrand) flash chip “Model#” (size kB, SPI) on ch341a_spi.)

If you see “No EEPROM/flash device found” in the output then congratulations you have failed!:-)
Just double check your connections/pins and try again.

sudo flashrom --programmer ch341a_spi
flashrom v1.2 on Linux 5.5.7-arch1-1 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isn't found automatically.

If everything is connected correctly then you should see output displaying the Brand Name, Model# and Size of the flashchip.
In my case flashrom detected a Winbond flash chip Model# W25X64 with 8192 kB of memory.

sudo flashrom --programmer ch341a_spi
flashrom v1.2 on Linux 5.5.7-arch1-1 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25X64" (8192 kB, SPI) on ch341a_spi.
No operations were specified.

Now that flashrom has successfully identified our flashchip we will do 3 READ operations on the chip so we will have (bios1.rom bios2.rom and bios3.rom)
We will then run an md5sum on all 3 roms to make sure they all match.

So let's try reading some flash data.

Run the following command from the terminal.

This command will read the data from the flashchip and save it as bios1.rom

sudo flashrom --programmer ch341a_spi --read bios1.rom
sudo flashrom --programmer ch341a_spi -r bios1.rom
flashrom v1.2 on Linux 5.5.7-arch1-1 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25X64" (8192 kB, SPI) on ch341a_spi.
Reading flash... done.

When the first read has completed run the command below.

sudo flashrom --programmer ch341a_spi --read bios2.rom

When the second read has completed run the command below.

sudo flashrom --programmer ch341a_spi --read bios3.rom

You should have 3 files now

  • bios1.rom
  • bios3.rom
  • bios3.rom

Run the following command from the terminal.

md5sum bios*.rom

md5sum output

ca60c57ec4a5a219657e7f09c062ef2a  bios1.rom
ca60c57ec4a5a219657e7f09c062ef2a  bios2.rom
ca60c57ec4a5a219657e7f09c062ef2a  bios3.rom

If all the hashes match your good to go.


Write Flash

TODO…

tutorials/hardware_hacking/ch341a.txt · Last modified: 2020/03/14 12:18 by lonniemason