Flashing a bios chip with an Arduino

In this post I will describe how to flash a BIOS (SPI) chip using a Arduino Duemilanove. I first learned about this method after reading about it on hackaday. At the time I had a Asus P5B motherboard that suffered from a bad BIOS flash and needed to be recovered. I tried other methods before but found none were as easy as this one.

So lets get started.

The requirements

Hardware

  • Arduino Duemilanove (full list can be found here https://www.flashrom.org/Serprog/Arduino_flasher )
  • A flash chip that is supported by flashrom ( full list available here https://www.flashrom.org/Supported_hardware )

Software

  • Ubuntu 16.04 VM
  • Flashrom
  • Fser-duino

Preparing the environment

Installing Git and the dependencies needed for Flashrom and frser-duino:

sudo apt-get install git libpci-dev libusb-dev libusb-1.0 gcc-avr binutils-avr gdb-avr avr-libc avrdude

Compiling and installing Flashrom

git clone git://github.com/flashrom/flashrom.git
cd flashrom
make && make install

Preparing the Arduino Duemilanove

git clone --recursive git://github.com/urjaman/frser-duino
cd frser-duino
make ftdi
make flash-ftdi

The table below shows which pins on the Arduino should go to which pin on the SPI flash chip.

Arduino Pins SPI Pins
12 SO
11 SI
10 CS
13 SCLK
3.3V VCC +/WP + /HOLD
GND GND

Flashing the SPI chip

To verify that everything is working correctly we first run flashrom without any operations:

tom@ubuntu-vm:~$ sudo flashrom -p serprog:dev=/dev/ttyUSB0:2000000
flashrom v0.9.9-91-g0bfa819 on Linux 4.10.0-28-generic (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).
serprog: Programmer name is "frser-duino"
Found Macronix flash chip "MX25L8005" (1024 kB, SPI) on serprog.
No operations were specified.

As can be seen from the above command output, both the Arduino and the SPI chip are detected. Now we can continue with writing the new BIOS to the chip:

tom@ubuntu-vm:~$ sudo flashrom -p serprog:dev=/dev/ttyUSB0:2000000 -w <NEWBIOS>

flashrom v0.9.9-91-g0bfa819 on Linux 4.10.0-28-generic (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).
serprog: Programmer name is "frser-duino"
Found Macronix flash chip "MX25L8005" (1024 kB, SPI) on serprog.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

And thats it, the new BIOS is written to the chip and all that is left is testing if my computer boots up again.

Resources:

HP ENVY SPECIFIC:

Sansa Clip+ Repair

My girlfriend was almost in tears when she told me her beloved Sansa Clip+ would not power on anymore. She handed me the little music player and told me that earlier that day, she pressed the power button a bit too hard after which she heard something break.

When inspecting the power button I noticed it was a bit loose where it usually has some tension from the switch underneath. I decided to have a closer look and used a tutorial to help me disassemble the Sansa.
Looking at the board the problem quickly revealed itself. The “extreme” use of force had broken the solder connections between the power switch and the board and as a result the switch fell off. Time to get out the soldering iron!

After reseating the switch and repairing the broken solder connections the Sansa powered up again meaning my girlfriend could listen to here favourite music again and dry her tears.

Edit: After a week my girlfriend returned to me with her Sansa. This time she was only hearing sound from one of her earbuds instead of both. Because I taught her well she had already tried multiple headphones to verify the problem was not the headphones but rather the Sansa itself. I did some research and found that this problem can be fixed by reheating the solder connections between the headphone jack and the board. It appears that the “stress” resulting from removing and plugging in the headphones weakens the connections.