Tuesday, August 9, 2016

Atreus Mass Storage Bootloader

LUFA MassStorage Bootloader for Atreus A-Star Micro

This is a modified LUFA bootloader for the Atreus with the A-Star Micro controller. With this installed you can start the bootloader by holding the key in the bottom right corner of the keyboard while plugging the board in. While in bootloader mode pressing the key in the bottom left corner will exit the bootloader.

While the keyboard is running you can run the bootloader by pressing the key assigned to the RESET command. You need also to be holding down the bottom right key during the bootloader startup, otherwise it will go right back to running the keyboard code. Easiest to assign the RESET command to use the bottom right key, so you just hold it down until it restarts in Mass Storage mode.

While in bootloader it will appear as a USB drive. You can flash the board by replacing the FLASH.bin file on the virtual drive.

For details of how this works and how to flash it see http://www.40percent.club/2016/08/self-flashing-planck.html

Modifications to the Makefile are the same as for the Pro Micro. The modified BootloaderMassStorage.c  is here. https://gist.github.com/di0ib/4714e30cd8297f890e8cd7aeb041b553

QMK firmware has been updated so that it will generate bin files for you.
make flashbin
Will convert the .hex to a .bin

Hooking up the A-Star Micro to the Arduino as ISP

Instructions on using an Arduino as an ISP programmer
https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader
Pinout of the A-Star Micro

Flash the bootloader

Precompiled bootloader: https://github.com/di0ib/bootloaders/blob/master/BootloaderMassAtreus.hex

Commands to flash using Arduino as ISP:
avrdude -p m32u4 -c avrisp -P comXXX -b 19200 -e -v
avrdude -p m32u4 -c avrisp -P comXXX -b 19200 -U  lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xc9:m -v
avrdude -p m32u4 -c avrisp -P comXXX -b 19200 -B 4 -U flash:w:"BootloaderMassAtreus.hex" -v