Custom arduino upload problems

I am making a custom bare bones arduino to drive a bank of LEDs. I am having a problem programing using my serial header. Every time try to program, I press the reset button and press upload. The pin 13 led flashes three times and then resumes the previously installed sketch (blink).

My design includes: 4x inputs (a0-a3) 6x PWM output (all pwm pins) 1x Serial programming header 1x pin 13 output 1x 5v power in (external regulator) 1x ceramic resonator 1x reset button input (with pullup) 1x Atmega328

As I said, I cannot program it. I can remove the chip, and program it in another board though. I am trying th use the TTL-232R-3v3 cable to program it. Again, I know the computer and cable work because I can program in another board. I went through all of the solder joints and made them cleaner, but still, no change. I receive the same error everyone else does (that two-line one, sorry I can't copy and paste right now)

I will post pictures when I get home, but does anyone know of a hardware problem that could be causing this error?

Thanks, -Adam

so obviously you have power and ground and you’re running code ok.

the most obvious error would be an open in either tx or rx or the two of them swapped.

you could diagnose by loading a sketch on the other board that uses serial and see if the serial connection works in your board?

Good idea. I'll try a serial program. I have continuity tested the the serial pins and they match up with what the pins are on another board, but it's possible. If I don't get a working serial connection, is it dangerous (If I was right the first time) to try switching the TX and RX connectors? Would I short out the board or the computer?

Thanks, -Adam

(I left my camera at work, so no pictures yet...)

I tried the example here: http://www.arduino.cc/en/Serial/Available

I uploaded the sketch on a Boarduino then moved the chip to my LED project board. The program worked! Serial works fine in both directions...

So, Hardware issue? I'm not using a reset cap, but that shouldnt be an issue if I press the reset button right before uploading...

Any ideas? -Adam

So, Hardware issue? I'm not using a reset cap, but that shouldnt be an issue if I press the reset button right before uploading...

Yes hardware issue. It is definitely an issue if you are using a chip that has the auto-reset bootloader. Otherwise it is very difficult to get the timing correct (maybe 1 in 100 times). So, you can upload the NG bootloader if your chip is a 168 and you have a programmer. Otherwise it may just be easier to add the auto-reset cap.

Thank you! I figured that I had a window (1-3 seconds?) where the IDE would wait for a response but apparently not! I started a second board due to lack of ideas on how to fix the first. When I got to it, I used a reset cap with my serial header and it worked on the first try! I kept the same (basic) design with my second board. Tomorrow, I'll add the capacitor to the original board to see, but it looks as if this solved my problem!

Do you know why the auto reset feature is mandatory in the 328's bootloader? Back when the 168's were the chip, I used the manual reset method on custom boards many times...

Thanks, -Adam

I wouldn't say it's mandatory, but the standard bootloader is designed with the production boards and auto-reset in mind. It makes the upload process much faster for the vast majority of users that have auto-reset boards. I have a modified version of the 328 bootloader that I use on my boards when auto-reset is not desired but I still want to use the bootloader. You need a programmer to put it on the chip, but they are a great investment if you want to buy virgin chips.

Ok. False alarm. It is still broken!

I added the cap to my first board and now it autoresets! but does NOT program. The serial connection does still work (I tested with the same sketch as above). My second board does not program anymore either.

The boards reset, and when 13 is done flashing, it starts the previous sketch and the IDE still says "Uploading to I/O board"

Ideas? -Adam

[edit] Verbose avrdude output:

Binary sketch size: 896 bytes (of a 30720 byte maximum)
C:\Program Files (x86)\arduino-0017\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-0017\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pm328p -cstk500v1 -P\\.\COM4 -b57600 -D -Uflash:w:C:\Program Files (x86)\arduino-0017\examples\Digital\Blink\applet\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:\Program Files (x86)\arduino-0017\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM4
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 57600
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.

[/edit]

another note: the problem starts happening after I have added wires between my PWM plugs and the PWM pins...

Are you saying it programs fine until you connect something to the pwm pins? What are you connecting to the pwm pins?

No it programs until i connect plugs to the pwm pins. There is nothing in the plugs yet.

I found this out because I tested my second board constantly and it was after I added the last wires (pwm) that it stopped working.

Pictures of my board (worked until the green wires to the pwm plugs (6plugs on the right) were added)

http://adamsworld.name/files/adamduino

Sorry about the file size but I wanted to keep detail.