Skip to content

Commit 081e554

Browse files
r3wretrhyGUIDINGLI
authored andcommitted
arch/xtensa/esp32s3: Make SPI CS, MOSI and MISO pins signed.
The CS, MOSI and MISO pins can be set to -1 in Kconfig when the board does not use them, and esp32s3_spi_init() skips a pin when it is negative. The pins are stored as uint8_t in esp32s3_spi_config_s, so -1 becomes 255, every "pin >= 0" check is always true, and 255 is passed to esp_gpiowrite() and esp_configgpio(), which trips their DEBUGASSERT. Store these three pins as int8_t so -1 is kept and the existing checks work. Fixes apache/nuttx#20186 Assisted-by: Grok Bot Signed-off-by: Zhaoqi Xu <[email protected]>
1 parent 6189fef commit 081e554

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/xtensa/src/esp32s3/esp32s3_spi.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ struct esp32s3_spi_config_s
124124
enum spi_mode_e mode; /* SPI default mode */
125125

126126
uint8_t id; /* ESP32-S3 SPI device ID: SPIx {2,3} */
127-
uint8_t cs_pin; /* GPIO configuration for CS */
128-
uint8_t mosi_pin; /* GPIO configuration for MOSI */
129-
uint8_t miso_pin; /* GPIO configuration for MISO */
127+
int8_t cs_pin; /* GPIO configuration for CS */
128+
int8_t mosi_pin; /* GPIO configuration for MOSI */
129+
int8_t miso_pin; /* GPIO configuration for MISO */
130130
uint8_t clk_pin; /* GPIO configuration for CLK */
131131
#ifdef CONFIG_ESP32S3_SPI_DMA
132132
uint8_t periph; /* Peripheral ID */

0 commit comments

Comments
 (0)