Repository navigation
fix(teensy4/flexio-rx): drive timer via PINSEL+TIMENA=4 path; DMA now fires on pin edges (refs #3066) - #3070
Conversation
… fires on pin edges (refs #3066 phase 1) Loop iter 6 of #3066. With IOMUX routing now proven open (PR #3069 gave us FLEXIO1.PIN bit 6 tracking pin 4's pull-up at 0x40), the remaining bug was the timer's trigger source. The original `TIMENA=6` + `TIMRST=6` + `TRGSEL=2*flexio_pin+1` pattern never engaged on this iMXRT1062 build — verified across iters 2/3/5 by TIMSTAT=0 across 8 hand-driven pin transitions. This change drives the timer from its own PINSEL field instead of TRGSEL: TIMCTL: PINSEL = flexio_pin (was 0) TRGSEL = unused (was 2*flexio_pin+1 → Shifter 3 status) TIMCFG: TIMENA = 4 (Pin rising) (was 6 = Trigger rising + Pin high) TIMRST = 2 (Pin rising) (was 6 = Trigger rising) TIMCMP = 1 (was 0xFFFF) SHIFTCTL: TIMPOL = 0 (positive) (was 1 = negative) Live diagnostic (`flexioRxLoopbackPing` with 8 toggles, 50 µs apart): Pre-fix: TIMSTAT=0, transfers_done=0 Post-fix: TIMSTAT=1, transfers_done=4 ← matches 4 rising edges in 8 toggles DMA fires once per pin rising edge. `mCaptureBuffer` is still all-zero (shifter is latching a 1-bit value at the timer-compare moment but it reads as 0) — that's the next iter's puzzle around SHIFTBUF semantics. Not enough to decode WS2812 frames yet, but the chain is alive. Also adds an iter-6 diagnostic in `flexioRxLoopbackPing` that dumps FLEXIO1 `PIN`/`SHIFTSTAT`/`TIMSTAT` immediately after the toggles so the host can see whether the chain reacted in real time. Refs #3066 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 (2)
📝 WalkthroughWalkthroughFlexIO1 Timer 0 in ChangesFlexIO1 Timer 0 PINSEL refactor and diagnostic logging
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 |
…0 (refs #3066) (#3071) Loop iter 7 of #3066. Direct `SHIFTBUF[0]` + `SHIFTBUFBIS` (bit-swap) + `SHIFTBUFBYS` (byte-swap) reads in the `flexioRxLoopbackPing` RPC confirm: even with PR #3070's working timer/shifter chain (`transfers_done=4` per pin rising edge), the SHIFTBUF itself reads as `0x0` post-toggle. The captured 1-bit values reflect the pin as LOW even though FLEXIO1.PIN reads 0x40 (bit 6 high) right before the shifter samples. Also bumps TIMCMP from 1 to 10 (16-tick delay between TIMENA pin-rising trigger and the timer compare event) so the IOMUX synchroniser has more time to propagate the pin's new state before the shifter samples. Did not change behaviour — the bit still reads as 0 — but documents the trial in case future iters want to sweep larger TIMCMPs. Out of obvious knobs to twist without bench/scope visibility. Next iter (1.8) needs to dig into SMOD=1 sample timing semantics OR try SMOD=3/4 (Match Store / Continuous) to see if a different shifter mode latches the pin state more reliably at the timer-compare moment. 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
Loop iter 6 of #3066. With IOMUX routing now proven open (PR #3069 gave us
FLEXIO1.PINbit 6 tracking pin 4's pull-up at0x40), the remaining bug was the timer's trigger source. The originalTIMENA=6+TIMRST=6+TRGSEL=2*flexio_pin+1pattern never engaged on this iMXRT1062 build — verified across iters 2/3/5 byTIMSTAT=0across 8 hand-driven pin transitions.This change drives the timer from its own PINSEL field instead of TRGSEL:
flexio_pin(the input pin)2*flexio_pin+1(= Shifter 3 status, wrong)0xFFFF(1.09 ms wrap, never reached between toggles)Live verification on Teensy 4.0 (COM20)
flexioRxLoopbackPingwith 8 toggles 50 µs apart on pin 3 (jumpered to pin 4):DMA fires once per pin rising edge. The chain from pin → timer → shifter → DMA is finally alive end-to-end.
What this does NOT fix yet
mCaptureBufferis still all-zero — the shifter is latching a 1-bit value at the timer-compare moment but it reads as 0. That's the next iter's puzzle around SHIFTBUF semantics. Not enough to decode WS2812 frames yet, but the chain is alive and DMA actually moves data per pin transition. Major step forward.Test plan
flexioRxLoopbackPingreportstransfers_donematching the requested edge count (rising edges only).Refs #3066
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Chores