This document provides step-by-step instructions for compiling and flashing ZMK firmware for the Chordboard Controller (CBC) board.
The CBC is a custom keyboard based on the nRF52840 SoC, supporting:
- USB
- Bluetooth Low Energy (BLE)
- Rotary encoders
- Matrix key scanning via ZMK
This guide assumes you have already set up the ZMK development environment.
-
Firmware is configured for CBC board revision 1.0.0
-
Uses a custom keymap (
cbc.keymap) with:- Chorded combos
- Encoder bindings
- HID behaviors
-
Output format:
CONFIG_BUILD_OUTPUT_UF2=n- Produces a
.hexfile (not UF2)
-
Flashing methods supported:
- J-Link (recommended in this guide)
- nrfjprog
- DFU
- CBC board
- J-Link debugger (e.g., J-Link EDU or compatible)
- ZMK repository cloned (e.g.,
~/zmk/zmk.git) - West tool initialized (
west init,west update) - Zephyr SDK (v0.16.5 or compatible)
- nRF Connect for Desktop (with Programmer app)
- Python 3.10+ with virtual environment
~/zmk/zmk.git/
├── app/
│ └── boards/chordboard/cbc/
└── build/
cd ~/zmk/zmk.git
source .venv/bin/activate
west build -p always -b cbc app
- Cleans previous builds (
-p always) - Uses board configuration (
-b cbc) - Compiles ZMK firmware
build/zephyr/zephyr.hex ← Flash this file
Look for:
Linking C executable zephyr/zmk.elf- Memory usage summary
-
Run:
west update -
Check:
- DTS warnings
- Kconfig issues
prj.confdependencies (e.g., USB_CDC_ACM warnings)
-
Validate:
cbc.keymapcbc.dts
-
Connect J-Link to PC via USB
-
Connect J-Link to CBC via SWD:
- SWDIO
- SWCLK
- GND
- VCC (VTref)
Connector: 5-pin header (bottom-left of board)
- Power the board via USB
- Launch nRF Connect for Desktop
- Open Programmer
- Choose detected J-Link device (e.g.,
nRF52840_xxAA) - Click Refresh if not visible
-
Click Add file
-
Select:
build/zephyr/zmk.hex or *projectpath*\compiled\zmk.hex
-
Enable Erase all
-
Ensure correct memory layout:
- Bootloader:
0x0000 - Application:
0xC000
- Bootloader:
- Click Write or Erase & Write
- Wait (~10–30 seconds)
-
Click Reset
-
Reconnect USB
-
Verify:
- Device appears as HID keyboard
- Keys & encoders function
- BLE pairing works
- Check wiring
- Reinstall J-Link drivers
- Ensure board is powered
- Reduce J-Link speed to 4000 kHz
- Use Recover option if locked
- Rebuild firmware
- Confirm
.hexis up to date
west flash --runner jlink
nrfjprog --program build/zephyr/zephyr.hex --chiperase --reset
Edit:
cbc.keymap
Then rebuild & flash.
- Device name:
"CBC" - To retain bonds:
CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START=n
Enable logging in prj.conf:
CONFIG_LOG=y
west update
If issues persist:
- Check ZMK GitHub issues
- Ask in ZMK Discord
- Verify nRF52840-specific configurations
You’re now ready to build, flash, and iterate on your CBC firmware.