AVR ISP mkII bootloader being deleted on each programming run

I am currently taking the plunge of attempting to program the elusive 8MHz Arduino, a task which is apparently a difficult one, especially if you are using a slightly non-standard core. I am currently using the ATMEGA328P-PU.

The process goes like this:

  • Burn bootloader (using the boards.txt file found here: http://arduino.cc/en/Tutorial/ArduinoToBreadboard) -- SUCCESS
  • Program basic "blinky" program using FT232RL and AVRISP mkII onto chip at baud of 57600) -- SUCCESS
  • Try to program "blinky" program again -- FAILED, due to being out of sync.

A couple of my guesses were that it was somehow a problem with the clock that was ruining the com port. To check this, I included a "Serial.begin(57600)" and an event register that recognized when inputs were given, and that all worked correctly.

My guesses:

  • is it possible that the bootloader I am using (ATmegaBOOT_168_atmega328_pro_8MHz.hex) is not valid for the ATMEGA328P-PU I am using (I have also tried it with the ATMEGA328-PU using a bit of hacking and I couldn't get that to work either).
  • is it possible that the unlock bits/lock bits are incorrect (0x3F and 0x0F respectively)?
  • I'm not really sure what else could be causing this, although I am no micro-controller guru (done stuff with Microchip PICs before, but never delved into the workings of the Atmel Chips)

Thanks a bunch!

Error Message

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Documents and Settings\Berg_Garrett\Desktop\Work Software\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM11
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 57600
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: 
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

Usually when you can only use the bootloader once it means the Autoreset feature is not properly implemented. Try a manual reset when you see the "Binary sketch size:" message. If that works you need to fix your autoreset hardware.

That did the trick! Thanks a bunch :smiley:

I figured there must be something else going on, I have no "reset hardware" to speak of, I didn't know it was necessary. I followed the guide located here: Arduino - Home , except without the oscillator (basically as bare-bones as you can possibly get -- I'm not even using a capacitor [which I just corrected]!)

Anyway, everything seems to be running smoothly now. I'll just do the manual reset with each re-programming run for this bare bones version. Thanks a bunch!