Skip to content

runSingleTest: inline pinTx/pinRx differing from the standing configuration fail silently (captureEvidenceBytes: 0, no error) #4374

Closed

Description

@zackees

runSingleTest accepts pinTx/pinRx, validates them, and reports them back in actualTxPin/actualRxPin — but changing them does not reconfigure the RX capture channel. Capture stays on the previously-configured pin and returns nothing, while the response looks like the change took effect.

A/B on identical hardware, same session

baseline via setPins(tx=0, rx=1), no inline pins:
    passed=True   actualTx=0  actualRx=1

runSingleTest with inline pinTx=1, pinRx=0:
    passed=False  actualTx=1  actualRx=0  captureEvidenceBytes=0

setPins(tx=1, rx=0), no inline pins:
    passed=True   actualTx=1  actualRx=0

The same pin pair (1/0) passes via setPins and fails inline. The wiring, driver and LED count are identical across all three; only how the pins were requested differs. So this is not a pin-capability or wiring constraint — both directions of the GPIO0/GPIO1 bridge work when configured through setPins.

The firmware knows the channel needs recreating

setPins says so in its own response:

{"txPin": 0, "rxPin": 1, "success": true,
 "previousTxPin": 1, "previousRxPin": 0,
 "rxChannelRecreated": true}

The inline path has no equivalent. A request that merely matches the already-configured pins appears to work — which is why this is easy to miss: it only fails when the inline values actually differ from the current configuration.

Why it matters

The failure is silent and success-shaped. captureEvidenceBytes: 0 is the only tell, passed: false carries no error, and actualTxPin/actualRxPin echo the requested values, so the response asserts a configuration that was only half applied.

I misdiagnosed it myself for several runs: seeing inline 0/1 fail and inline 1/0 pass, I concluded the soldered bridge only worked in one direction — a hardware conclusion from a software fault. 1/0 only "passed" because it happened to match the standing configuration and therefore changed nothing. That is the shape of wrong conclusion this will produce for anyone using inline pins to probe alternative wiring.

Reproducing

No rebuild required; drive the RPCs directly against flashed firmware. Set pins one way via setPins, then request the other way inline via runSingleTest, then set that same pair via setPins and observe it pass.

Environment: RP2350W 2DCB876B587EA334, PIO0, GPIO0/GPIO1 bridge, master. Reproduced consistently.

Suggested direction: either have the inline path recreate the RX channel the way setPins does, or reject inline pins that differ from the standing configuration rather than half-applying them. Echoing the requested pins back while capture runs on the old one is the part that misleads.

Found while probing parameter validation for #3899.

Activity

  1. zackees commented on Sep 11, 2026

    @zackees
    MemberAuthor

    Correcting the mechanism in this report — the RX channel is recreated

    I titled this "without recreating the RX channel". That is wrong. Reading the implementation after filing:

    AutoResearchRemoteRunSingleTest.cpp:935

    } else if (pin_rx != mState->pin_rx && mState->rx_factory) {
        rx_channel_to_use = mState->rx_factory(pin_rx);
        if (!rx_channel_to_use) {
            response.set("error", "RxChannelCreationFailed");
            ...
        }
    }

    So the inline path does build a temporary RX channel on the requested pin, with a null check, and passes it into the test config. My stated cause was an inference from the symptom, not something I had read, and I should have checked before filing rather than after.

    The observations stand — same pin pair, same session, same hardware:

    setPins(0,1), no inline pins   -> passed=True   tx=0 rx=1
    inline pinTx=1, pinRx=0        -> passed=False  tx=1 rx=0  bytes=0
    setPins(1,0), no inline pins   -> passed=True   tx=1 rx=0
    

    What differs between the working and failing paths is not whether a channel is created but what happens to the old one. setPins replaces it (mState->rx_channel = replacement_rx, releasing the previous). The inline path adds one, leaving mState->rx_channel on the original pin alive alongside the temporary. Two RX channels then exist against the same limited PIO RX resources, which would explain a channel that constructs successfully — hence no RxChannelCreationFailed — and captures nothing.

    I am flagging that as the plausible next place to look, not asserting it: I have not separated it from other candidates, and having already published one wrong mechanism here I would rather leave this one explicitly unconfirmed. Distinguishing it needs either PIO resource introspection or a firmware change to release the standing channel for the duration of the call.

    The reproducer and the practical consequence are unaffected: inline pins that differ from the standing configuration fail silently, with actualTxPin/actualRxPin echoing the request as though it had been applied, and captureEvidenceBytes: 0 the only signal. That is what led me to conclude the soldered bridge was directional when it is not.

    Retitling would be appropriate; I have left the title alone for now since the issue is better identified by its reproducer than by a cause I have twice not established.

  2. changed the title [-]runSingleTest's inline pinTx/pinRx move the TX pin without recreating the RX channel — silent capture failure[/-] [+]runSingleTest: inline pinTx/pinRx differing from the standing configuration fail silently (captureEvidenceBytes: 0, no error)[/+] on Sep 11, 2026
  3. zackees commented on Sep 11, 2026

    @zackees
    MemberAuthor

    Narrowed: the fault is in the temporary RX channel path, not the TX side

    A discriminator separates the two candidates cleanly. The inline path only builds a temporary channel when pin_rx != mState->pin_rx (AutoResearchRemoteRunSingleTest.cpp:935), so requesting inline pins identical to the standing configuration exercises the inline TX handling without creating one:

    standing (setPins) inline request temp RX channel built? result
    0/1 pinTx=0, pinRx=1 (identical) no pass, bytes=120
    0/1 pinTx=0 only (rx untouched) no pass, bytes=120
    1/0 pinTx=1, pinRx=0 (identical) no pass, bytes=120
    0/1 pinTx=1, pinRx=0 (differs) yes fail, bytes=0

    Failure tracks temporary-channel creation exactly. Inline pin handling in general is fine — including passing pinTx on its own — so the TX side is not implicated, and neither is inline parameter handling as such.

    What is established: the failure occurs when and only when rx_factory(pin_rx) is invoked for a differing pin.

    What is not: why that channel captures nothing. The candidate I raised — the standing mState->rx_channel remaining alive on the old pin, so two RX channels contend for the same PIO RX resources, whereas setPins replaces rather than adds — is consistent with every observation here, but consistency is not proof and I have not tested it. Doing so needs PIO resource introspection or a build that releases the standing channel for the duration of the call. I have already published one wrong mechanism on this issue and am not going to assert a second on circumstantial fit.

    The practical guidance is unchanged and now sharper: inline pinRx differing from the standing configuration silently produces no capture. Use setPins to change pins; inline pins are safe only when they match what setPins already established.

  4. zackees commented on Sep 11, 2026

    @zackees
    MemberAuthor

    Further narrowing: temporary RX channels never capture, regardless of where the standing channel sits

    Tested one of the sub-hypotheses directly. If the fault were the standing mState->rx_channel holding the bridged pin, then parking it somewhere unrelated should let the temporary channel work.

    setPins(txPin=1, rxPin=20)        -> success, rxChannelRecreated: true
      (standing RX now on pin 20, which is not bridged and not otherwise used)
    
    runSingleTest inline pinTx=1, pinRx=0   -> passed=False, bytes=0
      (temporary channel created on pin 0, the bridged pin; standing is on 20)
    
    setPins(txPin=1, rxPin=0), no inline    -> passed=True, bytes=120
    

    The temporary channel is on the correct bridged pin, the standing channel is twenty pins away and idle, and capture still yields nothing. The identical pin as a standing channel captures fine.

    Eliminated: the standing channel occupying the pin the temporary one wants.

    Established: a temporary RX channel built by the inline path captures nothing, wherever the standing channel is.

    Still open: whether two live channels exhaust PIO RX resources, or the temporary channel is simply never started/armed the way a setPins replacement is. Both remain consistent; I have not separated them, and separating them needs either PIO resource state or a build that releases the standing channel first.

    Cumulative picture across three rounds of testing on this issue:

    condition temp channel built? result
    inline pins identical to standing no pass
    pinTx alone, rx untouched no pass
    inline rx differs, standing on the bridged pin yes fail
    inline rx differs, standing parked on an unused pin yes fail

    Failure tracks temporary-channel creation and nothing else — not the TX pin, not the standing pin, not inline parameters generally.

  5. zackees commented on Sep 11, 2026

    @zackees
    MemberAuthor

    Investigation summary — three eliminations, one condition, cause still open

    As far as black-box RPC testing reaches. Consolidating so nobody repeats these.

    The condition (survives every test)

    A temporary RX channel — built when inline pinRx != mState->pin_rx — captures nothing. Everything else works:

    condition temp channel? result
    inline pins identical to standing no pass
    pinTx alone, rx untouched no pass
    inline rx differs, standing on the bridged pin yes fail
    inline rx differs, standing parked on unused pin 20 yes fail

    Eliminated

    The standing channel occupying the wanted pin. Parked it on unused pin 20, built the temporary one on the bridged pin 0 — still zero bytes, while that same pin as a standing channel captures 120.

    The temporary channel being ignored in favour of the standing one. Inverted the test: standing on the bridged pin 0 (signal present), inline pinRx=20 (dead pin). If the code fell back to the standing channel it would have captured; it returned zero, so the temporary channel really is the one driving capture.

    Resource accumulation across calls. Six consecutive inline calls, each creating a temporary channel on a different pin, then the standing configuration: passes, 120 bytes, twice in a row. No leak, no progressive degradation.

    Still open

    Why a channel that is created without error, is genuinely used, and does not leak, captures nothing — while an identically-pinned channel created through setPins works. The remaining candidates are a transient conflict while two channels are live, or the temporary channel never being armed the way a setPins replacement is. Separating them needs PIO RX state or a build that releases the standing channel first; neither is reachable from here, and I am not going to guess between them.

    Guidance unchanged

    Use setPins to change pins. Inline pinRx is safe only when it matches the standing configuration — otherwise it silently captures nothing while echoing the requested pins back as actualRxPin.

  6. zackees commented on Sep 12, 2026

    @zackees
    MemberAuthor

    Cause found, fixed in #4382. It was one field in the response I had not read.

    rxBeginError is collected by capture() and serialized on any failing pattern. On the failing inline run it says:

    inline rx=20, differs from standing:  evidence=0  rxBeginError='dma_buffer_busy'
    

    src/platforms/arm/rp/rpcommon/rp_pio_dma_resource_manager.h

    bool claimPioRxCaptureBuffer(void* owner) FL_NO_EXCEPT {
        LockGuard lock(*this);
        if (owner == nullptr || mPioRxCaptureOwner != nullptr) return false;
        mPioRxCaptureOwner = owner;
        return true;
    }

    One global owner, claimed in begin() and released only in stop(). A standing channel that has already captured once still holds it, so the temporary channel built alongside it cannot arm. setPins was never affected because it replaces mState->rx_channel — the old device is destroyed and the claim goes with it.

    That resolves the condition the three earlier rounds had isolated without explaining, and it retires both of the candidates I left open. It is the second one — "the temporary channel never being armed the way a setPins replacement is" — and the mechanism is the claim, not the arming sequence. It also explains the table exactly: every row that built a temporary channel failed, and no row that avoided building one did, because the claim is held by the standing device regardless of which pins either channel is on.

    Worth recording what went wrong in the investigation. I wrote that separating the remaining candidates "needs PIO RX state or a build that releases the standing channel first; neither is reachable from here". Both halves were wrong. The PIO RX state was already in the response — RunResult::rxBeginError exists precisely for this, populated from lastBeginError() — and I had been reading captureWaitResult, decodeOk and rawEdgesAfterWait from the same object without noticing it. Three rounds of increasingly elaborate black-box elimination went into a question one already-serialized string answered.

    The elimination work was not wasted — it is what made the mechanism obvious the moment the string appeared, and it ruled out the explanations that would otherwise have fit. But "not reachable from here" was a conclusion about the diagnostics I had not actually inventoried.

    Fix and hardware results in #4382. The bridged pair requested inline now captures 120 bytes and passes 4/4, and the standing configuration survives the call.

  7. moved this from Triage to Done in FastLED Trackeron Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions