I have a weird problem where once in a while a sketch will not start after upload. The sketch will always start after a reboot or pressing the reset button, and will always start if I open the com port from the IDE or a terminal program. The sketch will also always start when disconnected from my computer and powered by a separate power supply.
Essentially everything works as advertised except at seemingly random times I'll make a change in the source code, recompile, upload...and nothing happens until manual intervention.
My setup is a breadboarded ATMega328 and FT232RL USB connection, basically following the Duemilanove schematic without the power regulator. I programmed the chip using Optiloader and Optiboot 4.4.
I can't seem to find any rhyme or reason when it happens -- 9 times out of 10 new code upload and starts fine; once in a while the code uploads but the sketch doesn't start on its own.
Has anyone run into anything like this, or does anyone have any ideas on how to fix this?
Thanks in advance.
Somehow your reset is being held low?
a picture or a schematic would be appreciated.
I didn't quite understood this: "basically following the Duemilanove schematic without the power regulator. "
Where do you get your power from?
What is your sketch supposed to do?
My breadboard copies this:
But it doesn't have the MC33269D power regulator.
The connection between the ATMega328 and FT232RL is exactly like the schematic -- RX & TX between the chips are connected with 1K ohm resistors, AGMega's Reset has a 10K pullup resistor, a reset button, and a .1uF cap connected to DTR off the FT232RL.
Power comes from the computer when connected to USB and from a 5V 2A regulated power supply when run standalone.
I'm having this problem with everything from basic test sketches (blink LED, debug text to serial port) to a full-blown sketches controlling a matrix of LEDs.
Try adding a diode (1N400x) from reset pin to +5vdc, cathode wired to +5vdc pin. This can solve a rather insidious latch up type problem caused by the auto-reset circuit. If you look at the latest Arduino Uno release 3 schematic drawing you will see they finally added this fix also.
Thanks Lefty, I think that worked! I added a 1N4004 per your suggestion and just uploaded 20 times in a row with no problems.
You are my hero for the day.