Repository navigation
Description
Context
Follow-up from #3526 Phase 2e review on the classic-ESP32 I2S engine, where the modern I2S peripheral (i2s_peripheral_esp32dev_esp.cpp.hpp) was updated to accept a variable mPixelClockHz in its config so the engine can drive non-800kHz chipsets (e.g., WS2811 at 400 kHz, SK6812 with different T1/T2/T3, etc.). PARLIO's engine should mirror this pattern.
Current PARLIO behavior
parlio_engine.cpp.hpp selects wave3 when canUseWave3(timing) is true (per-chipset via wave3ClockFrequencyHz(timing)) or wave8 with FL_ESP_PARLIO_CLOCK_FREQ_HZ (a compile-time constant). Wave8's clock is effectively fixed at that constant across all wave8-eligible chipsets.
For chipsets whose bit rate isn't 800 kHz (e.g., WS2811 at 400 kHz), the wave8 clock should scale accordingly (400 kHz × 8 pulses/bit = 3.2 MHz, not 8 MHz). Otherwise the encoded pulse widths don't match the target chipset timing.
Proposal
Investigate whether PARLIO's clockless engine should:
-
Compute wave8 clock from chipset timing (
clock_hz = 8 * data_rate_hzwheredata_rate = 1 / (T1+T2+T3)) instead of using the fixedFL_ESP_PARLIO_CLOCK_FREQ_HZcompile-time constant. -
Fall back to wave3 or a higher-oversampling encoder for chipsets whose target clock exceeds PARLIO's max programmable rate on the specific SoC (P4 / C6 / H2 / C5 all have different upper bounds).
-
Match the I2S impl's variable-timing pattern (see the
solveI2sClockDividerfollow-up issue for hoisting that helper to a shared location).
Acceptance
- Design decision: does PARLIO recompute clock per-chipset, or does the existing fixed clock cover the practical chipset set (WS2812, WS2812B, SK6812, WS2811, APA104, TM1809, etc.)?
- If per-chipset:
parlio_engine.cpp.hppcomputes clock atconfigureTiming()time,mClockFreqHzis chipset-derived. - Regression tests: verify that a WS2812B strip still gets the correct 8 MHz clock (backward compat), and that a WS2811 strip gets ~3.2 MHz (new behavior).
Reference
- I2S impl of the same pattern:
src/platforms/esp/32/drivers/i2s/i2s_peripheral_esp32dev_esp.cpp.hpp— see thesolveI2sClockDivider()helper and themConfig.mPixelClockHz-drivenclkm_confwrite. - Meta: I2S modern driver: wave8/wave3 general clockless (like PARLIO) + SPI unified — do NOT delegate to Yves #3526 Phase 2e (this issue was filed as an outcome).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(i2s): Phase 2e — delete Yves, singleton peripheral, variable tim…
docs(i2s): rewrite README for modern engine (#3526 Phase 8 / #3512 Ph…
feat(i2s): wire wave8 encoding into engine + routeLanePin call (#3526) (
docs(i2s): document open bench debug on tx_bits_mod (#3526 / #3515) (#…
fix(i2s,rmt-rx): 32-bit sample encoding + classic-ESP32 capture fixes (…
test(parlio): cover WS2811 400kHz clock (#3561) (#3951)