Repository navigation
Open
Labels
deferredTriage pass could not resolve this; skipped by ci/oldest_issue.py
Description
Background
CodeRabbit flagged this on PR #3431 (#3431 (comment)) as a Major / Heavy-lift Stability concern; deferring to a dedicated follow-up so it can land with its own coverage.
Problem
In src/platforms/arm/teensy/teensy4_common/drivers/flexio/flexio_spi_mode.cpp.hpp:
flexio_spi_wait()currently returns as soon assSpiDmaCompleteis set (DMA major-loop ISR has fired), then does a bounded 5 ms shifter-drain wait. Fast short transfers can still have the final byte clocking on the wire when the caller continues.- The fixed 50 ms DMA timeout is sized for the fastest SCLK. At the effective ~234 kHz floor (when
baud_div_fieldis clamped to 0xFF), a 4096-byte frame takes ~140 ms and would be force-recovered mid-transfer.
Fix sketch
- In
flexio_spi_show()store:sSpiActiveBytes = num_bytes;sSpiActiveBitClockHz = <effective clock derived from baud_div_field>;
- In
flexio_spi_wait():- Always drain the shifter/timer after DMA completion when a transfer was launched.
- Derive the DMA + drain timeout from
sSpiActiveBytes * 8 * 1000 / sSpiActiveBitClockHzplus a slack factor (e.g. 2x), with a sane floor and ceiling, instead of a hard-coded 50 ms. - Keep the existing force-recovery behavior, but trigger it only after the derived timeout, not the fixed one.
Test plan
- Extend
ci/autoresearch/test_flexio_spi_smoke.pywith a slow-clock case (e.g. 250 kHz x 1024 B, expected ~33 ms) to confirm no force-recovery is triggered. - Add a fast-clock case (12 MHz x 64 B, expected <0.1 ms) to confirm the wire-drain catches the tail byte before deinit.
- Hardware-verify on Teensy 4.1 (the same setup used for feat(flexio): unified clockless+SPI engine scaffolding (#3428) #3431's 3/3 smoke-test pass).
Refs
- PR feat(flexio): unified clockless+SPI engine scaffolding (#3428) #3431 (FlexIO SPI driver landing)
- Original CodeRabbit thread: feat(flexio): unified clockless+SPI engine scaffolding (#3428) #3431 (comment)
- Parent feat(teensy4/spi): massive parallel SPI driver via FlexIO and/or ObjectFLED (APA102 / SK9822 / HD108 / WS2801) #3428 (FlexIO SPI master implementation)
Metadata
Metadata
Assignees
Labels
deferredTriage pass could not resolve this; skipped by ci/oldest_issue.py
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Aug 20, 2026
Deferred under the active bug-burn-down policy after reproducing the defect in current source and checking the attached hardware inventory.
Current source evidence:
flexio_spi_wait()still begins withif (sSpiDmaComplete) return;, so it can skip the timer/shifter drain once the major-loop ISR has already fired.timeout_ms = 50, independent of bytes launched and effective SCLK.flexio_spi_show()records neither active byte count nor effective clock, so a derived deadline cannot currently be computed.Hardware gate:
fbuild port scanshows no selectable PJRC device. COM20/COM19/COM21/COM7 are phantom Windows records (present=no); only ESP32-C6 COM9 and RP-class COM18 are healthy.Restart criteria:
ceil(bytes * 8 / effective_hz)plus bounded slack; keep a sane floor/ceiling.wait().deferredand land the focused PR.The issue remains open and is excluded from the actionable queue while labeled
deferred.