
Now about the fuses and locks, what should I do at a minimum? I have started to read about this as I really want to understand how it all works

You can check the Atmega32u4 documentation, page 353, 28.1 and 28.2 for what the different fuse bits and lock bits are used for.
Code: Select all
EFUSE:1111 0011 = F3
^
This is HWBE pin, 0 means enabled (If HWB pin low, start bootloader)
HFUSE:1101 1 00 1 = DB
^^ ^
These are for boot size This is BOOTRST pin, 1 means disabled (Don't run bootloader on start)
00 - 4k
01 - 2k
10 - 1k
11 - 512
LFUSE:1111 1111 = FF
LOCK: 1110 1111
Quite the contrary, it was my first time using ISP (Hell, it was the first time I heard of ISP) and the Arduino as ISP does seem to work well based on the forums.DanielT wrote: You have more experience than I doAt this point I want to make sure that I'm using the right tools, because all the things I have tried led me to the same 0x000000 problem, and spending 14$ on a decent programmer is not that much considering that I'm trying to mod a quite expensive board
Code: Select all
dtraila@liz:~/Software/Teensy$ avrdude -p m32u4 -c usbasp -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex -P /dev/USBasp
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ATMega32U4-usbdevice_dfu-1_0_0.hex"
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against ATMega32U4-usbdevice_dfu-1_0_0.hex:
avrdude: load data flash data from input file ATMega32U4-usbdevice_dfu-1_0_0.hex:
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex auto detected as Intel Hex
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex contains 32768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: safemode: Fuses OK (E:C3, H:D8, L:DF)
avrdude done. Thank you.
Code: Select all
dtraila@liz:~/Software/Teensy$ avrdude -p m32u4 -c usbasp -U flash:w:ATMega32U4-usbdevice_dfu-1_0_0.hex -P /dev/USBasp
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ATMega32U4-usbdevice_dfu-1_0_0.hex"
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against ATMega32U4-usbdevice_dfu-1_0_0.hex:
avrdude: load data flash data from input file ATMega32U4-usbdevice_dfu-1_0_0.hex:
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex auto detected as Intel Hex
avrdude: input file ATMega32U4-usbdevice_dfu-1_0_0.hex contains 32768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: safemode: Fuses OK (E:C3, H:D8, L:DF)
avrdude done. Thank you.
Code: Select all
[ 5564.032173] usb 1-1: USB disconnect, device number 14
[ 5565.960092] usb 1-1: new full-speed USB device number 15 using uhci_hcd
[ 5566.141092] usb 1-1: New USB device found, idVendor=03eb, idProduct=2ff4
[ 5566.141095] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5566.141097] usb 1-1: Product: ATm32U4DFU
[ 5566.141099] usb 1-1: Manufacturer: ATMEL
[ 5566.141100] usb 1-1: SerialNumber: 1.0.0
Code: Select all
[ 596.236048] usb 1-1: new full-speed USB device number 7 using uhci_hcd
[ 596.421099] usb 1-1: New USB device found, idVendor=feed, idProduct=6060
[ 596.421102] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 596.421104] usb 1-1: Product: NerD
[ 596.421106] usb 1-1: Manufacturer: GON
[ 597.578507] input: GON NerD as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1:1.0/0003:FEED:6060.000C/input/input25
[ 597.578790] hid-generic 0003:FEED:6060.000C: input,hidraw0: USB HID v1.11 Keyboard [GON NerD] on usb-0000:00:1a.0-1/input0
[ 597.583386] input: GON NerD as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1:1.1/0003:FEED:6060.000D/input/input26
[ 597.583611] hid-generic 0003:FEED:6060.000D: input,hidraw1: USB HID v1.11 Mouse [GON NerD] on usb-0000:00:1a.0-1/input1
[ 597.589211] input: GON NerD as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1:1.2/0003:FEED:6060.000E/input/input27
[ 597.589408] hid-generic 0003:FEED:6060.000E: input,hidraw5: USB HID v1.11 Device [GON NerD] on usb-0000:00:1a.0-1/input2
[ 597.594226] hid-generic 0003:FEED:6060.000F: hiddev0,hidraw6: USB HID v1.11 Device [GON NerD] on usb-0000:00:1a.0-1/input3
So I have to read more about this part.Anyway I'm happy with the results so far. Flashing a new bootloader is really easy with UASasp and proper cables, it's a really good piece of hardware and when I bought it I chose the original product instead of a cheap clone because I think it's good to support such a cool project.When an ATMEL chip powers up or resets, it checks its fuses, and if they say that it should start with a bootloader (rather than normal firmware at the beginning of the flash), it starts executing the code near the end of the flash memory - where the bootloader should reside. Now the bootloader somehow determines whether it should jump back to the "application code" at the beginning of the flash, or whether it should continue running.