I have an arduino demilove (atmega328) running a ported version of liblo that was our own work, and uIP based on the wishield codebase. I am programming it from an Ubuntu 10.04 computer.
I have it able to receive data and such from the wifi network and change the color of my LED light using OSC packets, but when I make updates to the code and try to upload them, about 90% of the time it fails with various errors ranging from "out of sync" to "lost communication" to "not connected". But if I keep hitting "upload" without necessarily even resetting the device, it will suddenly work.
Here are some examples of sequential error messages, after taking off the wishield just in case that is causing an issue:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x10
avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x10
avrdude: stk500_recv(): programmer is not responding
Successfully Uploaded
Successfully Uploaded
Successfully Uploaded
avrdude: stk500_recv(): programmer is not responding
and so on. This is all sequential, without any shields, with code that functions when it successfully uploads (i.e. is presumably not somehow hard-locking the arduino if that would prevent programming), and without power cycling or trying to reset the device.
I can only think of two possibilities for this.
-
The arduino bootloader or avrdude have too short of a timeout and don't wait long enough to upload the 17596 byte program before assuming the programmer isn't responding.
-
My code is somehow blocking the bootloader from functioning.
(2) seems unlikely because I have it turn on an LED light on startup. When I start programming, the LED light turns off. Whenever it fails to program, it turns the LED light back on before the arduino software reports successfully uploading the code. This seems to me to indicate that the device is successfully being put into "reset" mode for programming, but is leaving programming mode before it is finished.
Does anyone know how I can check to see if it is a timeout issue in the bootloader or on the avrdude side of things? Or does anyone have alternative ideas as to what the problem could be? I need this to program 100% of the time reliably (or at least 95% of the time).
I tried uploading a smaller, simpler program (1334 bytes) 20 times, and it worked 19 times out of 20. Unfortunately, this doesn't help me distinguish between problems (1) and (2), but it does verify that my programmer in general does work (assuming the one failure was a fluke).
Thanks,