How the `Prog` key gets you into the Bootloader

While there are potential security implications (related to malicious reprogramming) to using the Prog key as part of your layout, all of the bootloader-related functionality tied to the Prog key are in the Bootloader code, rather than the user program, so it should be impossible to brick your keyboard by assigning the Prog key to something.

…sorta. What’s going on behind the scenes is this:

The “regular arduino” way to reset a device like the Model 01 into ‘bootloader’ (reprogramming) mode is for the computer to open up the keyboard’s virtual serial port (COM port on windows) at 1200 baud and immediately close it. This causes the keyboard to reboot.

When the keyboard reboots, it first jumps into the bootloader.

We’ve wired up a couple of pins on the main microcontroller (The ATMega32u4) to be able to detect keypresses on the Prog key.

It would be possible for malicious firmware on the keyscanner chips to fake out the main microcontroller, so the first thing the bootloader does is to turn off the keyscanner chips, That way, they can’t fake it out when it checks to see if you actually want to reprogram the keyboard.

Then, the main microcontroller looks to see if Prog is held down. If it is, the bootloader knows that you want to reprogram the keyboard. Then it lights up the red led under the Prog key and waits for further instructions.

2 Likes