ATmega32U4 bootloader for internal oscillator

I've seen this topic come up a couple times on this forum, but have not seen it answered completely.

I am creating a homemade board using the ATmega32u4 and the internal oscillator at 8MHz. Of all the bootloaders out there for the 32U4, they are created for an external oscillator and thus have different fuses set.

I am looking for a hex file & boards.txt which support the internal oscillator.

I am also looking for support on creating this hex myself. I have used the makefile for 'caterina-LilyPadUSB'. I have had to download LUFA-111009 to use in the make process. However, I am not dependant on USB, it does not need to be supported for this project.

I have also used AVR® Fuse Calculator – The Engbedded Blog to help define the fuses. The modifications to the makefile were:

AVRDUDE_WRITE_FUSES = -U efuse:w:0xff:m           #ORIGINAL 0xce:m 
AVRDUDE_WRITE_FUSES += -U hfuse:w:0xd8:m       #ORIGINAL 0xd8:m 
AVRDUDE_WRITE_FUSES += -U lfuse:w:0xc2:m        #ORIGINAL 0xff:m

And I have created my own entry for boards.txt to support this.

caterina.name=Caterina Fraser
caterina.upload.protocol=avr109
caterina.upload.maximum_size=28672
caterina.upload.speed=9600
caterina.upload.disable_flushing=true
caterina.bootloader.low_fuses=0xc2
caterina.bootloader.high_fuses=0xd8
caterina.bootloader.extended_fuses=0xff
caterina.bootloader.path=caterina
caterina.bootloader.file=Caterina.hex
caterina.bootloader.unlock_bits=0x3F
caterina.bootloader.lock_bits=0x2F
caterina.bootloader.tool=arduino:avrdude
caterina.build.mcu=atmega32u4
caterina.build.f_cpu=8000000L
caterina.build.vid=0x1B4F
caterina.build.pid=0x9207
caterina.build.core=arduino
caterina.build.variant=leonardo

However, the error which I get when trying to burn the bootloader (through a Arduino Nano) is:

avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1

Makefile.txt (21.6 KB)

boards.txt (630 Bytes)

The changes to the makefile don't matter I don't think - since you're using burn bootloader from the arduino IDE to upload it. The .hex file does not contain any information on the fuses.

The error you've received, I'm pretty sure, is because you've wired up the programmer wrong, or haven't uploaded ArduinoAsISP to the nano you're using as programmer, or have uploaded it but not put to cap in to disable reset, or have the wrong programmer selected, or something like that... (as an aside, why the hell do so many people insist on using ArduinoAsISP when USBAsps which work much more reliably are $2 each on ebay counting shipping?)

Is the internal oscillator in the 32u4 good enough to do USB without an external crystal? I didn't think it was... ("crystal-less usb" is quite uncommon - USB requires fairly precise clock) Why are you uploading a USB bootloader to a non-USB board?