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.

Comments

  1. GNUtoo says:

    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.

  2. Indyaner says:

    Whats that for a cool knob on the chip?

  3. Alex Rossie says:

    Do you pronounce his name,
    GA-noo-Too
    or
    Nu-To
    ?
    Kinda sounds like Mewtwo to me.

  4. Tom says:

    Can I use this to rescue my P5B Asus motherboard from a failed flash attempt?

    • GNUtoo says:

      is the bios chip socketed, and is it SPI?
      if so you should be able to make it work pretty easily.

      Denis.

      • Tom says:

        Its not socketed, but it has a special spi header to interact with the bios. I will attach the link to the blogpost I found which mentions flashing the sst with a DIY cable. –>http://bit.ly/4VeIww

      • Tom says:

        Update,

        Btw I have the version before the uno , now flashrom gives me a synchronize error. How can I make it work with my Duemilanove?

      • GNUtoo says:

        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

        • Tom says:

          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.

      • GNUtoo says:

        # 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.

        • Tom says:

          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 :)

        • Tom says:

          Reading the flash chip works , but erasing fails. “serprog_delay used, but the progammer doesn’t support delay” :(

      • GNUtoo says:

        Do you have compiled flashrom from svn?

      • GNUtoo says:

        I’m not sure it is or isn’t the VM, but you could try without the VM within a livecd or liveusb.

        Denis.

      • GNUtoo says:

        strange, what is your exact svn revision of flashrom?

        Denis.

  5. Colby says:

    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.

    • Colby says:

      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);
      }

      • GNUtoo says:

        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.

        • Tom says:

          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 :).

  6. g2-2632c18db7f2a691e17776255f9cb21e says:

    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).

  7. GNUtoo says:

    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;
    }

  8. Kireita says:

    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.

  9. Kireita says:

    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

  10. GNUtoo says:

    it’s explained in the flashrom wiki….
    ( http://www.flashrom.org/Serprog#Arduino_flasher_by_GNUtoo )
    Denis

  11. bruce says:

    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

  12. bruce says:

    hoping for your replay. thanks

  13. GNUtoo says:

    hi, what’s the error you get by following that howto:

    http://www.flashrom.org/Serprog#Arduino_flasher_by_GNUtoo

    Denis

  14. bruce says:

    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

    • GNUtoo says:

      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).

  15. Fence says:

    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!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,409 other followers