Alacrity Wiki

RBARF

A Voron logo LED board with its own microcontroller, which runs the LED animations itself

RBARF

Also part of the PrinterWorks project but spun into its own timeline, RBARF is a fork of the original Rainbow Barf Logo LED for Voron Toolheads. It adds a tiny microcontroller onboard the LED board that creates animations on the LED. It is currently in development on the third iteration.

Sources, schematics and firmware are in the PrinterWorks repository (Alacrity GitHub access needed).

V0.1 V0.2 V0.3

RBARF V0.1

Built on the wonderful Rainbow Barf Logo LED by VinnyCordeiro, we have added a tiny microcontroller to the back of the board.

Klipper can control Neopixels just fine, but animations can be demanding to klipper's resources. We implemented a way to create animations locally on the LED board. For this purpose, the LED signal coming from klipper is intercepted by a tiny microcontroller (STM8S001J3). This microcontroller presents itself to the host as a 16-led group, where the first 8 leds are the 8 real on the board, and the next 8 virtual leds (24 bytes) are metadata for creating simple animations (blink, fade, wave, etc) on top of the given color data.

The board includes a single pad for SWIM programming.

Firmware

Version 0.1 has a major flaw: a 16MHz 8-bit microcontroller has to read a few hundred bits coming as variable-length PWM pulses at 800KHz.

This gives us exactly 20 cpu cycles to read a whole pulse. To make it happen, we are reading raw GPIO values as fast as possible in the memory (like an oscilloscope) and then decoding them offline. We wrote a blog post on this challenge.

The reference/ folder contains a C version of the firmware. Because the algorithm is very complex, it does not fit in the available flash and RAM. The final firmware is manually-written STM8 assembly written to achieve data parity with the C firmware.

Build and flash

Needs SDCC 4.6.0 (other versions are refused), stm8flash and an ST-LINK/V2 wired to the board: SWIM → SWIM pad, TVCC → 3.3V, GND → GND.

cd firmware
make build/rbarf_prod.ihx
# power the board, then within 5 s:
stm8flash -c stlinkv2 -p stm8s001j3 -w build/rbarf_prod.ihx

The SWIM pad is only programmable during the first 5 s after power-on.

RBARF V0.2

The second revision of RBARF. The STM8 is replaced by an STM32C011D6 (WLCSP-12), powered by a TI TPS7A02 3.3V LDO, with an N-MOSFET (Q1) as a level shifter.

We used these very small wafer-level components so that all the parts fit on a single side of the board, which makes assembly easier.

RBARF V0.2 top side render

space 900x783
1 box 130,405 250,520 orange
2 box 300,305 385,395 green
3 box 648,318 728,362 red
  1. U2: MCU — STM32C011D6, WLCSP-12, 1.7 × 1.42 mm
  2. U1: LDO — TI TPS7A02, 3.3 V, 4-ball wafer-level (DSBGA)
  3. Q1: level shifter — N-MOSFET, DFN 1.0 × 0.6 mm

The STM32C011D6 in tweezers, ball side up. The whole chip is 1.7 × 1.42 mm, with 12 solder balls on a 0.35 mm pitch. It is a wafer-level package: the balls sit directly on the silicon die, and the silicon layers are visible on the ball side.

Programming and debug pads: SWDIO, SWCLK and UART.

Known issue: the Q1 footprint is wrong. It is fixed in RBARF V0.3.

Q1 repair

The MOSFET does not fit its footprint: its pads end up outside the part. We repaired the boards by extending the pads with short sections of wire, glued down to the board with UV-curable solder mask, then soldering the MOSFET onto the extended pads.

Before: the pads end up outside the MOSFET Pads extended with wire, UV solder mask After: the repaired board

Firmware

V0.2 runs the V0.3 firmware.

RBARF V0.3

The same board as RBARF V0.2 (STM32C011D6, TPS7A02 LDO), with the Q1 MOSFET footprint fixed.

Programming and debug pads: SWDIO, SWCLK and UART.

Firmware

Rust + Embassy, in firmware/. See firmware/README.md.

cd firmware
cargo build --release
cargo run --release    # flash with probe-rs

The C parity test (cargo test-anim) compiles the V0.1 animation engine from RBARF-V0.1/firmware/app/.

The same firmware runs on V0.2.