Repository navigation
diag(teensy4/flexio-rx): dump DMA + FLEXIO1 state on wait() timeout (refs #3066 phase 1) - #3067
Conversation
…refs #3066 phase 1) Adds FL_WARN dumps inside FlexIoRxChannelImpl::wait() that fire when the completion ISR never arrives. The dumps surface: - DMA channel state: complete flag, error flag, CITER vs BITER (so 'transfers_done' is visible without an oscilloscope). - FLEXIO1 module state: SHIFTSTAT (did shifter 0 ever latch?), SHIFTERR, TIMSTAT (did timer 0 ever compare?), CTRL. Live diagnostic output on Teensy 4.0 (COM20), flexioObjectFledTest test_case=4 (100-LED OBJECT_FLED frame): DMA complete=0 error=0 CITER=6064/6064 (transfers_done=0) SHIFTSTAT=0x0 SHIFTERR=0x0 TIMSTAT=0x0 CTRL=0x1 Confirms #3066 Phase 1 sub-task 1: the DMA channel is armed correctly but never triggered, because the FLEXIO1 timer never reaches its compare value, so the shifter never sets its status flag, so the DMA hardware-event trigger never fires. The TIMOD=3 (16-bit counter, counts down from TIMCMP=0xFFFF) + TIMRST=6 (reload counter on every trigger rising edge) combination resets the counter on every WS2812 bit-period rising edge before it can count down to 0, so the timer-compare event never fires and the shifter never latches. Refs #3066 Phase 1. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughOn timeout in ChangesFlexIO RX Timeout Diagnostics
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
…hs (refs #3066 phase 1) (#3068) Extends the wait()-timeout diagnostic block introduced by PR #3067 to also dump the first 8 words of mCaptureBuffer on both the TIMEOUT and SUCCESS exits. Distinguishes 'shifter never fired' from 'shifter fired but all samples were zero' without an oscilloscope. Surfaced by loop iter 4 (sub-task 1.6 investigation): trying TIMENA=0 + TIMRST=0 + TIMCMP=10 free-running sample mode produced `wait() SUCCESS: transfers_done=0/6064` with mCaptureBuffer all zero — DMA channel signalled completion (CITER reloaded to BITER) without ever copying a non-zero word into RAM. The dump turns this into actionable data the next iteration can use. The TIMENA=0/TIMCMP=10 experiment itself is reverted; only the diagnostic stays. The Phase 1 active blocker is still 'wire up FlexIO RX edge capture', the new puzzle is 'why does DMA report complete with zero transfers'. Refs #3066 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…iter 9) (#3214) * docs(flexio-rx): document iMXRT FlexIO architectural mismatch (#3066 iter 9) Adds a top-of-file warning block to rx_flexio_channel.cpp.hpp capturing the iter-9 root-cause finding from #3066: iMXRT FlexIO shifters cannot snapshot a peer timer's count into SHIFTBUF, and SMOD=1+TIMOD=3 collides shift-and-store on the same compare event per NXP's own documentation ('shift registers cannot shift and store on the same clock, so input data may be lost'). This explains the all-zero captures that PRs #3067/#3068/#3069/#3070/#3071 chased without success and the loop's pause at the 5-PR cap. Future readers should know not to twist more knobs on this file — the path forward is FlexPWM RX (Phase 4 of #3066), which has dedicated SMx_CAPTCTRL input-capture silicon. Pure comment change. Verified compiles via 'bash compile teensy40 --examples AutoResearch'. References issue comment #3066/4740201201 for the full register-by-register NXP cross-check. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(flexio-rx): drop emoji per C++ style (CodeRabbit on #3214) Replace the warning-triangle emoji with a 'WARNING:' text prefix per the FastLED C++ guideline against emoji in source files. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
First iteration of the
/looploop targeting issue #3066. Phase 1 sub-task 1: confirm DMA channel is actually being triggered.Adds
FL_WARNdumps insideFlexIoRxChannelImpl::wait()that fire when the completion ISR never arrives. The dumps surface:complete,error,CITERvsBITER→ livetransfers_donecount.SHIFTSTAT,SHIFTERR,TIMSTAT,CTRL.Live findings (verified on Teensy 4.0, COM20)
flexioObjectFledTesttest_case=4(100-LED OBJECT_FLED frame) →wait()times out → diagnostic fires:Decoded:
transfers_done=0) and didn't error.CTRL=0x1= FLEXEN=1).SHIFTSTAT=0).TIMSTAT=0).→ The DMA hardware trigger path (Shifter status flag → DMAMUX_SOURCE_FLEXIO1_REQUEST0) is dead because the shifter is never triggered, because the timer never compares.
Root cause hypothesis (for Phase 1 sub-tasks 3 + 4)
TIMOD=3configures the timer as a 16-bit countdown counter loaded fromTIMCMP=0xFFFFand decrementing every functional-clock tick (60 MHz post-#2772 fix).TIMRST=6reloads the counter on every trigger rising edge.WS2812 bit period ≈ 1.25 µs ≈ 75 ticks at 60 MHz. Counter starts at 65535, decrements ~75 ticks before the next rising edge slams it back to 65535. It never reaches 0, so the timer compare event never fires, so the shifter never shifts, so DMA never triggers.
This is a fundamental misconfig of the FlexIO timer/shifter for the "capture inter-edge interval" use case. The right pattern likely:
TIMODfor capture (TIMOD=2"16-bit baud counter" with the shifter latching on a different event), ORTIMENA/TIMRSTcombo.The next loop iteration picks this up as Phase 1 sub-tasks 3–4.
Test plan
Loop housekeeping
After merge, the next iteration will:
Refs #3066
🤖 Generated with Claude Code
Summary by CodeRabbit