Go Down

Topic: [Solved!] Help! Target stuck in a sketch. (Read 1 time) previous topic - next topic

EmilyJane

Sep 16, 2011, 09:55 pm Last Edit: Sep 20, 2011, 10:46 pm by EmilyJane Reason: 1
Okay, I got a 16MHz crystal today and installed it in the AAG logic board. Just for fun, I compiled and attempted to upload the sketch that was topmost in the IDE window. Without doing anything special, I got a successful upload. The sketch ran and printed what it was supposed to to the serial monitor. I was ecstatic.

Now, when I try to upload another sketch, I get this error:

Quote
avrdude: stk500_recv(): programmer is not responding


I hooked the logic analyser up to the USB/serial bridge and captured TX, RX, by triggering off of the reset pulse. Lo and behold, the AAG is running the sketch I programmed into it first.

My reset pulse from the USB/serial bridge at the processor is 200 µsec and the sketch starts transmitting characters 3.8 msecs after the end of the rest pulse.

Obviously, the bootloader is not talking to the IDE, but why?

CrossRoads

The sketch is too busy talking to listen.
Try this - press & hold the reset button. Start the download - when the sketch says "downloading xxxx of xxxx bytes" release the reset - this will let the bootloader sync with the IDE.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

EmilyJane


The sketch is too busy talking to listen.
Try this - press & hold the reset button. Start the download - when the sketch says "downloading xxxx of xxxx bytes" release the reset - this will let the bootloader sync with the IDE.


I tried that numerous times. Actually, I don't have a reset "button" but I have a wire lead that I can plug and unplug pretty much like a button.

EmilyJane

The AAG logic board originally had a 200K resistor to 5V and a 0.1µF cap to ground. I removed the cap so that the auto-reset from the serial interface would work. I have a 100nF cap from the reset pin to the serial interface like on the Arduino boards. Do you suppose that resistor is too large? The Arduinos have a 10K.

I left it alone because it is an SMD and I didn't have anything to replace it with but I can parallel a discrete with it to get the equivalent down to around 10K. I'll try that.

EmilyJane

#4
Sep 16, 2011, 10:56 pm Last Edit: Sep 16, 2011, 11:06 pm by EmilyJane Reason: 1
That didn't help. I noticed I wasn't capturing all the activity on the serial IO so I stretched my sample period out to a couple of seconds. After reset, which it 32 µsec with the 10K pull-up, the programmed sketch runs three times and then the IDE sends 0x30 and 0x20 twice to the target. This happens about 1400 msec after reset.

It's acting like that first upload could have overwritten part of the bootloader, but I don't know how that would happen. Maybe the latest combination of Arduino(22) and the Atmega8 bootloader delivered with it are not compatible and no one has noticed it yet. I'm graspin' at straws here.

Go Up