ATmega328 and FT232RL issues

Hi everyone,

For a school project we are using an FT232 to interface with our Arduino ATmega328. We have the USB Serial Port listed in device manager as COM6 and have set up the Serial port in the Arduino IDE for COM6. The board is set as Arduino Duemilanove or Nano w/ ATmega328 in the IDE as well. When we try to upload a sketch we get the following errors:

avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

When initially plugging in the USB cable from the FT232 to PC, the TX LED flashes about 3 times (RX does nothing). When uploading a sketch to the chip, the FT232 TX LED will flash a few times before the errors come up on the IDE.

We have everything set up on a breadboard as seen here:

http://i1213.photobucket.com/albums/cc4 … C_0440.jpg

Voltage to the Arduino is from +5V power supply rail and the FT232 is running off USB voltage. When the Adruino is reset, the LED connected to D13 flashes progressively faster for approx 3 seconds then shuts off. I think something is wrong with our circuit setup because I thought these chips came preloaded with the Blinking LED program. We have tried to reset the chip just before uploading a sketch (using a wire from Pin 1 to ground for a second) with no luck.

I’ve searched high and low for problems similar to ours but haven’t found anything resourceful. Any help/ideas would be greatly appreciated.

Thanks

EDIT:
I was able to resolve the issue on both atmega328’s that I was getting the Not In sync error on. In short it appears as though my ftdi was not communicating correctly with the atmega because the auto-reset was failing. In order to correct it I burned the arduino pro 5v 16Mhz bootloader onto the atmega, and then re-burned the duemilanove bootloader. This in conjunction with the 100nF ceramic cap and a 10k resistor on the atmega’s reset pin. After doing this i’ve been able to load sketches onto both chips without a problem. I feel it’s important to note that the atmegas still do not work unless a 100nF ceramic cap is put between the ftdi and the m328p.

I’ve been fighting with this EXACT same issue for a few weeks now… I will say though based off of the picture andd your description i noticed that it doesn’t sound like you hooked up the FTDI to perform an auto-reset. The ftdi adapter that sparkfun sells is designed to be able to auto-reset an atmega if you hook up the DTR pin directly to the reset pin of the atmega. It is often recommended that you place a 100nF ceramic cap between the DTR pin and the reset pin but i’ve had it work without it.

This alone should make the arduino auto-reset and upload the sketch correctly. It should be laid out something like this:

http://img194.imageshack.us/img194/1794/atmegabb.jpg

Obviously you’re using the 16Mhz crystal for your project as opposed to the 16Mhz ceramic resonator… but the only difference is the resonator does not require the two 22pF ceramic capacitors that the crystal requires.

If you hook up the atmega in this manner and it’s still not working then we’re both having the same issue.

Thanks for your reply poent, we will be giving this a shot shortly. Is really necessary to bootload/re-bootload? And what did you use to bootload… I was thinking of borrowing an Uno and using the method described here: http://arduino.cc/en/Tutorial/ArduinoToBreadboard.

Is really necessary to bootload/re-bootload?

I tried to bootload just the duemilanove bootloader and it didn't resolve my errors. Only after I loaded the arduino pro mini bootloader AND reloaded it was my issue resolved. I had a few variables however between burning the boot loaders that could have effected the fix, so I would encourage you to try it without burning the arduino pro mini one first just to see. It couldn't possibly hurt to try.. just let me know if it worked!

Also, the tutorial you liked is a great one but there are a couple things that should be noted:

  1. I tried to use both the arduino mega as well as the arduino duemilanove as ISP programmers (which i setup following that exact tutorial) and i was receiving the same not in sync errors. I actually still have yet to successfully use an arduino as an ISP. I actually ended up buying the Pocket ISP that sparkfun offers in order to burn the boot loader.

  2. There is a more specific page related to turning the arduino into an ISp located [here, and it specifically says “you cannot use an Arduino Uno as an ISP programmer because the optiboot bootloader does not support this sketch. A revision for this is in progress”.

what did you use to bootload…

I used the Arduino IDE to do the bootloading after I knew what was happening and I will probably continue to use it for burning arduino bootloaders just because it's built into the interface. But I also loaded the bootloader with just avrdude in an elevated command prompt which worked fine. Either method should be fine.](http://arduino.cc/en/Tutorial/ArduinoISP)

I am having the same problem as the original poster, except my error message reads: “avrdude: stk500_recv(): programmer is not responding” twice. The LED I have attached to pin 13 exhibits the SAME behavior as originally described (what’s that all about!!!)…

The only difference in my setup is that I am using a 16kHz resonator and I have the 10k pullup resistor on the Reset pin, as well as a .1uF cap between DTR and Reset.

PLEASE, does anyone have any clues??? Please feel free to explain as much as you want… I’m all ears!

Thanks!

Thank you poent for the fix. I have spent countless hours of utter frustration before I came across your solution. images/icons/smile/mrgreen.gif

lqbert:
I am having the same problem as the original poster, except my error message reads: “avrdude: stk500_recv(): programmer is not responding” twice. The LED I have attached to pin 13 exhibits the SAME behavior as originally described (what’s that all about!!!)…

The only difference in my setup is that I am using a 16kHz resonator and I have the 10k pullup resistor on the Reset pin, as well as a .1uF cap between DTR and Reset.

PLEASE, does anyone have any clues??? Please feel free to explain as much as you want… I’m all ears!

Thanks!

The blinks tells you there is a bootloader running at startup… I looked through the makefile for the Arduino Optiboot bootloader and there are some different fuses set for a resonator. You could possibly build a custom bootloader with 16MHz resonator and see if that fixes your problem.

lilypad_resonator: TARGET = lilypad_resonator
lilypad_resonator: MCU_TARGET = atmega168
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
lilypad_resonator: AVR_FREQ = 8000000L
lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst

lilypad_resonator_isp: lilypad_resonator
lilypad_resonator_isp: TARGET = lilypad_resonator
# 2.7V brownout
lilypad_resonator_isp: HFUSE = DD
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
lilypad_resonator_isp: LFUSE = C6
# 512 byte boot
lilypad_resonator_isp: EFUSE = 04
lilypad_resonator_isp: isp

change to:

lilypad_resonator: TARGET = lilypad_resonator
lilypad_resonator: MCU_TARGET = atmega328
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
lilypad_resonator: AVR_FREQ = 16000000L
lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst

lilypad_resonator_isp: lilypad_resonator
lilypad_resonator_isp: TARGET = lilypad_resonator
# 2.7V brownout
lilypad_resonator_isp: HFUSE = DD
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
lilypad_resonator_isp: LFUSE = C6
# 512 byte boot
lilypad_resonator_isp: EFUSE = 04
lilypad_resonator_isp: isp

build it, burn it see if it works. I had these problems when I used non-standard crystals (8-16MHz).