Wednesday, June 20, 2018

STM32 Flashing

Programming a Maple Mini

These are the steps to flash a Maple Mini with TMK for the 5x5x9 board.

First you will need the original Maple Mini bootloader. This file is in BIN binary format.

You will also need the compiled HEX file from TMK. A walkthough for compiling TMK with ChibiOS is here.

The STM32 Flasher Demo can be downloaded here. You will need to register to download.

A 3.3v USB to TTL Serial adapter. Often called a FTDI cable. It must have 3.3V i/o. Most have an option for either 5v or 3.3v. Install drivers for the USB serial adapter if necessary. It should show up in Windows Device Manager as a COM port.

This USB Serial adapter has a jumper to switch between 5v and 3.3v output.
You will need jumper wires to connect TX, RX, GND, and 3.3v.

The connections on the Maple Mini. On the 5x5x9 these are broken out to a header.

The BOOT1 pin needs to be connected to ground to run the Serial bootloader. On the 5x5x9 there is a switch that makes this connection.

To enter the serial bootloader you hold down both BUT1 and RESET. Then while continuing to hold BUT1 you release RESET. Then release BUT1. It will now be in Serial bootloader mode.

You can now run the STM32 Flasher (Demonstrator GUI).

 Pick the COM port of your USB Serial adapter.

If you pick the wrong COM port or the Maple Mini is not in Serial bootloader, or the TX/RX pins are reversed you will get this error. Try again. The program is buggy and you may have to quit the program if you get this error.

If it connects you will get this screen.

Do not change anything on the next screen.

Click on "Download to device". Click on the file selector.

Change the file type to BIN and select the Maple Mini Bootloader file.

 Click next to flash to bootloader.

It should take only a few seconds.

When complete click back.

Click the file selector again.

 This time select HEX files and open the compiled TMK hex file.

 Click next to flash the firmware file.

 Wait for it to finish.

Close when done.

You can skip flashing the bootloader the next time.

Monday, June 18, 2018

Gnapkin Plates

Forks and Spoons

Made some PCB plates for the Gnapkin.

Files on github.

Assembled with Kailh Burnt Orange switches. The top of the plate has as copper layer.

 Bottom plate is plain and also has a copper layer under the soldermask.

M2 spacers and screws hold the two plates together.

Access to the USB port on the Pro Micro.

I added blue LEDs under the switches.

These are actually 3mm round flanged LEDs. They fit snugly in the bottom of the switches. This would interfere with a click bar if the switch had one.

Dark Grey XDA blanks.

Next to a plateless Gnapkin.

Wednesday, June 13, 2018

TMK with ChibiOS

Setting up the build environment

I usually compile my firmware in Linux. I use either Ubuntu in a virtual machine or Raspbian on a Raspberry Pi. They are both Debian based and the same procedure should work on either.

Start with a fresh install of the OS.

Then update the list of software packages.

sudo apt-get update

Update all the installed packages.

sudo apt-get upgrade

Install the required packages for compiling TMK and ChibiOS

sudo apt-get install gcc-avr avr-libc dfu-programmer git make gcc-arm-none-eabi

Clone the TMK repository

git clone

Change to the chibios folder

cd tmk_keyboard/tmk_core/tool/chibios/

Clone the stable branch of ChibiOS repo

git clone -b stable_17.6.x

Clone the ChibiOS-Contrib repo

git clone

That's it. You should be able to compile for TeensyLC, Teensy3.2, Maple Mini, etc...

This video goes through the process on Ubuntu 18.04 LTS server.

Monday, June 11, 2018

Praetorian Gherkin

Dark and silent

Red Gherkin plates and black PCB. Cherry silent black switches.
Black nylon M2 spacers. Oxide black screws.
Cheap translucent blank red ABS keycaps from eBay.
Funko Pop bobble head.

Wednesday, June 6, 2018

Dressing up cheap M2 spacers

M3 nylon spacers fit over M2 spacers

Non-threaded M3 nylon spacers have a 3.2 mm inner diameter (ID) that fits over the cheap brass M2 threaded spacers. They come in two outer diameters (OD), 5mm and 7mm. The 7mm ones are most common but are probably too large for most uses. The 5mm OD ones are perfect for hiding the skinny brass spacers.

They are sold on eBay and Aliexpress. They come in all the same lengths as the brass spacers. Amazon has some but they are in kits of mixed sizes, many too short or too long to be useful.

Since they are made of nylon they should dye very well.

These are much sturdier than regular all nylon threaded spacers, when combined with a brass spacer. You can tighten them much more as the brass spacer's threads won't easily strip.

5mm OD M3 nylon spacer next to a M2 threaded brass spacer.

M3 spacer on top of the M2 spacer. It fits well but is not snug. It will fall off if you flip the board over while assembling.

Installed and screwed in place. The raw nylon is translucent. Could dye them black or some other dark color. I have seen ones that are white nylon (more opaque) and some in black nylon.

8mm long 5mm OD spacers on a Dilly with plates.

Monday, June 4, 2018


The Golbat 40% Keyboard

I purchased this as a kit from a GB from several years ago. Blue anodized top and bottom plate with light blue clear laser cut acrylic middle pieces.

It was shipped with the case pieces assembled but the screws all worked themselves loose and scratched up everything. Several deep scratches on the top and bottom plates.

I decided to experiment with it. I sanded down the pieces and it blended in the scratches to be less noticeable. I also sanded down the two acrylic pieces so they would be flush together.

Switches are Zealios, with blue 2x3x4mm LEDs mounted inside the switches.

The keycaps are PBT Gaterons from another group buy.

The controller is a Kimera Core. It is an ATmega32U4 with two io expanders. Somewhat pointless to use this in a board with so few columns/rows. It adds complexity to the design and many people have problems figuring out how to program it.

Friday, June 1, 2018


Maple Mini powered modular 5x5 keypad

Up to 9 of the 5x5x9 boards can be connected together to create a 15x15 matrix with 225 key positions.

The board is constructed in a similar way to the 5x5 board, except it also has connections vertically, allowing for three rows of boards, three columns wide. Each individual board is 95.25mm square.

A Maple Mini clone was used as the controller. It has 34 IO pins. 2 of these pins are actually the USB port data pins. So if you want USB there are only 32 pins left. One of these pins is connected to an LED on the top of the Maple Mini, and has no physical pin to solder to. This leaves 31 actual usable pins. This is enough for the 15x15 grid. The onboard LED is used as a capslock indicator.

Maple Mini clones can be found on eBay or Aliexpress for around $4. As cheap as a Pro Micro clone. You will probably find 2 different boards being called Maple Mini, you want the one that looks like the one pictured. The other board has a similar chip but has a different pinout and less flash memory. It is often called the "Blue Pill". You do not want the Blue Pill, although it works with TMK it will not work on this board.

The chip on the Maple Mini is supported in TMK using the Chibios library. Be sure to clone a stable branch of the library. The firmware is on github. The keymap is the same as I use on my i75, repeated 3 times.

The assembled 225 key board. A PCB top plate has been used. The Gerber files are on github.

The bottom of the assembled board. The routing of the board edges is not perfect and they do not align perfectly. Getting the 9 PCBs aligned and soldered as straight as possible was very time consuming. You need a large flat workspace.

The Maple Mini clone and the BUT1 and RESET buttons on the right. The Serial programming header and the BOOT1 switch on the left. I chose these switches because they are available from and you can get free shipping when combined with a PCB order from

To boot into the serial bootloader BOOT1 has to be held low. The switch connects it to ground. In normal use the switch in the other position disconnects it from ground and that pin is used as a part of the switch matrix.

The BUT1 and RESET switches have the same function as the switches on the top of the Maple Mini. I added them to make it easier to enter the bootloader with the board mounted to a plate.

To enter the bootloader:
  1. Disconnect the Maple Mini from USB
  2. Connect a 3.3v TTL serial adapter to the serial header. It must be 3.3v and not 5v. The Maple Mini will be powered through the Serial adapter.
  3. Switch BOOT1 switch to programming position, (to the left in this picture).
  4. Press both RESET and BUT1, you can use the buttons on the Maple Mini or the ones on the board.
  5. While continuing to hold BUT1, release RESET.
  6. Release BUT1
  7. It should now be in serial bootloader. 
To program it I used the utility from STMicro. Flasher-STM32. You will need to register to download it. The program is very simple and you only need to choose the serial port of your serial adapter. The defaults for all other options are fine. The Maple Mini must be in serial bootloader mode before trying to connect. If it errors it is either the wrong serial port or the TX/RX pins are swapped when you connected to the header on the board. (If BOOT1 switch is in the wrong position it will also error. It goes into some other boot mode.)

I am not sure what USB bootloader came installed on the Maple Mini clone. To get anything to work properly I flashed the original Maple Mini Bootloader from here.

Scroll to the Setup section Step 1 and download the Maple Mini bootloader.

I flashed the bootloader and then the compiled firmware, no need to reset in between. You will have to change the file type to BIN for the bootloader and then to HEX for the compiled TMK firmware.

I was hoping to omit the USB bootloader since it takes up flash space (the serial bootloader is hard coded and permanent). But the firmware would not run without the bootloader. It should be possible, I have not spent the time to figure out what needs to be changed in the firmware code to make it work that way.

Be sure to return BOOT1 switch to the normal position before plugging in the Maple Mini USB. Otherwise you will have stuck key presses.

There are multiple ways to flash from the command line using many different methods. I have not tried any of these. The Flash-STM32 download also comes with the source code if you want to develop your own method of flashing.

This was the first version of the board. The BUT1 button was incorrectly connected, Otherwise it works fine. You can see all the solder bridges that hold the boards together and connect the matrix circuits.

The base is a simple 12x12" 5052 aluminum plate with holes drilled for the M2 spacers. It is slightly oversize as the assembled board itself is 11.25" square.

Some of the theoretically possible ways the boards can be connected together and the matrix still work. The Maple Mini has to be in the top left position in all cases.

Monday, May 28, 2018

U2F One Key

MX U2F authenticator

My attempt to build a U2F key based on the design and firmware of the U2F Zero.

It mostly works, but I did not add a debug header so can only program it via the factory USB bootloader, which limits the size of the firmware. I can only load a stripped down version of the firmware.

The basic circuit is the same as the U2F. The microcontroller needs very few external parts to work.

I used 3 separate LEDs instead of the single RGB LED on the U2F Zero. The MX switch footpad allows the board to be flipped and the switch mounted on either side. I can have the ICs exposed on top or hidden under the board.

These PCB's were produced at This was during their $5 promotion. The promotion has since ended, but for small orders they have the cheapest DHL shipping.

Thursday, May 24, 2018

Micro Strong

Another ATmega32U4 breakout board

You can find these on eBay and Aliexpress for quite cheap. Search for "ATmega32u4 board". This seems to be the same circuitry as an Arduino Micro, but not having the schematic, this is only a guess.

The ones I ordered came with the headers loose in the bag. I was not planning to use them. (There are a few extra 12 pin headers from a Pro Micro in the picture)

The board is a square, 4cm on a side. The Micro USB connector is the stronger type that has legs that go through the PCB. There are 3mm diameter mount holes in each corner (34mm centers).

These would be a good choice for a hand wired board. Lots of power and ground connectors and built in mount points.

The bottom is mostly flat. There is a solder bridge jumper to select the voltage. I have seen 8MHz versions for sale. I assume those are jumpered for 3.3v.

The website printed on the back loads a broken Chinese webpage.

24 of the ATmega32U4 pins are easily accessible (just like on an Arduino Micro). Some are connected to LEDs (C7, B0). Pins D5 and E2 can be accessed on the large ATmega32U4. D5 should be usable as an output. E2 is connected to ground through a 10k resistor so should also be usable as an output.

Monday, May 21, 2018


GNAP! Gherkin hybrid

It's the top three rows of the GNAP! constructed like a Gherkin.

It has a regular PWM backlight like the Gherkin does, powered by a MOSFET connected to pin B5.

Still working on a keymap. I have a basic one for testing on github.

Gerber files on github.

Assembled with cheap typewriter style keycaps.

Bottom is a second PCB, just like on the Gherkin.

Top and bottom PCBs are connected with M2 spacers and screws.

The Pro Micro sticks out the side.

Top of a fully populated PCB. 1n4148 diodes and resistors for the backlight.

Bottom of PCB. You can see the MOSFET and the reset switch. A socket makes the Pro Micro removable. All of the parts used are the same as on the Gherkin, there are just 6 more of them for the 6 additional switches.

The 2 unused pins are broken out to pads along with GND and VCC.

Backlight on. It has a single dimmable backlight, It does not have the per key backlighting of the GNAP!.