Skip to content

fix(parlio): derive wave8 clock from chipset timing + edge-probe diagnostics (#3586) - #3593

Merged
zackees merged 1 commit into
masterfrom
fix/parlio-derived-clock-edgeprobe-3586
Jul 2, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/parlio-derived-clock-edgeprobe-3586

Conversation

@zackees

@zackees zackees commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Two deliverables from the #3586 deep-dive:

1. PARLIO wave8 clock derived from chipset timing

The wave8 clock was the hardcoded 8 MHz FL_ESP_PARLIO_CLOCK_FREQ_HZ; it must be 8 samples/bit ÷ bit_period (WS2812B_V5's 1225 ns → 6.53 MHz). Bench-measured on ESP32-C6 with the new in-firmware edge probe: the old constant transmitted WS2812 with a 1.0 µs bit period (T1H 643 ns / T1L 356 ns on the wire) — 25% fast. Same mandate as the classic-I2S engine: pixel clocks derive from ChipsetTimingConfig, never hardcoded. Mock tests updated.

2. Edge-probe diagnostic suite (AutoResearch)

edgeProbe / edgeProbeRead RPCs: an in-firmware logic probe (trigger on activity, run-length record with the cycle counter) plus parlioRawTest (minimal IDF parlio transmit, parameterized) for engine-vs-IDF bisection. Portability lessons hard-encoded: rdcycle is an illegal instruction on Espressif RISC-V (use esp_cpu_get_cycle_count()); classic GPIO.in is a bare u32; LED frames complete inside one FreeRTOS tick (burst-poll triggers required).

#3586 status

Waveform proven present and now timing-correct; the capture blindness (RMT-RX records zero symbols for PARLIO/RMT-TX frames while UART/SPI/BIT_BANG capture fine on the same jumper) persists — full forensic addendum with the elimination table posted on the issue.

Host: 347/347; lint clean; esp32dev/s3/p4/c6 compile clean. Bench: C6 SPI/UART 4/4, P4 RMT/SPI/UART 4/4 on the new clock.

Refs #3586, #3576.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added an AutoResearch edge-probe tool for capturing GPIO edge timings on supported ESP32 devices.
    • Expanded remote control support with new commands to run edge probing and inspect captured edge data.
    • Added a PARLIO transmit test mode for ESP32 builds with PARLIO support.
  • Bug Fixes

    • Improved clock selection for certain PARLIO timing configurations so output frequency better matches the configured waveform timing.

…nostics (#3586)

Two deliverables from the #3586 deep-dive on the C6 bench:

1. PARLIO wave8 clock is now DERIVED from the chipset timing
   (8 samples/bit -> clock = 8e9 / bit_period_ns) instead of the
   hardcoded 8 MHz FL_ESP_PARLIO_CLOCK_FREQ_HZ. Bench-measured on
   ESP32-C6 with the in-firmware edge probe: the old constant
   transmitted WS2812 with a 1.0 us bit period (T1H 643 ns / T1L
   356 ns on the wire) - 25% fast. Same rule as the classic-I2S
   engine: pixel clocks derive from ChipsetTimingConfig, never
   hardcoded. Mock-driver tests updated (WS2812B_V5 1225 ns ->
   6530612 Hz).

2. AutoResearch edge-probe tooling (edgeProbe / edgeProbeRead RPCs +
   AutoResearchEdgeProbe.{h,cpp}): an in-firmware logic probe that
   triggers on line activity and run-length records the waveform with
   the cycle counter (62.5 ns resolution class). Includes an arm-time
   pull-toggle self-test, a mid-test re-arm task (drivers clear the
   pad's input-enable on re-init), and trigger-time RMT register
   snapshots. Also parlioRawTest: a minimal IDF parlio transmit
   (pin/hz/width/pattern/queue-flags parameterized) for
   engine-vs-IDF-vs-silicon bisection.

   Hard-won portability notes encoded in the tooling: plain `rdcycle`
   is an ILLEGAL INSTRUCTION on Espressif RISC-V cores (use
   esp_cpu_get_cycle_count()); classic ESP32 exposes GPIO.in as a bare
   u32 (use GPIO_IN_REG/GPIO_IN1_REG); LED frames complete inside one
   FreeRTOS tick so triggers must tight-poll in bursts.

#3586 status after this change: the PARLIO waveform is present and
timing-correct on the wire; the RMT-RX capture still records zero
symbols for PARLIO/RMT-TX frames while UART/SPI/BIT_BANG on the same
jumper capture fine - full forensic addendum on the issue.

Host: 347/347, lint clean. Bench: C6 SPI/UART 4/4; P4 RMT/SPI/UART
4/4 with the new derived clock.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d5a9204e-a70a-4be2-b72b-184858546ca0

📥 Commits

Reviewing files that changed from the base of the PR and between 2fe8316 and a59dbaf.

📒 Files selected for processing (5)
  • examples/AutoResearch/AutoResearchEdgeProbe.cpp
  • examples/AutoResearch/AutoResearchEdgeProbe.h
  • examples/AutoResearch/AutoResearchRemoteSystemMethods.cpp
  • src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp
  • tests/platforms/esp/32/drivers/parlio/parlio_driver.cpp

📝 Walkthrough

Walkthrough

Adds a new ESP32 edge-probe module (implementation, header, and RPC bindings) for capturing and reading GPIO edge timestamps, plus a new PARLIO raw transmit RPC test binding. Separately, PARLIO Wave8 clock frequency is now derived from chipset timing instead of a fixed constant, with matching test updates.

Changes

Edge Probe and RPC Wiring

Layer / File(s) Summary
Edge probe capture core and ISR
examples/AutoResearch/AutoResearchEdgeProbe.cpp
Adds fixed-size timestamp storage, a cycle counter helper, and a CHANGE-interrupt ISR that records packed edge level and timestamp entries.
Probe arming and capture task
examples/AutoResearch/AutoResearchEdgeProbe.cpp
Implements edgeProbeArm including interrupt setup, self-test, a FreeRTOS capture task with polling/state-machine capture, and optional ESP32C6 RMT-RX register snapshot.
Public accessors, stubs, and header
examples/AutoResearch/AutoResearchEdgeProbe.cpp, examples/AutoResearch/AutoResearchEdgeProbe.h
Adds accessor functions for stamps/state/self-test/RMT/CPU frequency, non-ESP32 no-op stubs, and the public header declaring the API.
AutoResearch RPC bindings
examples/AutoResearch/AutoResearchRemoteSystemMethods.cpp
Includes the edge probe header and parlio_tx.h, and registers parlioRawTest, edgeProbe, and edgeProbeRead RPC methods.

PARLIO Wave8 Clock Frequency Fix

Layer / File(s) Summary
Timing-derived clock frequency
src/platforms/esp/32/drivers/parlio/parlio_engine.cpp.hpp, tests/platforms/esp/32/drivers/parlio/parlio_driver.cpp
Derives Wave8 mClockFreqHz from T1+T2+T3 bit period instead of a fixed constant, with a fallback, and updates four test assertions from 8000000 to 6530612.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AutoResearchRemoteControl
  participant AutoResearchEdgeProbe
  participant GPIO_ISR

  Client->>AutoResearchRemoteControl: edgeProbe(pin)
  AutoResearchRemoteControl->>AutoResearchEdgeProbe: edgeProbeArm(pin)
  AutoResearchEdgeProbe->>GPIO_ISR: install CHANGE interrupt, run self-test
  GPIO_ISR-->>AutoResearchEdgeProbe: record edge timestamps
  AutoResearchEdgeProbe-->>AutoResearchRemoteControl: pin, selfTestEdges
  AutoResearchRemoteControl-->>Client: success, pin, selfTestEdges

  Client->>AutoResearchRemoteControl: edgeProbeRead()
  AutoResearchRemoteControl->>AutoResearchEdgeProbe: edgeProbeStamps(count)
  AutoResearchEdgeProbe-->>AutoResearchRemoteControl: timestamp buffer, count
  AutoResearchRemoteControl->>AutoResearchEdgeProbe: edgeProbeRmtLive(), edgeProbeState()
  AutoResearchEdgeProbe-->>AutoResearchRemoteControl: rmt samples, state
  AutoResearchRemoteControl-->>Client: level/ns pulse entries
Loading

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3191: Both PRs modify AutoResearchRemoteControl::bindSystemMethods in the same file, adding/renaming RPC bindings there.
  • FastLED/FastLED#3571: Both PRs extend bindSystemMethods with new AutoResearch RPC bindings in the same file.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/parlio-derived-clock-edgeprobe-3586

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant