Repository navigation
fix(teensy4/flexio-rx): set SION + add flexioRxLoopbackPing RPC (refs #3066 phase 1.7) - #3069
Conversation
…g RPC (refs #3066 phase 1.7) Two device-side changes from #3066 loop iter 5: 1. **SION bit on pad MUX (necessary, not sufficient).** The original flexio1_pin_init() wrote ALT4 (=4) to the pad mux but missed the SION bit (0x10). Without SION the IOMUX doesn't force the input path through to the peripheral when the pad selects an alt function. The working FlexPWM RX driver sets it the same way (rx_flexpwm_channel.cpp.hpp:405). Fixed by OR-ing 0x10: *(pin_info.mux_reg) = 4 | 0x10; // ALT4 + SION Verified by reading FLEXIO1_PIN (offset 0x00C, NOT 0x040 — the earlier iter 5 diagnostic used the wrong offset): pre-fix: FLEXIO1 PIN=0x0 (FlexIO sees nothing on pin 4) post-fix: FLEXIO1 PIN=0x40 (bit 6 set = pin 4 pulled up ✓) The IOMUX routing now works end-to-end. Captures are still zero because the shifter/timer chain has a separate bug (the iter 3 TIMENA-doesn't-engage-trigger puzzle); that's the active blocker for iter 6+. 2. **New flexioRxLoopbackPing RPC.** Hand-drives tx_pin via digitalWrite while FlexIO RX is armed on rx_pin, then reads the captured edges. Decisively distinguishes 'IOMUX routing broken' from 'shifter/timer wrong' without any clockless driver in the loop. {tx_pin?: 3, rx_pin?: 4, toggle_us?: 50, edges?: 8} → { success, edges_captured, first_edges: [{high, ns}, ...] } Also moves the FLEXIO1_PIN diagnostic from the wrong offset 0x040 to the correct 0x00C, and adds an IOMUX register read-back so future iterations can verify pad config on the wire instead of guessing. 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)
📝 WalkthroughWalkthrough
ChangesFLEXIO RX Loopback Diagnostics
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 |
… fires on pin edges (refs #3066 phase 1) (#3070) 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]>
…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 5 of #3066. Two device-side changes:
SION bit on pad MUX (necessary, not sufficient). Original
flexio1_pin_init()wrote ALT4 alone; without SION the IOMUX doesn't force the input path through to the peripheral. The working FlexPWM RX driver sets SION the same way (rx_flexpwm_channel.cpp.hpp:405). Verified by FLEXIO1_PIN readback at the correct offset 0x00C (NOT 0x040 which the iter 5 first attempt mistakenly used):New
flexioRxLoopbackPingRPC. Hand-drivestx_pinviadigitalWritewhile FlexIO RX is armed onrx_pin. Decisively distinguishes 'IOMUX routing broken' from 'shifter/timer wrong' without any clockless driver in the loop.What this does NOT fix yet
Captures still come back all zero — IOMUX routing now works end-to-end (verified by FLEXIO1_PIN bit 6 tracking the pull-up), but the shifter/timer chain has a separate bug (the iter 3 TIMENA-doesn't-engage-trigger puzzle). That's the active blocker for iter 6+.
Live validation
Refs #3066
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests