Skip to content

diag(teensy4/flexio-rx): probe SHIFTBUF[0]/BIS/BYS directly; TIMCMP=10 (refs #3066 iter 7) - #3071

Merged
zackees merged 1 commit into
masterfrom
diag/3066-iter7-shiftbuf-probe
Jun 15, 2026
Merged

zackees merged 1 commit into
masterfrom
diag/3066-iter7-shiftbuf-probe

Conversation

@zackees

@zackees zackees commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Loop iter 7 of #3066. Two probes:

  1. Direct SHIFTBUF reads in flexioRxLoopbackPing. Reads SHIFTBUF[0], SHIFTBUFBIS[0] (bit-swap view), and SHIFTBUFBYS[0] (byte-swap view) immediately after the toggles — confirms the captured value is genuinely 0x0 and not just a side-effect of mCaptureBuffer copying.
  2. TIMCMP=10 instead of 1 — gives the IOMUX synchroniser ~170 ns to propagate the new pin state before the shifter samples.

Iter 7 finding

[ping diag] post-toggle FLEXIO1: PIN=0x0 SHIFTSTAT=0x0 TIMSTAT=0x1
[ping diag] SHIFTBUF[0]=0x0 SHIFTBUFBIS[0]=0x0 SHIFTBUFBYS[0]=0x0
mCaptureBuffer[0..7]: 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
transfers_done=4/1024

The shifter shifts 4 times (one per pin rising edge — PR #3070 confirmed) but every sampled bit reads as 0 across both the canonical and swapped views. Out of obvious knobs to twist without bench/scope visibility.

Next iter direction (1.8)

  • Try SMOD=3 (Match Store) or SMOD=4 (Match Continuous) instead of SMOD=1 (Receive). Maybe the receive-mode sample timing doesn't latch the pin state at the right moment relative to the timer-compare event.
  • Or use a two-timer chain (the iter 3 design) where one timer free-runs as a sample clock and a second timer triggers shifter latches on pin edges.

Refs #3066

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Refined FlexIO receiver timing configuration on Teensy 4.x platforms, including adjusted timer polarity settings and updated timer comparison values.
    • Enhanced system diagnostic logging with expanded register inspection capabilities, including additional data format variants for improved hardware troubleshooting.

…0 (refs #3066)

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]>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 939cccd4-ee21-4b58-8534-4cddb8117c40

📥 Commits

Reviewing files that changed from the base of the PR and between fecaa2f and 497082c.

📒 Files selected for processing (2)
  • examples/AutoResearch/AutoResearchRemote.cpp
  • src/platforms/arm/teensy/teensy4_common/rx_flexio_channel.cpp.hpp

📝 Walkthrough

Walkthrough

In flexio1_configure, the FlexIO1 RX shifter timer polarity (TIMPOL) is switched to negative and the timer compare register (FLEXIO1_TIMCMP[0]) is raised from 1u to 10u. In the flexioRxLoopbackPing diagnostic, post-toggle logging is extended to also read and warn on SHIFTBUF[0], SHIFTBUFBIS[0], and SHIFTBUFBYS[0].

Changes

FlexIO1 RX Timing Adjustment and Diagnostics

Layer / File(s) Summary
FlexIO1 RX timer polarity and compare value
src/platforms/arm/teensy/teensy4_common/rx_flexio_channel.cpp.hpp
TIMPOL bitfield set to negative polarity; FLEXIO1_TIMCMP[0] raised from 1u to 10u in flexio1_configure.
Loopback ping SHIFTBUF diagnostic logging
examples/AutoResearch/AutoResearchRemote.cpp
flexioRxLoopbackPing post-toggle block extended with FL_WARN reads of SHIFTBUF[0], SHIFTBUFBIS[0], and SHIFTBUFBYS[0] alongside existing PIN, SHIFTSTAT, and TIMSTAT dumps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2781: Both PRs modify flexio1_configure in rx_flexio_channel.cpp.hpp, with the retrieved PR changing initialization/hang-prevention logic in the same FlexIO1 setup path.
  • FastLED/FastLED#2766: Both PRs modify the Teensy 4.x FlexIO1 receive configuration in rx_flexio_channel.cpp.hpp, with the retrieved PR implementing the flexio1_configure hardware programming path that this PR adjusts.

Poem

🐇 Hoppin' through registers, one flip at a time,
TIMPOL gone negative — a curious rhyme.
TIMCMP set to ten, the shifter now bends,
SHIFTBUF reveals its secrets, the mystery ends.
This bunny checks BIS, BYS, and more,
Sniffing for signals on the FlexIO floor! 🔍

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch diag/3066-iter7-shiftbuf-probe

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit c8fca96 into master Jun 15, 2026
7 of 8 checks passed
@zackees
zackees deleted the diag/3066-iter7-shiftbuf-probe branch June 15, 2026 13:52
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 15, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 15, 2026
zackees added a commit that referenced this pull request Jun 18, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant