Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

* Add dial turn flash behavior and pulse interval setting

* Swap dial turn led indication to default on state

* Update to latest panel-protocol

* This is for Edward

* Add fade

* Fix fading

* Remove extra comments

* Update to latest 0.4

* Add full fading for all colors

* Slightly adjust fade constant for more of a trail

* Add dial turn flash behavior and pulse interval setting

* This is for Edward

* Add fade

* Update to latest 0.4

* Add full fading for all colors

* Slightly adjust fade constant for more of a trail

* Break out rgb, general cleanup, adjust constants

* Minor cleanup for dialturn logic

* Update fade constant and move it

* Cleanup naming and visibility

* Fix target_led_color naming

* One more naming fix

* One more naming fix again

Co-authored-by: Brian Schwind <>

Git stats


Failed to load latest commit information.


Microcontroller firmware for controlling the lights and volume dial for tonari.

More info outlined here:


  • cargo, rustc
  • dfu-util (brew install dfu-util, apt install dfu-util, etc.)
  • (Optional, for UART flashing) stm32flash (brew install stm32flash, apt install stm32flash, etc.)
  • (Optional, for UART flashing) serial-monitor (cargo install serial-monitor)

Target STM32 Models

The current firmware uses this model:


This firmware can also be debugged on a USB-C "black pill" board, linked here: Board Info

The firmware also used to run on the cheaper STM32F103-based boards. Look in the commit history for working with that. It might be beneficial in the future to support both simultaneously and enable one or the other via feature flags.


rustup target add thumbv7em-none-eabihf


You can use the Makefile for easy development.

# Build and flash the firmware
make flash

# Monitor the serial output
make monitor

Board Connection


Simply connect the host computer to the STM32 dev board via a USB cable.

Serial Flashing

Using a CP2102 (3.3v logic) or another USB-Serial converter, connect its TX to pin A10 and its RX to pin A9. Also connect 3.3v from the CP2102 to the 3.3v pin on the STM32, and do the same for ground. If you try to power the STM32 from its USB port without this power connection, it won't work.

Convert to BIN File

cargo build will create an ARM ELF file, but we need it in a binary .bin format.

Install the Tools

cargo install cargo-binutils
rustup component add llvm-tools-preview

Create the BIN File

cargo objcopy --release -- -O binary panel-brain-firmware.bin

Flash the BIN File

On the "black pill" board, hold down the BOOT0 button, press and release NRST (reset button), then let get of BOOT0 to get into flashing mode.

Find your USB-UART converter path via a tool like serial-monitor or however you prefer. On MacOS it turned up as /dev/cu.SLAB_USBtoUART but results will vary.

USB DFU Flashing

dfu-util -D panel-brain-firmware.bin -d "0483:df11" -a 0 -s 0x08000000

Serial UART Flashing

stm32flash -b 230400 -w panel-brain-firmware.bin -v /dev/cu.SLAB_USBtoUART

Monitor Serial Output

In the spirit of doing everything in Rust, you can install a straightforward serial monitor via Cargo:

cargo install serial-monitor

Simply invoke it with serial-monitor and it will begin monitoring the first serial port it finds.

You can also pass it a specific device with

serial-monitor -p /dev/cu.SLAB_USBtoUART

Set the baud rate with the -b flag:

serial-monitor -b 9600 -p /dev/cu.SLAB_USBtoUART

Debugging with an STM32F103-based Board

  • Download the BlackMagic v*.tar.gz tarball release on github
  • Find blackmagic_dfu_swlink.bin in the tarball.
  • Using a USB-serial device, put an STM32F103 dev board (typically a blue-pill or black-pill) in bootloader mode (see the steps above).
  • Run stm32flash -R -b 230400 -w blackmagic_dfu-swlink.bin -v <PATH_TO_YOUR_SERIAL_DEVICE_HERE>
  • Get blackmagic-native.bin from the release tarball as well.
  • Run dfu-util -d 1d50:6018,:6017 -s 0x08002000:leave -D blackmagic-native.bin


  • Attach the SWD wires from the blackmagic debug probe you just created to the target device. This is typically 4 wires: 3v3, GND, SWDIO, and SWCLK.
  • Run arm-none-eabi-gdb target/thumbv7em-none-eabihf/release/panel-firmware (you will need a GNU ARM toolchain for this)
  • Inside gdb, run target extended-remote /dev/cu.usbmodem95C55F961 (or wherever your blackmagic probe shows up as a device)
  • In gdb: monitor swdp_scan
  • In gdb: attach 1


Firmware for the volume control hardware, targeting an STM32F4 board







No packages published