Skip to content

SAMD forced NoPinMap toggle reads a sampler disabled by output initialization #5087

Closed

Description

@zackees

With both FASTLED_FORCE_SOFTWARE_PINS and FASTLED_NO_PINMAP defined, SAMD21/SAMD51 suppress native FastPin specializations and select ForcedSoftwarePin. Its output initialization calls the native SAMD pin API, whose Output path writes PINCFG=0. Its toggle then reads PORT.IN through digitalRead and inverts the result.

Microchip requires PINCFG.INEN for input sampling. This path disables the sampler on which its subsequent output readback depends. The matched Adafruit SAMD 1.7.16 core enables INEN for OUTPUT. This is a source/register-contract finding; no exact returned value, electrical waveform, or measured speed is claimed.

Relevant production paths:

  • src/platforms/arm/d21/fastpin_arm_d21.h and src/platforms/arm/d51/fastpin_arm_d51.h: forced selection guards.
  • src/fl/system/fastpin_base.h and src/fl/system/forced_software_pin.h: primary provider and read/invert fallback.
  • src/platforms/arm/samd/pin_samd_native.hpp: Output clears PINCFG; digitalRead reads IN.

Primary contracts: SAM D21/DA1 datasheet, PORT input sampling and PINCFG.INEN; SAM D5x/E5x datasheet DS60001507F, PINCFG.INEN.

Acceptance:

  • Preserve a supported output readback contract or use a correct output-latch/toggle operation in the real selected provider.
  • Prove actual FORCE + NO_PINMAP selection on one D21 and one D51 SDK profile. Bind actual effective physical port/pin: the current linear mapping limitation must not be hidden by assuming Arduino numbering.
  • Test initial HIGH/LOW, two successive toggles, strobe returning to the original latch, and unrelated bits. Use a realistic input-enable model and actual SDK headers.
  • Restore the old input-disable behavior and show the focused behavior oracle fails; restore the fix and retain GREEN evidence.
  • Preserve Input/InputPullup behavior and document timing/interrupt limitations. No physical or speed claim without physical evidence.

Parent #5024. Separate from #5033/#5034 native FastPin optimization and #5056 missing-map safety. Default mapped fallback is outside this specific read/invert path. SDK compilation and physical validation remain unperformed.

Activity

  1. added
    sanitized
    on Nov 6, 2026
  2. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    Status check against current master (not a fix): master's forced NoPinMap provider is fl::NoPinMapPin in src/fl/system/fastpin_no_pinmap.h. Its toggle() toggles from the last level written (sHigh ? lo() : hi()) and never calls digitalRead, so the disabled-input-sampler readback described here does not happen on master. The read/invert toggle exists only in src/fl/system/forced_software_pin.h, which open PR #5058 adds. This should be fixed (or kept from regressing) in that PR, and is left open for it. No change was made.

  3. zackees commented on Nov 9, 2026

    @zackees
    MemberAuthor

    Current-master follow-up: the premise is no longer true for the selected NoPinMap provider. Commit 118409a (PR #5137) selects NoPinMapPin when both force-software and NoPinMap are active; its toggle uses tracked output level, not digitalRead. Re-ran bash test fastpin_no_pinmap successfully (1/1). This is host/provider evidence, not SAMD electrical validation.

    There is an important pending interaction: PR #5058 proposes a different forced_software_pin.h provider whose no-map toggle reads/inverts the input sampler. That would reintroduce this concern. The remaining fix/integration obligation belongs in that PR’s provider/dispatch changes, with the existing output-level contract preserved. Leaving this issue open to track that interaction rather than adding a competing provider patch.

  4. zackees commented on Nov 10, 2026

    @zackees
    MemberAuthor

    Closing the current-master defect as resolved by the selected NoPinMapPin provider in #5137 / 118409a: toggle uses tracked output level, not the SAMD input sampler. Shared provider regression passed with bash test fastpin_no_pinmap. This is host/provider evidence, not SAMD electrical validation. As documented above, any future provider replacement in #5058 must preserve this behavior and must not reintroduce sampler-dependent output toggling.

  5. moved this from Triage to Done in FastLED Trackeron Nov 10, 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

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions