Skip to content

SAMD fl::pinMode/digitalWrite map Arduino pins to the wrong pads #5130

Closed

Description

@zackees

getPinMapping in src/platforms/arm/samd/pin_samd_native.hpp uses group=pin/32, bit=pin%32 and does not use the variant's g_APinDescription. On the Adafruit Arduino Zero variant, Arduino pin 24 is PB11 (SCK), but this drives PA24, which the variant marks as a USB pad. Pin 23 is PB10 (MOSI), but this drives PA23. PINCFG=0 also clears the wrong pad's mux. Any FastLED code calling these on SAMD can hit this; #5053's PR only removes the SAMDHardwareSPIOutput::writeBit caller. Found by reading the code and variant files; not reproduced on hardware. Proposal: resolve pins through g_APinDescription, and audit callers such as the bit-bang channel driver.

Activity

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

    @zackees
    MemberAuthor

    PR #5167 makes getPinMapping read the pad from the variant's g_APinDescription table. Pin 24 now drives PB11 and pin 23 drives PB10, confirmed in the generated samd21 code and in the linked pin table. Still open here:

    • It has not been run on hardware.
    • The callers, such as the bit-bang channel driver, have not been audited for code that assumed the old linear numbering.
  3. zackees commented on Nov 9, 2026

    @zackees
    MemberAuthor

    Verified already fixed on master by 108ff67 (PR #5167): Arduino builds use g_APinDescription in getPinMapping, and pinMode/digitalWrite/digitalRead all use that mapping. Arithmetic pin/32 mapping remains only in the bare-metal fallback. Follow-up b4d24ff (PR #5206) handles variant pins beyond PINS_COUNT. Re-ran bash test pin_samd_table_size successfully (1/1). No new source changes and no electrical validation claimed.

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