Tuesday, August 30, 2016

POS Planck

POS Planck

  • $10 OLKB Planck Rev 2 PCB
  • Gateron Black switches
  • 3mm flanged white LEDs
  • Nylon standoffs
  • 1.5mm acrylic plates
  • PMK grab bag POS DSA keycaps
Another Planck built off the $10 Planck Rev 2 PCB.

I had these plates made a while ago but didn't have a PCB for them until now.

The clear acrylic was sanded with a scotchbrite pad to frost it and smooth the sharp laser cut edges.




Monday, August 29, 2016

$10 Planck

Minimalist Planck

  • $10 OLKB Planck Rev 2 PCB
  • Gateron Brown switches
  • 2x3x4mm warm white LEDs installed inside the switches.
  • Cherry PCB mount 2u stabilizer
  • Brass standoffs
  • 2mm acrylic base
  • PMK grab bag DSA keycaps
Purchased some of the $10 Rev 2 Planck PCB's from OLKB.com. This is a plateless Planck with a simple acrylic bottom.




Sunday, August 14, 2016

Tiny Whale

The MinOrca

  • 40% handwired keyboard
  • Steel top plate 1.5mm
  • Formed metal bottom
  • Teensy 2.0
  • QMK firmware
  • Gateron blue switches
  • G20 keycaps
  • WS2812b LEDs 
Minorca kit purchased from Switchtop. The kit contained all the parts needed. Plate, bottom, screws, nuts, diodes, Teensy 2.0, stabilizers, wire. I had my own switches and keycaps. I also used my own wire, 30awg wirewrap wire.

I tried to follow the same wiring pattern and pinout that was used in the instructions, but they were inconsistent with the firmware samples provided. So I wired it the way I usually wire a 40%.

The formed metal bottom is made of a thinner sheet metal than the plate. About 1mm thick. It is still very sturdy. It is also much lower profile than the Planck formed bottom. The Teensy just barely fits.

The screws and nuts are tiny, and there are no spares provided.They are socket head so you will need a set of hex keys to tighten them.

Link to firmware https://github.com/di0ib/qmk_firmware/tree/master/keyboards/handwired/minorca RGB specific settings are in the rgb keymap.






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://git.40percent.club/di0ib/bootloaders/src/branch/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

Friday, August 5, 2016

Planck PCB MassStorage Bootloader

LUFA Mass Storage Bootloader for Planck PCB

This is a modified LUFA MassStorage Bootloader for the Planck PCB. It should work on any version of the Planck PCB. This will allow you to flash your PCB by copying the firmware file to a virtual USB drive.

For details of how this works and how to flash it see http://www.40percent.club/2016/08/self-flashing-planck.html Ignore the section on modifying QMK, no changes are necessary to use this bootloader.

You will need to reload your firmware after flashing the bootloader.

This bootloader does not require any key to be held down. Pressing the Reset button on the bottom of the PCB or using the RESET command in your keymap will immediately launch the bootloader in MassStorage mode.

This version bootloader will not work correctly on a Arduino Pro Micro.

Hooking up the PCB to the Arduino as ISP

Instructions on using an Arduino as an ISP programmer
https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader

The RESET pin B1 (SCLK), B2 (MOSI), B3 (MISO), GND and VCC pins are clearly labeled on the PCB.

Flash the bootloader

You do this at your own risk. It is entirely possible to brick your PCB if you set the fuses incorrectly. 

Precompiled bootloader: https://git.40percent.club/di0ib/bootloaders/src/branch/master/BootloaderMassPlanck.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:0x5e:m -U hfuse:w:0x99:m -U efuse:w:0xf3:m -v
avrdude -p m32u4 -c avrisp -P comXXX -b 19200 -B 4 -U flash:w:"BootloaderMassPlanck.hex" -v
There will be an error when running the second command. This is normal. Select no when it asks.

Thursday, August 4, 2016

Planck STM32F103C8T6

Planck keyboard powered by STM32F103C8T6 

Purchased several of these boards on eBay. They are as cheap as the Pro Micro clones and have just as bad build quality. There are two styles of the boards, with two different USB connectors. The one that looks more secure with 4 mounting points and the one pictured below with just two solder tabs. What you gets is random. I purchased from two different sellers and got the opposite version of what they each pictured in their auctions. I have tried 3 of the 7 I purchased. 1 was DOA with a solder bridge on the USB data lines.
Matrix scanning speed is about as fast as the ARM based Teensy's. 10000 scan cycles per second. This is with the default 30us delay. It can probably go even faster.

These require a 3.3v TTL serial adapter to program them. You can also get these for a few dollars on eBay.

I soldered the serial port pins and the boot jumper/reset pins to a piece of SIP header so they can be accessed when the keyboard is assembled.

The major downside of these boards are the size and the height of the components. The jumper headers are the tallest parts but can be removed. There are also components on the bottom of the board so it does not lay flat.




Tuesday, August 2, 2016

Self Flashing Planck

Handwired Planck with Arduino Pro Micro loaded with LUFA MassStorage bootloader

How does this work?

Holding down LOWER while plugging in the USB cable will launch the bootloader in Mass Storage mode.

While in Mass Storage mode the Atmega32u4 will appear as a drive to the computer. It will show two files: EEPROM.bin and FLASH.bin. Replacing either of these with an appropriate hex file converted to a .bin file will write the file to flash memory. Delete the existing file before copying the new one. Unmount the drive and unplug and reconnect it without pressing LOWER and the new firmware will run instead of the bootloader.

While the keyboard is functioning holding LOWER + RAISE + Q will launch the bootloader. You must continue to hold LOWER until the bootloader goes into Mass Storage mode. This is assuming you have the default keymap. If not, it will be wherever the RESET code is in your keymap.

LOWER is the key in the bottom row 5th column from the left. The bottom row is connected to C6, the 5th column is connected to B6

By holding down LOWER you are making the equivalent of this connection, through the keyboard matrix.

How do you do this?

Handwire your Planck

Wire up your Planck like this. If you do it some other way you will need to adjust the pins the bootloader uses to trigger Mass Storage mode.

Compile your Planck firmware

You need a working build environment to compile QMK. QMK documentation is here.

Modify the Planck files for the handwired matrix.

qmk_firmware/keyboards/planck/config.h changes:
#define MATRIX_ROW_PINS { D1, D0, D4, C6 }
#define MATRIX_COL_PINS { D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 }
#define CATERINA_BOOTLOADER


qmk_firmware/keyboards/planck/Makefile. Size must be 4096
# Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096


Compile your firmware and then convert the .hex file to .bin with the following command:
objcopy -Iihex -Obinary thenameofthecompiledfile.hex FLASH.bin

You will end up with a smaller FLASH.bin file. This is the file you will copy to the mass storage drive.

Compile the LUFA MassStorage Bootloader

Required reading:
http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/
http://fourwalledcubicle.com/blog/2013/03/magic/
http://fourwalledcubicle.com/LUFA.php

Get the latest LUFA source code:
http://www.github.com/abcminiuser/lufa/archive/LUFA-151115.zip

Make these changes before compiling:

lufa-LUFA-151115/Bootloaders/MassStorage/makefile changes
MCU          = atmega32u4
ARCH         = AVR8
BOARD        = LEONARDO
F_CPU        = 16000000

FLASH_SIZE_KB         = 32
BOOT_SECTION_SIZE_KB  = 4

lufa-LUFA-151115/Bootloaders/MassStorage/BootloaderMassStorage.c changes
    #if (BOARD == BOARD_LEONARDO)
        /* Enable pull-up on the IO13 pin so we can use it to select the mode */
        PORTB |= (1 << 6); //Set pin B6 as input with internal pullup
        DDRC  |= (1 << 6); //Set pin C6 as low (equivalent of ground)
        PORTC &= ~(1 << 6);
        Delay_MS(10);

        /* If IO13 is not jumpered to ground, start the user application instead */
        JumpToApplication = ((PINB & (1 << 6)) != 0);

        /* Disable pull-up after the check has completed */
        PORTB &= ~(1 << 6);

Compile the bootloader. You will end up with BootloaderMassStorage.hex

Flashing bootloader using Arduino as ISP

Instructions on using an Arduino as an ISP programmer
https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader

The pins to connect to on the Pro Micro:

Pro Micro connected to a Arduino Duemilanove clone.

Commands to write bootloader using Arduino as ISP. Replace comXXX with the correct COM port
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:"BootloaderMassStorage.hex" -v

The first time the Pro Micro with the new bootloader is plugged in it will go into Mass Storage mode since flashing the bootloader erased the rest of the flash. You can now copy the FLASH.bin file onto the drive.

Should you do this?

Probably only worth the effort if you were going to give this keyboard to someone else who does not have the skills or resources to compile firmware themselves. You would be able to compile new firmware for them and email it to them. They would need no additional software to flash it.

This bootloader does occupy 6KB of flash space. This is 2KB more than the original bootloader. This leaves 26KB free for the firmware. QMK with default keymap is ~25KB. Depending on the features you use in your keymap you may need the 2KB.

An alternative to this is the LUFA DFU bootloader. It only takes up 4KB. It does require a DFU compatible utility like Atmel FLIP. You would make the same changes to:
lufa-LUFA-151115/Bootloaders/DFU/makefile
lufa-LUFA-151115/Bootloaders/DFU/BootloaderDFU.c