I will use this post to describe the process I went trough to (re)flash the BIOS on a bricked ASUS P5B using a Arduino and some freely available software.
Some background info: My cousin gave me this motherboard and asked me to have a look at it after a failed BIOS update left him with a nice big paperweight. I’ve actually attempted to fix this board before using the method described here but I eventually gave up after I realised I lacked the necessary skills and shelved the project. Fast forward a year or so I come across a post on hackaday about a Arduino based BIOS flasher and decided the time had come to give it another try.
The requirements (can also be found here):
- A chip compatible with or supported by Flashrom, in my case a mx25L8005 (a list of all supported chips can be found here)
- Any of the supported Arduinos:
- any based on the ATmega328 (/168/88 will work with small changes too), like the Arduino Uno R3.
- Arduino Mega or Mega2560, but notice that the software has a different branch for them.
- a way to convert the 5V logic levels to 3.3V (except if 3.3V arduino, these are rarer)
- frser-duino (formerly known as serprog-duino)
- AVR toolchain
Before you can actually flash the chip you must first connect the flasher to the chip. Some motherboards have a SPI header which makes connecting the Arduino a breeze. Other motherboards may have a removable chip which you transport to a breadboard. If your motherboard doesn’t have either one you will still be able to use this method but you might need some wires/clips specially designed for working with chips and or microprocessors.
The ASUS P5B motherboard has a SPI header located near the BIOS chip. The pinout can be seen in the picture below. Please note that pin names can differ between chips ( i.e. the SO pin can also be named MISO or DO depending on the chip).
[Header Pins] <--> [Arduino Pins]
 VCC (3.3V in my case)<-->[3.3V]
If your motherboard does not have a SPI header you can use the following information
Left pins of the BIOS chip:
[pin1 of the bios chip] /CS<->10k resistor<->VCC
[pin1 of the bios chip] /CS<->Arduino pin10(SS, PORTB2)
[pin2 of the bios chip] DO<->Arduino pin12(MISO, PORTB4)
[pin3 of the bios chip] /WP<->VCC
[pin4 of the bios chip] GND<->GND on the power pins
Right pins of the BIOS chip:
[pin8 of the bios chip] VCC<->+3.3V on the power pins of the Arduino
[pin7 of the bios chip] /HOLD<->VCC
[pin6 of the bios chip] CLK<->Arduino pin13(SCK, PORTB5)
[pin5 of the bios chip] DIO<->Arduino pin11(MOSI, PORTB3)
First you’ll need flashrom, the AVR toolchain and Git which can be installed with some simple “apt-get’s” (I’ve used a Ubuntu live CD for this part).
sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude git
Next we’ll download and build frser-duino.
$ git clone --recursive git://github.com/urjaman/frser-duino
$ cd frser-duino
If you have a Arduino with an FTDI chip (which my Duemilanove has) you can use the command below. If not skip to the part about the 8u2 or 16u2 boards.
$ make ftdi && make flash-ftdi
Edit: If you execute the command above and receive an error stating that LTO has not been enabled you will either have to build avr-gcc with LTO enabled or remove -flto and -fwhole-program from the makefile. I’ve opted for the latter which did the trick.
For a board with an Atmega 8u2 (Arduino Uno) or a 16u2(Due) you can use:
$ make u2 && make flash-u2
Hooray 😀 !You’ve reached the best part! In this step we’ll use flashrom to flash our chip.
To flash the chip you can use this command:
flashrom -p serprog:dev=/dev/ttyUSB0:2000000 -w P5B.rom
If all goes well flashrom will write the specified file to the chip(in my case the P5B bios rom).
To check if everything went according to plan you can dump the chip’s content by using this command. Or use the -v option while running flashrom to verify that the flashing was successful.
flashrom -p serprog:dev=/dev/ttyUSB0:2000000 -r good.rom
After completing the dump you can use a hex editor to compare the files. If they match it means you’ve successfully flashed your chip 🙂 .