[Custom Duemilanove] Bootloader works only once

Hey!

I built a small board with an Atmega168, flashed the Duemilanove bootloader to it using an STK500 (custom entry in the programmers.txt) with the Arduino IDE and tried to use the bootloader with an external FDTI board. So the first time I flash the blink example, it works without problems. The second time I try to upload anything, I get avrdude: stk500_recv(): programmer is not responding. If I reflash the bootloader, it works again, but only once. Can it be because I use an oscillator (external clock, only on XTAL1) instead of the crystal oscillator on the standard arduino boards? I tried to burn the bootloader and after that set the fuses using avrdude -p m168 -P /dev/ttyS0 -U lfuse:w:0xE0:m -U hfuse:w:0xdd:m -U efuse:w:0x00:m matching to the external clock. Same effect.
What I also noticed is that the Fade example does not fade but just blinks slowly. o.O

I use Arduino 1.0.2 btw. I remember having similar issues with an Atmega8 a few years back. (Bootloader working only once)

Sounds like you are not getting the fuses set correctly for your clock source.
Try having a go the Fuse calculator here

I always use AVR® Fuse Calculator – The Engbedded Blog which tends to work fine. I don't think that it's the fuses, because why should it work the first time? Does uploading via bootloader touch the fuses? I don't think so.

CrossRoads is correct. It's your fuse settings. I know, because I burned a few hours on this yesterday and the pain is still fresh.

Take a look at this website for the correct fuse settings:

http://letsmakerobots.com/node/28002

Specifically, I think it was the BOOTSZ or the BOOTRST fuse that was causing the behavior, but verify them all.

Good luck!

So the fuses are still broken, but I figured out why the fade-example did not work: Not a 'PWM-Pin'. That's exactly the problem with the Arduino 'abstraction layer': You're so detached from the actual hardware of the Atmega when you program. But still: my mistake :slight_smile: Anyway, I keep diggin into the fusebits.