Atmega32u4 bootloader factory programming

Hi,

I ordered several Atmega32u4 from China. They promised to program the chips before shipping and asked the HEX file for that.

I provided them with the Leonardo-prod-firmware-2012-04-26.hex Leonardo bootloader. They told me that HEX file is OK and the chips are programmed.

Yesterday I received the controllers. But seems bootloader is not programmed correctly.

The Arduino software doesn't recognize the device.

Today I'll try to update the bootloader by my Arduino to see if these chips are alive or no.

In the meanwhile I have a several questions.

  1. The provided hex file is enough or I need to provide more information?
  2. Does hex file contain the fuse information?

Any suggestion please?

Thank you very much.

No, no fuses in the hex file.

If you use a programmer then you should burn the bootloader from within the Arduino IDE. That sets also the fuses. The settings are in the file "boards.txt".

Here are a few of the settings for the Leonardo. The hex file is not the same file that you have used:

leonardo.name=Arduino Leonardo
leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb
leonardo.bootloader.file=caterina/Caterina-Leonardo.hex
leonardo.bootloader.unlock_bits=0x3F
leonardo.bootloader.lock_bits=0x2F
leonardo.build.mcu=atmega32u4
leonardo.build.f_cpu=16000000L

But no worries, you should get a programmer anyway. Can you get to the MISO, MOSI and other pins to program it ? I use a USBasp version 2, but others use an Arduino Uno as ISP.

Thank you very much for quick response.

I need to explain them in details what to do. Is there any step by step instructions ho to program bootloader?

For example:

  1. Set fuses.
  2. Load the hex file.
  3. Set locks ..... ..... .....

I’m not sure. I would guess: unlock - fuses - hex - lock
Could you program a Leonardo from the Arduino IDE and enable the extra information ?
Hold on… let me grab my Arduino Leonardo.
Here we go:

Arduino 1.6.5 in linux.
Extra compile and upload information enabled.
Official Arduino Leonardo board.
Using USBasp version 2.0.

I think the two calls to avrdude are what is executed, the rest is status information returned by avrdude.
As you can see the first one sets the unlock to the lock bits and all three fuses. The second one flashed the hex file and set the lock bits.
That makes sense.

I could not upload all the commands and status information (too big for a post). So I have isolated the two commands.

/home/<user>/MyPrograms/Linux/arduino-1.6.5/hardware/tools/avr/bin/avrdude -C/home/<user>/MyPrograms/Linux/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cusbasp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m 

/home/<user>/MyPrograms/Linux/arduino-1.6.5/hardware/tools/avr/bin/avrdude -C/home/<user>/MyPrograms/Linux/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cusbasp -Pusb -Uflash:w:/home/<user>/MyPrograms/Linux/arduino-1.6.5/hardware/arduino/avr/bootloaders/caterina/Caterina-Leonardo.hex:i -Ulock:w:0x2F:m