Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion targets/ESP32/_common/ESP32_S3_DeviceMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
// 2 devices
// Map pins mosi, miso, clock
//
int8_t Esp32_SPI_DevicePinMap[MAX_SPI_DEVICES][Esp32SpiPin_Max] = {{-1, -1, -1}, {-1, -1, -1}};
int8_t Esp32_SPI_DevicePinMap[MAX_SPI_DEVICES][Esp32SpiPin_Max] ={
// SPI1
{GPIO_NUM_11, GPIO_NUM_13, GPIO_NUM_12},
// SPI2 - no pins assigned
{-1, -1, -1}};
Comment on lines +14 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Critical: GPIO pin conflict detected between SPI1 and SDMMC1 mappings.

The assigned SPI1 pins conflict with the SDMMC1 configuration:

  • GPIO_NUM_12: Used as SPI1 Clock (line 16) and SDMMC1 D2 (line 82)
  • GPIO_NUM_13: Used as SPI1 MISO (line 16) and SDMMC1 D3 (line 82)

This will cause hardware conflicts if both peripherals are used simultaneously.

Consider using alternative GPIO pins for SPI1 that don't conflict with other peripherals. Run this script to verify available GPIO options for ESP32-S3:

Please verify that these pin assignments don't create conflicts with existing SDMMC functionality and consider using alternative GPIO pins.


🏁 Script executed:

#!/bin/bash
# Description: Check ESP32-S3 GPIO usage and conflicts in device mappings

echo "=== Analyzing GPIO pin conflicts in ESP32-S3 device mappings ==="

# Search for GPIO_NUM_12 and GPIO_NUM_13 usage across all device mappings
echo "GPIO_NUM_12 usage:"
rg "GPIO_NUM_12" --type cpp targets/ESP32/_common/ESP32_S3_DeviceMapping.cpp -n

echo -e "\nGPIO_NUM_13 usage:"
rg "GPIO_NUM_13" --type cpp targets/ESP32/_common/ESP32_S3_DeviceMapping.cpp -n

# Look for ESP32-S3 GPIO definitions to suggest alternatives
echo -e "\n=== Searching for available GPIO definitions ==="
rg "GPIO_NUM_[0-9]+" --type cpp targets/ESP32/ -A 2 -B 2 | head -20

Length of output: 2635


SPI1 pin mapping conflicts with SDMMC1 – update to non-overlapping GPIOs

The current SPI1 mapping in targets/ESP32/_common/ESP32_S3_DeviceMapping.cpp (around line 16):

// SPI1
{ GPIO_NUM_11, GPIO_NUM_13, GPIO_NUM_12 },

overlaps with the SDMMC1 D2/D3 pins at line 82:

{ GPIO_NUM_14, GPIO_NUM_15, GPIO_NUM_2, GPIO_NUM_4, GPIO_NUM_12, GPIO_NUM_13 },
                       …           D2=GPIO_NUM_12, D3=GPIO_NUM_13

If both SPI and SDMMC are ever used, this will cause hardware conflicts.
A quick fix is to use the module’s default SPI1 pins (as seen in cpu_spi.cpp):

- { GPIO_NUM_11, GPIO_NUM_13, GPIO_NUM_12 },
+ { GPIO_NUM_23, GPIO_NUM_25, GPIO_NUM_19 }, // MOSI, MISO, CLK

• Verify that GPIO 23, 25, 19 are free on your ESP32-S3 board
• Update any documentation or examples to reflect the new mapping
• Run hardware tests to ensure both SPI and SDMMC operate correctly without overlap

🤖 Prompt for AI Agents
In targets/ESP32/_common/ESP32_S3_DeviceMapping.cpp around lines 14 to 18, the
SPI1 pin mapping uses GPIO_NUM_11, GPIO_NUM_13, and GPIO_NUM_12, which conflicts
with SDMMC1 pins GPIO_NUM_12 and GPIO_NUM_13. To fix this, update the SPI1 pins
to the module’s default non-overlapping pins such as GPIO_NUM_23, GPIO_NUM_25,
and GPIO_NUM_19 after verifying these pins are free on your ESP32-S3 board.
Also, update any related documentation or examples to reflect this change and
run hardware tests to confirm both SPI and SDMMC work without conflicts.


// Serial
// 2 devices COM1,COM2 ( UART_NUM_0, UART_NUM_1 )
Expand Down