Skip to content

ESP32 SPI pin defaults still land on GPIO 1 (U0TXD) — only the clockless half was fixed #4022

Closed

Description

@zackees

Defect

ESP32 declares FL_PIN_CLOCKLESS_1 4 to avoid GPIO 3 (U0RXD), but declares neither SPI pin default. So clocked chipsets fall back to FL_PIN_SPI_DATA_1 1 / FL_PIN_SPI_CLOCK_1 2.

GPIO 1 is U0TXD on ESP32 classic. fastpin_esp32.h says so in the same comment that motivated the clockless fix:

NOTE: GPIO 1 & 3 commonly used for UART and may cause flashes when uploading.

So examples/Apa102 on ESP32 drives its data line onto the console's TX pin. Blink was fixed; Apa102 was not. I fixed half the bug and did not notice, because the compile sweep only built Blink.

Scope

Only ESP32 was audited at all. Every other platform still inherits 1/2 unexamined:

  • GPIO 2 is a strapping pin on ESP32 classic (and on C3, H2).
  • ESP8266 pin numbering is board-dependent -- _FL_DEFPIN(3,5) maps differently per variant.
  • AVR/Teensy/RP2040/nRF52 are probably fine because Serial is USB, but "probably" is the current state of the evidence.

Fix

  • Declare FL_PIN_SPI_DATA_1 / FL_PIN_SPI_CLOCK_1 for ESP32, avoiding UART, flash, USB-JTAG and strapping pins per variant.
  • Extend the compile sweep to build Apa102 as well as Blink, so a clocked-chipset regression is visible.

Research: whether one pair works across all ESP32 variants the way GPIO 4 did for clockless, or whether per-variant values are needed.

Follows #4018, #4019.

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