Loading Bootloader in new ATMEGA168

Just purchased a AVRISP mkII and a couple of ATMEGA168's. I have been using the Arduino Diecimila for a while without any problems. I changed the chip on the Diecimila board and programmed the new 168 with ATmega_BOOT_168_Diecimila.hex. I set the fuse to: Extended = 0xF8 High = 0xDD Low = 0xFF I also set the lock bits to 0xCF.

After programming the chip I am unable to upload a sketch to the Diecimila board. I get the following error:

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

I was able to get around the problem by putting the original chip back in the diecimila, uploaded the Blink sketch, read the flash using AVR Studio, put the new chip back in the diecimila, programmed the chip with the same fuse and lockbit settings from above, but used the hex file I read from the original chip. Now I am able to upload new sketches without any problems.

Is there a problem with the boot loader hex file or am I missing something?

P.S. OS = winxp Arduino - 0015

Since you have a AVRISP mkII, why don't you just burn the bootloader from inside the IDE? That's what I do and it works just fine (I have the same programmer).

etracer,

Actually I did try to load the boot loader from the Arduino IDE. I get the error message shown below: "avrdude: usbdev_open(): did not find any USB device "usb"" After a little more research, I found that the Jungo drivers for the AVRISP mkII that are installed with AVR Studio 4 will not work with the Arduino IDE. I uninstalled the Jungo drivers and used the driver found under "\WinAVR-20090313\utils\libusb\bin" for the AVRISP2. I can now burn the boot loader through the Arduino IDE, but the AVRISP will not work with AVR Studio.

I still don't understand why I can't upload sketches after burning the boot loader with AVR Studio.

I still don't understand why I can't upload sketches after burning the boot loader with AVR Studio.

My guess would be that the lock bits weren't set properly.

I think it`s the fuse settings you have wrong .

AND NO , with a avr mrk 2 you can`t use the ide . I remember it been a driver problem or something.

I use the avr Mk 2 for programming my chips without problems. But I think avrdube says unused bits in the fuses are 1s and avr studio say there are 0s , so don`t pull the fuse setting from the ide. Use a on-line fuse program and workout what each fuse setting means.

AND NO , with a avr mrk 2 you can`t use the ide . I remember it been a driver problem or something.

This is not correct. I use an AVRISP mkII to burn the bootloader from the IDE all the time.

peter247, and etracer - Thanks for the help.

I found a post on avrfreaks about this problem. There is a bug in AVR Studio 4.16 that prevents the boot loader flash from being programmed. There is a hot fix for this problem - see link below.

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=75568&start=0&postdays=0&postorder=asc&highlight=

After in running the hot fix I was able to load the boot loader and then send a sketch to the Diecimila board with a problem.