tmk / HHKB_controller

Keyboard Controller Board for HHKB pro2 - KiCad project
Other
251 stars 41 forks source link

LUFA DFU Bootloader for HHKB controller(or Teensy) #18

Closed tmk closed 9 years ago

tmk commented 10 years ago

I lost Atmel genuine bootloader for some reason during fiddling with ICSP with avrdude :) I don't know why for sure, I was just trying to read lock/fuse bits... but I must have been dumb.

So without bootloader I can't program it with USB line and very unusable. Atmel genuine bootloader for ATmega32U4 is not avaiable I had to build LUFA DFU bootloader and program it with AVRISPmkII via ICSP.

LUFA DFU bootloader is completely compatible for Atmel's, it rocks!

build

$ Bootloaders/DFU
$ edit makefile
$ make
$ sudo avrdude -p m32u4 -c avrispmkII  -Pusb -U flash:w:BootloaderDFU.hex

makefile for ATmega32U4(HHKB controller/Teensy)

--- makefile    2013-12-28 19:34:57.000000000 +0900
+++ makefile.atmega32u4 2013-12-30 13:34:03.000000000 +0900
@@ -11,10 +11,10 @@

 # Run "make help" for target help.

-MCU          = at90usb1287
+MCU          = atmega32u4
 ARCH         = AVR8
-BOARD        = USBKEY
-F_CPU        = 8000000
+BOARD        = TEENSY2
+F_CPU        = 16000000
 F_USB        = $(F_CPU)
 OPTIMIZATION = s
 TARGET       = BootloaderDFU
@@ -26,8 +26,8 @@
 # Flash size and bootloader section sizes of the target, in KB. These must
 # match the target's total FLASH size and the bootloader size set in the
 # device's fuses.
-FLASH_SIZE_KB         = 128
-BOOT_SECTION_SIZE_KB  = 8
+FLASH_SIZE_KB         = 32
+BOOT_SECTION_SIZE_KB  = 4

 # Bootloader address calculation formulas
 # Do not modify these macros, but rather modify the dependent values above.
tmk commented 9 years ago

You can download binary of Atmel USB DFU bootloader here. No source codes are supplied. http://www.atmel.com/devices/ATMEGA32U4.aspx http://www.atmel.com/Images/megaUSB_DFU_Bootloaders.zip

While ATXmega seems to have source codes for its bootloader. http://www.atmel.com/Images/doc8429.pdf http://www.atmel.com/Images/AVR1916.zip