Skip to content

UART clockless: generalize wave10 to waveN frame geometries (wave4/wave5) with per-chipset selection #3574

Closed

Description

@zackees

Follow-up to #3572, suggested during bench review: the wave10 model (10-bit UART frame = 2 LED bits × 5 pulses, 8 data bits + start/stop bookends) is one point in a family. ESP32 UART word lengths give sibling geometries:

Geometry Frame Data bits Pulses/LED-bit Baud @ 800 kHz
wave10 (current) 10 8 5 4.0 M
wave8-frame (new) 8 6 4 3.2 M

Why wave4 matters:

  1. Coverage — 20% lower baud reaches faster chipsets under the ESP32's 5 Mbps cap: LPD1886-class 1250 kHz timings (period 800 ns) are infeasible at wave10 (6.25 M) but fit wave4 at exactly 5.0 M with zero quantization error.
  2. Quantization — a second grid (period/4): SK6812's T0H=300/T1H=900 are EXACT multiples of period/4 (error 0 ns) vs 60+60 ns error on the period/5 grid.

Implementation: buildWave10Lut() evaluates both geometries via a shared fitUartWave(timing, P) helper (baud cap, [1, P−1] pulse range, distinctness, 400 ns minimum symbol separation from #3572, quantization tolerance) and picks the lower-error fit with a 50 ns hysteresis preferring wave10 — so all long-proven chipset shapes (WS2812, WS2812B-V5, WS2811-400) stay exactly as they were. The peripheral word length (UART_DATA_6_BITS/8_BITS) and baud now derive from the selected geometry.

Bench (ESP32-WROOM COM11, GPIO33→34):

  • UART + WS2812B-V5 (wave10 path): passed 4/4 byte-exact — regression clean.
  • UART + SK6812 (wave4 path): passed 4/4 byte-exact — first wire-verified wave8-frame transmission.

Not pursued: P=3 (9-bit frame, 3 bits/frame) — only fits wave3-eligible timings, adds little; P≥7 single-bit-per-frame — exceeds the 5 Mbps cap for all 800 kHz chipsets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions