Open egnor opened 4 months ago
(I'd be happy to submit a PR to fix the comments, if that would make sense. Changing the constants, even the SPI2
and SPI3
ones, might break existing code. I could also propose adding new constants and/or objects to make things clearer.)
Board: (any) Device Description: ESP32-S2 Hardware Configuration: (any configuration that uses SPI) Version: latest master (checkout manually) IDE Name: (any) Operating System: (any) Flash frequency: (any) PSRAM enabled: (any) Upload speed: (any)
Description
At the hardware level, the ESP32-S2 has four SPI buses: SPI0, SPI1, SPI2, SPI3. SPI0 and SPI1 are (mostly) reserved for flash I/O, SPI2 and SPI3 are available for user use.
In arduino-esp32, ESP32-S2 SPI buses are labeled as follows:
These constants are used as indexes into
_spi_bus_array[]
in the HAL:So this means that
FSPI
is actually SPI2, not SPI1 as commentedHSPI
is actually SPI3, not SPI2 as commentedSPI2
is actually SPI3SPI3
is off the end of the arrayBasically everything is off by one. The default is to use
FSPI
:So that will actually work, but the situation is confusing and mislabeled, particularly if anyone tries to use the
SPI2
orSPI3
constants. (And why aren't the numeric values lined up with ESP data sheets anyway? (Also this whole FSPI/HSPI/VSPI nonsense is just silly.))I have checked existing issues, online documentation and the Troubleshooting Guide