Can't upload sketch

Hello everyone!
I just built my own Arduino, with an ATMega328 with bootloader.
Unfortunately I can't upload my sketches to it. As I read over the internet, is a very common problem, but the solutions explained didn't work for me.
Here's the circuit:

I'm using WinXP and a Prolific USB-to-RS232 cable on com5 (I've tested it with a multimeter, it gives 5V, not 12V). No firewalls or external programs interfering with com ports.
Here's the error message:

Binary sketch size: 896 bytes (of a 30720 byte maximum)
C:\Documents and Settings\ech0s\Desktop\arduino-0018\arduino-0018\hardware/tools/avr/bin/avrdude -CC:\Documents and Settings\ech0s\Desktop\arduino-0018\arduino-0018\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\.\COM5 -b19200 -D -Uflash:w:C:\DOCUME~1\ech0s\IMPOST~1\Temp\build7908517036656830585.tmp\Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is "C:\Documents and Settings\ech0s\Desktop\arduino-0018\arduino-0018\hardware/tools/avr/etc/avrdude.conf"

Using Port : \.\COM5
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Send: Q [51] [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done. Thank you.

The led on the board blinks continuously at 1s period (in the sketch I want to upload it has to blink at 5s period). Sometimes when I connect the cable or reset the board the led blinks three times fastly, the goes back to normal operation. I've tried everything in the troubleshooting, even changing the baud rate to 9600 in the preferences file. Nothing worked.
Please help me, I'm desperate! :-[

Nobody can help me? :cry:

Have you performed a "loop back" test?

do you mean to test the cable?
in that case, yes, I tried with hyperterminal @115200bps and the cable communicates perfectly in loopback.

Have you wired the auto-reset?

yes,I connected the dtr but I think it doesn't work, I have to manually reset the board

Try this...

  • Start Arduino
  • Load or create a simple blinky Sketch
  • Select Arduino Duemilanove or Nano w/ ATmega328
  • Select the correct serial port
  • Verify
  • Connect your board to the computer if it is not
  • Hold the reset button on your board
  • Release the reset button and execute Upload in the IDE as close together as possible

It didn't work.
But i Noticed that

avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20] //GETS STUCK HERE UNTIL I PRESS RESET ON THE BOARD
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Send: Q [51] [20] //GETS STUCK HERE UNTIL I PRESS RESET ON THE BOARD
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

WHat would that mean?

I have no idea.

You've reached the limit of what I can provide. The only suggestion I have left, and it isn't a very good suggestion, is to carefully check the wiring.

Well, there is one other thing. Where did you get the processor? Is it possible there is no bootloader? Or that the fuses are not correct?

I got the chip from Robot Italy, it's advertised as a chip WITH bootloader...
Anyway, what could be wrong with the fuses? In the mean time I'll triple check the wiring.

Checked the wiring, it seems ok.
Checked the communication with a COM monitor, here's the report:

COM port is opened
COM port is closed
COM port is opened
In/out queue size 2048/1024
Baud rate 9600
RTS off
DTR on
Data bits=8, Stop bits=1, Parity=None
Set chars: Eof=0x04, Error=0x00, Break=0x00, Event=0x0A, Xon=0x00, Xoff=0x00
Handflow: ControlHandShake=(DTR_CONTROL), FlowReplace=(), XonLimit=0, XoffLimit=0
Set timeouts: ReadInterval=0, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Baud rate 9600
RTS off
DTR on
Data bits=8, Stop bits=1, Parity=None
Set chars: Eof=0x04, Error=0x00, Break=0x00, Event=0x0A, Xon=0x00, Xoff=0x00
Handflow: ControlHandShake=(DTR_CONTROL), FlowReplace=(), XonLimit=0, XoffLimit=0
Set timeouts: ReadInterval=-1, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Baud rate 19200
RTS off
DTR on
Data bits=8, Stop bits=1, Parity=None
Set chars: Eof=0x04, Error=0x00, Break=0x00, Event=0x0A, Xon=0x00, Xoff=0x00
Handflow: ControlHandShake=(DTR_CONTROL), FlowReplace=(), XonLimit=0, XoffLimit=0
Set timeouts: ReadInterval=-1, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
DTR off
RTS off
DTR on
RTS off
DTR off
RTS off
DTR off
RTS off
COM port is closed
COM port is opened
In/out queue size 1024/1024
Baud rate 19200
RTS off
DTR off
Data bits=8, Stop bits=1, Parity=None
Set chars: Eof=0x00, Error=0x00, Break=0x00, Event=0x00, Xon=0x00, Xoff=0x00
Handflow: ControlHandShake=(), FlowReplace=(), XonLimit=0, XoffLimit=0
Set timeouts: ReadInterval=0, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
DTR on
Set timeouts: ReadInterval=250, ReadTotalTimeoutMultiplier=250, ReadTotalTimeoutConstant=250, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Set timeouts: ReadInterval=500, ReadTotalTimeoutMultiplier=500, ReadTotalTimeoutConstant=500, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
0
Set timeouts: ReadInterval=250, ReadTotalTimeoutMultiplier=250, ReadTotalTimeoutConstant=250, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Set timeouts: ReadInterval=500, ReadTotalTimeoutMultiplier=500, ReadTotalTimeoutConstant=500, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
0
Set timeouts: ReadInterval=250, ReadTotalTimeoutMultiplier=250, ReadTotalTimeoutConstant=250, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Set timeouts: ReadInterval=500, ReadTotalTimeoutMultiplier=500, ReadTotalTimeoutConstant=500, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
0
Set timeouts: ReadInterval=5000, ReadTotalTimeoutMultiplier=5000, ReadTotalTimeoutConstant=5000, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
//SENT WHEN I PRESS RESET ON THE BOARD
Set timeouts: ReadInterval=250, ReadTotalTimeoutMultiplier=250, ReadTotalTimeoutConstant=250, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Set timeouts: ReadInterval=500, ReadTotalTimeoutMultiplier=500, ReadTotalTimeoutConstant=500, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Q
Set timeouts: ReadInterval=5000, ReadTotalTimeoutMultiplier=5000, ReadTotalTimeoutConstant=5000, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
//SENT WHEN I PRESS RESET ON THE BOARD
COM port is closed

The led on the board blinks continously at 1s period, so I don't think I burned the processor and this also excludes a bootloader problem. The cable communicates perfectly in loopback and in uploading, as I see from the report. I connected
Cable RXD -> 328 TXD
Cable TXD -> 328 RXD
Cable DTR -> 328 Reset with 10nF capacitor
Cable GND -> 328 GND
But the processor doesn't respond...

Are you using a resonator or a crystal? Do you have capacitors on the crystal? Is the crystal wired very close to the processor?

I'm using a 16MHz crystal with 22pF capacitors. The crystal is very close to the chip (the breadboard could cause problems? I'll check also this one).
Anyway I ordered a new cable, I'll let you know if this helps.
Thank you very much for all your help until now!!! :slight_smile: