bootloader works first time only

I have hand built an arduino with an atmega328p. Everything seems to be working. Using avrdude dapa device and getting the hex files from the /tmp/build/ directory. Modifying the lcd example sketch "helloWorld.pde" I was able to test overall functionality. Including adding serial code to print out and display characters received serially on the LCD display (plus echoing them back to minicom, yep, under Linux). All worked, so serial interface is working.

Ok, now I go to the ide and attempt to burn bootloader. It fails with avrdude reporting to avr device. Ok, I go to the bootloader directory and do:
avrdude -p m328p -c dapa -E noreset -e
-U flash:w:ATmegaBOOT_168_atmega328.hex
and it programs just fine.

I then select the upload icon in the ide and voila, my sketch loads via the serial port and starts execution. Great.

Then I try to download another sketch and failure wuth the following errors.

avrdude: stk500_getsync(): not in sync: resp=0xe0
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xe0

I go through the whole deak again re-flashing the bootloader via avrdude, etc.

Its always the same, after one serial download, it won't do another.

Now, I noticed that the app I am running does not stop running/reset. I hooked my scope up to the 328's reset (1) pin and while it gets a quick pulse low, I cannot determine how low it goes. I have serial pin 4 (DTR) tied to RESET through a .1uf cap, as per the Arduino schematic.

Anybody else had this problem and a fix?


Try to press reset when you press the upload button, the bootloader is only called when the arduino is reset, if not, it will not be called and then the avr dude doesnt receive any response back from the arduino because he is running your sketch.

Nope, no good. as soon as I release the reset, the previous sketch starts running.

Where is there a site that describes the flow of the bootloader?


The atmega datasheet.
The older arduino board didn't had auto-reset and everyone could program then, as the breaduinos and things like then, its a matter of making the reset in the right time.

Them I take it that the BOOTRST vector fuse must be programmed before the bootloader will work?