Friday, June 1, 2018

5x5x9

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 git. 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 git.

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 LCSC.com and you can get free shipping when combined with a PCB order from JLCPCB.com.

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. http://docs.leaflabs.com/static.leaflabs.com/pub/leaflabs/maple-docs/0.0.12/bootloader.html

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.

I posted step by step flashing instructions here

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.