Electronic – arduino – How to fix an AVRdude not-in-sync error when programming Arduino via USB-to-serial cable


I'm trying to build this Ambient lighting for PC. This worked flawlessly on my Arduino Uno. My next step was to make it using "Arduino on a breadboard". So I bought a blank ATmega328 chip and burned the Arduino bootloader (for the board "Arduino Duemilanove w/ ATmega328") onto it using the Arduino IDE and USBasp; and I know this has been loaded properly as this ATmega chip works fine on the Uno.

Then I made the USB-to-serial converter using FT232RL ; but its drivers didn't install on my PC (Windows 7 x64). I suspect I overheated the surface-mount FTDI chip and killed it while hand-soldering it.

So, I've kept it aside, and got this USB-to-serial converter bridge:
(Sorry for the crappy pics)
I used an additional ST232CN on my breadboard, to convert the voltage levels from RS232 to TTL, as shown in this page. And this works fine, as I verified from a loopback test. And I've connected pin 9 of ST232 to pin 2 of ATmega, and pin 10 to pin 3.

When I tried to upload a blink example from Arduino IDE, I get this error:

Binary sketch size: 1026 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00

When I do the verbose upload (Shift+Upload), I get this error/message:

avrdude: usbdev_open(): did not find any USB device "usb"

Also, I tried adding 1k pull-up resistors at pins 2 and 3 of ATmega, but didn't help.
So I guess the problem now is in the serial communication from the ST232 to ATmega?
And is there any special connection to the Reset pin of ATmega? I've pulled it up to 5V with a 10k resistor.

Best Answer

Whenever I've gotten the 'not in sync' error, it was related to my just missing the reset timing (or forgetting the reset entirely!). For my breadboard, and Eclipse/AVRDude, un-grounding the reset pin just before or at the same time as I click the upload button is the right timing. But also check that your PC really does see the adapter when you plug it in.

Later arduino boards are built to reset whenever a serial connection gets made, and programmatically by the bootloader. This blog article describes how it works, and even more interestingly, how to hack it onto earlier boards. It shouldn't be too hard to put it on a breadboard if you wanted to. The chip needs to have a compatible bootloader, of course (which you've already put into yours). For breadboards, I just do the reset-button / mouse-click dance.