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.