Skip to content

Instantly share code, notes, and snippets.

@saesh
Last active February 6, 2021 17:21
Show Gist options
  • Select an option

  • Save saesh/384ac3940f2eaffcdce9f33229f19508 to your computer and use it in GitHub Desktop.

Select an option

Save saesh/384ac3940f2eaffcdce9f33229f19508 to your computer and use it in GitHub Desktop.

These instructions are for building and flashing the default QMK firmware for BDN9 rev 1 with a Proton C on Linux Mint 19.

TL;DR

Detailed guide

Install QMK as described in the QMK docs and install git submodules:

make git-submodule

Connect via USB-C and press button on the front, the device should be visible with dmesg:

[12862.275613] usb 3-3: new full-speed USB device number 7 using xhci_hcd
[12862.424651] usb 3-3: New USB device found, idVendor=0483, idProduct=df11
[12862.424656] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12862.424658] usb 3-3: Product: STM32  BOOTLOADER
[12862.424660] usb 3-3: Manufacturer: STMicroelectronics
[12862.424662] usb 3-3: SerialNumber: xxxxxxxxxxx

Due to a bug in newlib making the default firmware fails:

Linking: .build/keebio_bdn9_default_proton_c.elf                                                    [ERRORS]
| 
| /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
| /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
| collect2: error: ld returned 1 exit status
| 
tmk_core/rules.mk:290: recipe for target '.build/keebio_bdn9_default_proton_c.elf' failed
make[1]: *** [.build/keebio_bdn9_default_proton_c.elf] Error 1
Make finished with errors
Makefile:535: recipe for target 'keebio/bdn9:default' failed
make: *** [keebio/bdn9:default:dfu-util] Error 1

To resolve this install the latest version of libnewlib-arm-none-eabi and libnewlib-dev:

sudo dpkg -i libnewlib-arm-none-eabi_3.0.0.20180802-2_all.deb libnewlib-dev_3.0.0.20180802-2_all.deb

Append CTPS = yes to the make command or add it to the rules.mk file when making the firmware, this is due to the Proton C using STM32 ARM chip:

make keebio/bdn9:default CTPC=yes
QMK Firmware 0.6.321
Making keebio/bdn9 with keymap default

arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiling: tmk_core/common/command.c                                                                [OK]
Linking: .build/keebio_bdn9_default_proton_c.elf                                                    [OK]
Creating binary load file for flashing: .build/keebio_bdn9_default_proton_c.bin                     [OK]
Creating load file for flashing: .build/keebio_bdn9_default_proton_c.hex                            [OK]

Size after:
   text	   data	    bss	    dec	    hex	filename
      0	  44496	      0	  44496	   add0	.build/keebio_bdn9_default_proton_c.hex

Copying keebio_bdn9_default_proton_c.bin to qmk_firmware folder                                     [OK]
(Firmware size check does not yet support cortex-m4 microprocessors; skipping.)

Flash to the Proton-C with the dfu-util target:

make keebio/bdn9:default:dfu-util CTPC=yes
QMK Firmware 0.6.321
Making keebio/bdn9 with keymap default and target dfu-util

arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Size before:
   text	   data	    bss	    dec	    hex	filename
      0	  44496	      0	  44496	   add0	.build/keebio_bdn9_default_proton_c.hex

Compiling: tmk_core/common/command.c                                                                [OK]
Linking: .build/keebio_bdn9_default_proton_c.elf                                                    [OK]
Creating binary load file for flashing: .build/keebio_bdn9_default_proton_c.bin                     [OK]
Creating load file for flashing: .build/keebio_bdn9_default_proton_c.hex                            [OK]

Size after:
   text	   data	    bss	    dec	    hex	filename
      0	  44496	      0	  44496	   add0	.build/keebio_bdn9_default_proton_c.hex

Copying keebio_bdn9_default_proton_c.bin to qmk_firmware folder                                     [OK]
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 44500
Download	[=========================] 100%        44500 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

After flashing the device is not usable:

[15494.135626] usb 3-3: new full-speed USB device number 13 using xhci_hcd
[15494.263629] usb 3-3: device descriptor read/64, error -71
[15494.499607] usb 3-3: device descriptor read/64, error -71
[15494.735617] usb 3-3: new full-speed USB device number 14 using xhci_hcd
[15494.863633] usb 3-3: device descriptor read/64, error -71
[15495.099631] usb 3-3: device descriptor read/64, error -71
[15495.207649] usb usb3-port3: attempt power cycle
[15495.863611] usb 3-3: new full-speed USB device number 15 using xhci_hcd
[15495.863764] usb 3-3: Device not responding to setup address.
[15496.071772] usb 3-3: Device not responding to setup address.
[15496.279622] usb 3-3: device not accepting address 15, error -71
[15496.407621] usb 3-3: new full-speed USB device number 16 using xhci_hcd
[15496.407800] usb 3-3: Device not responding to setup address.
[15496.615761] usb 3-3: Device not responding to setup address.
[15496.823616] usb 3-3: device not accepting address 16, error -71
[15496.823687] usb usb3-port3: unable to enumerate USB device

This is because in the config.h NO_PIN is used for MATRIX_ROW_PINS. If changed to B6 (unused pin), the device registers correctly:

#define MATRIX_ROW_PINS { B6 }

Output in dmesg:

[15816.499622] usb 3-3: new full-speed USB device number 18 using xhci_hcd
[15816.648843] usb 3-3: New USB device found, idVendor=cb10, idProduct=1133
[15816.648847] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15816.648849] usb 3-3: Product: BDN9
[15816.648851] usb 3-3: Manufacturer: Keebio
[15816.648853] usb 3-3: SerialNumber: 0
[15816.650966] input: Keebio BDN9 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/0003:CB10:1133.0018/input/input37
[15816.708128] hid-generic 0003:CB10:1133.0018: input,hidraw7: USB HID v1.11 Keyboard [Keebio BDN9] on usb-0000:00:14.0-3/input0
[15816.708911] input: Keebio BDN9 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.1/0003:CB10:1133.0019/input/input38
[15816.768055] hid-generic 0003:CB10:1133.0019: input,hidraw8: USB HID v1.11 Device [Keebio BDN9] on usb-0000:00:14.0-3/input1
[15816.769110] hid-generic 0003:CB10:1133.001A: hiddev2,hidraw9: USB HID v1.11 Device [Keebio BDN9] on usb-0000:00:14.0-3/input2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment