Arduino Uno BIOS Flasher

We’ve seen the Arduino used to flash BIOS chips several times now. But these hacks are almost always the result of a bad flash. This time around [GNUtoo] is interested in putting a tool in your hands which can be used to flash Coreboot to your motherboard. His offering uses the Arduino Uno, but there are several other hardware options covered as well.

The firmware makes use of the serprog-duino library which was crafted at writing to flash memory chips. On the computer side of things the flashrom package pushes the BIOS image to the Arduino. The nice thing is the flashrom is a common packge in Linux repositories so it’s probably just an apt-get away.

The process isn’t fast, taking about ten minutes to program a 1 Mb chip. But if you’re just interested in loading an open source BIOS alternative this is easy to set up.

39 thoughts on “Arduino Uno BIOS Flasher

  1. hi,

    before it took 10 minutes to program a flash chip of 1M, I’ve improved the code and it now takes about 3 minutes.
    However I forgot to remove the sentence where I tell that it takes 10 minutes on the wiki before sending the news.

    By the way the serprog-duino is not a library but a program made with the help of avr-libc(http://www.nongnu.org/avr-libc/).

    I think it also requires a recent version of flashrom(I used the svn version when writing the serprog-duino code).

    Thanks for having posted the news.

    Denis.

        1. was able to flash the p5b mobo using spare pc p/s putting a switch in to start it and appropriate voltages cable colors are red +5v, Orange +3.3v, Yellow +12v and black ground, old usb header that would go in pci slots on back of case.
          there are diy pages that give you pinouts and the rest to build your spi bios reprogrammer, used usb with win98 dos, cwsdpmi, and spipgm2, current bios update from Asus, follow guide and save your board

      1. Hi Tom,

        I’ve no duemillanove so I cannot test but I suspect that that part of the serial code should be different.
        I’ve a bugduino tough, I’ll test with that.

        By the way just to be sure, did you change the Makefile according to your model?

        for instance:
        -PORT=/dev/ttyACM0
        -BAUD=115200
        +PORT=/dev/ttyUSB0
        +BAUD=57600

        1. Changed the makefile accordinly hex uploads and arduino is ready. Changed the command to ttyUSB0:57600. :) I’m not able to connect the arduino to the spi header yet because I don’t know the pinout.

      2. # flashrom -p serprog:dev=/dev/ttyUSB0:115200
        flashrom v0.9.5.2-r1523 on Linux 3.0.0-17-generic-pae (i686), built with libpci 3.1.7, GCC 4.5.2, little endian
        flashrom is free software, get the source code at http://www.flashrom.org

        Calibrating delay loop… OK.
        serprog: Programmer name is “serprog-duino”
        Found Winbond flash chip “W25X80” (1024 kB, SPI) on serprog.
        No operations were specified.

        That is with my bugduino:
        * Only the Makefile was changed like before:
        -PORT=/dev/ttyACM0
        -BAUD=115200
        +PORT=/dev/ttyUSB0
        +BAUD=57600
        * I used 115200, to use another speed you must change the source code. The thing is that on my bugduino only the bootloader speed is at 57600, after the code set the serial port at 115200

        I’ll try to think of a way to make the Makefile universal (maybe by using ?=)

        Denis.

        1. It worked :) “Calibrating delay loop… OK.
          serprog: Programmer name is “serprog-duino”
          Found Generic flash chip “unknown SPI chip (RDID)” (0 kB, SPI) on serprog.”

          Will connect it to the spi header sometime this week. Post back the results :)

  2. Interesting, a while ago I had a bad flash on a laptop (the flash is a winbond 25x16avsig spi). I desoldered the bios chip and wired it up to my avr 2560 but never got around to writing the code for it. Perhaps now I don’t have to.

    1. I can’t seem to get it to work on my arduino mega, it’ll connect to flashrom but wont read the chip at all. I changed the #defines so it uses the correct pins and the interrupt. Any idea?

      Here’s the #defines I changed.
      #define SPI_PORT PORTB
      #define SCK PORTB1 /* port 52 */
      #define MISO PORTB3 /* port 50 */
      #define MOSI PORTB2 /* port 51 */
      #define SS PORTB0 /* port 53 */
      #define DDR_SPI DDRB

      And the interrupt:
      ISR(USART0_RX_vect)
      {
      handle_command(UDR0);
      }

      1. I’ve no arduino mega either but someone did a flashrom compatible flasher(also listed on flashrom website) with the arduino mega, altough beware because I think the author forgott to add a license to his code.

        Denis.

        1. It worked ! I tried it tonight on my P5B bios chip. Worked like a charm. Wouldn’t verify at first but I changed 3.3v to 5v and now the bios chip is flashed. Thanks again for your fantastic work :).

  3. I wonder if a UNO is necessary, or if I could use a bare ATMega328 or even something like a ATtiny84.
    I like the idea of modifying the BIOS of some of my computers, I plan to try this out if I am able to use what I have on hand (I have a dorkboard, I don’t have an official Arduino).

  4. It works with arduino duemillanove with that patch:
    diff –git a/serprog.c b/serprog.c
    index daf797e..fafe77d 100644
    — a/serprog.c
    +++ b/serprog.c
    @@ -72,7 +72,7 @@
    void setup_uart( unsigned long bauds )
    {

    – int freq = (F_CPU / 4 / bauds -1) /2 ;
    + int freq = ( (F_CPU / (8 * bauds) ) -1) ;
    /* Set baud rate */
    UBRR0H = (unsigned char)(freq>>8);
    UBRR0L = (unsigned char)freq;
    @@ -122,7 +122,6 @@ void putchar_uart( unsigned char data )
    /* Wait for empty transmit buffer */
    loop_until_bit_is_set(UCSR0A, UDRE0);
    /* Put data into buffer, sends the data */
    – _delay_us(10); //8us mostly stable, 10us to be sure
    UDR0 = data;
    }

  5. Hi there i recently tried to update myJH. now ive read that i can order a replacement BIOS but before that i want to explore my chances now i have a ARDUINO UNO and i have desoldered the chip, it is a W25Q32 SOIC 8-PIN which can be ordered from this site: http://www.ebay.co.uk/itm/BIOS-CHIP-ASUS-G71G-G71Gx-G71V-N50Vc-N50Vn-G73JH-G73JW-/170533190039?pt=UK_Motherboards_CPUs&hash=item27b491f997&clk_rvr_id=392429124620&afsrc=1#ht_1028wt_699

    now i have the image i want to flash and to flash it with the arduino… but how do i connect the pins and how do i put the image n there? is there a detailed guide i can follow for this? is it even possible for me? thanx for the time.

  6. im sorry for the badly written post, i have a ASUS G73JH with a bricked BIOS, i have desoldered the chip and i want to flash the BIOS in manually with the ARDUINO UNO, how do i do that? thanx for the help again

  7. hi gui, ive been trying to erase and write .bin file to my ST Micro/SGS M25P32 using my arduino uno but no luck. i completely newbie, i dont know how to use cmd to run flash rom. i have done the wiring right. can i request you a clear step by step guide on how to erase and write .bin file?? please. thanks a lot

  8. thank to your reply

    i used windows 7 cmd and type cd\
    then type (-p serprog:dev=/dev/ttyACM0:2000000 -r coreboot.rom)
    then replied (# is not recognized as internal or external command
    operable program or batch file)

    is windows compatible with flash rom?

    could you explain to me your guide like below:

    Required software
    To make it work you need:
    flashrom from svn
    serprog-duino which runs on the arduino
    The avr toolchain(avr-gcc, avr-libc,make etc…)
    Building the software
    $ svn co svn://flashrom.org/flashrom/trunk flashrom
    $ cd flashrom && make
    $ cd ../
    $ git clone git://gitorious.org/gnutoo-personal-arduino-projects/serprog-duino.git
    $ cd serprog-duino && make && make upload
    Running flashrom
    ./flashrom -p serprog:dev=/dev/ttyACM0:2000000

    1. I think there is some port of flashrom for Microsoft Windows, specially for external programmers, you should try that, but I don’t have Microsoft Windows to test….
      you would also need to create a Microsoft Windows specific howto: you would need a toolchain for avr(there is one included with the arduino IDE).

  9. If you are having issues with reliability while flashing, shorten the cables from the arduino to the flash chip. I was using 1Ft cables and sometimes flashrom would see the chip, sometimes not. When the chip was recognized, the erase would fail. I shortened the cables to under 10in and it worked flawlessly. Only took me 3 days to figure out!

  10. Hi. I know this a very old post. Im trying to fhash a BIOS chip (winbond w25Q64FV) with an arduino nano. I’m first reading/dumping the information inside the chip for backup, but it is taking a long time, and I don’t even know if it is working, because only says: “Reading flash ….” but no file has been created yet. It’s been running for about 1 hour now.

    Is this normal. How long does it takes to read the full content of the chip. It’s 8KBytes.

    I am using:
    Arduino nano with frser-duino
    flashroom

    Thanks in advance.

    1. UPDATE:
      It appears that the chip has some bad sectors. I have done some tests reading small chunks of the flash. Some of these readings finish ok inmediatly, while other hungs indefinitelly.

      Is there anyway of forcing the read/write of flash even if some sectors are bad ?

      Kind regards

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.