March 1, 2011

Fixing the 8u2 Firmware Bug on Arduino

Last week I bumped on a problem. I was tinkering the serial_echo program.

/*
 * serial_echo.pde
 * -----------------
 * Echoes what is sent back through the serial port.
 *
 * http://spacetinkerer.blogspot.com
 */

int incomingByte = 0;    // for incoming serial data

void setup() {
    Serial.begin(9600);    // opens serial port, sets data rate to 9600 bps
}

void loop() {
  // send data only when you receive data:
  if (Serial.available() > 0) {
  
    // read the incoming byte:
    incomingByte = Serial.read();
  
    // say what you got:
    Serial.print((char)incomingByte);
  }
 Serial.println();
  
}


Adding this red Serial.println() command there, the program loops it and it "spams" the serial port, so when you try to upload another sketch you can't. 
Normally when you press the upload button the processor resets, but there is a bug at the ATmega8U2 chip (this chip acts as a bridge between the computer's USB port and the main processor's serial port) on the Arduino board.
So to fix that you have to update the firmware (that is the program that runs on that chip).
There is an official guide here that you can follow but I will mention the problems I run into while doing it.

First thing I did was to download the DFU programmer.
Then I downloaded the firmware.
Everything OK so far.

Then you need to reset the 8u2 chip. There is a hard way to do it (soldering a resistor), which I don't recommend, and an easy way. The easy way is not well written on that guide, but this guy Pluggy helped me with it on the arduino forum. Read his post here.

After that it said to program the chip with the instructions given (under linux). I also run into a problem here. When I typed this command in the terminal:

sudo dfu-programmer at90usb82 flash Arduino-usbserial-uno.hex

It return this: 

Error parsing the line.
Something went wrong with creating the memory image.

I freaked out, but after a bit of googling I found out that the firmware file was corrupt, and I just downloaded it again.

Everything else worked great, as my arduino does now :)

If you have any question leave a comment below!

And if you like my posts then subscribe via rss, or via e-mail to stay updated.

Happy Tinkering!

If you liked this article then take a second to bookmark it with...


No comments:

Post a Comment