Skip to content

Commit 30f9814

Browse files
committed
Merge branch 'fix/slot0_requires_all_pins_in_1bit_mode_issue' into 'master'
sd: fixed all pins need to be set when using slot0 on esp32p4 issue Closes IDF-12816 See merge request espressif/esp-idf!39197
2 parents 22f6319 + ad98c1d commit 30f9814

File tree

2 files changed

+55
-74
lines changed

2 files changed

+55
-74
lines changed

components/esp_driver_sdmmc/src/sd_host_sdmmc.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,14 +1190,21 @@ static esp_err_t sdmmc_slot_io_config(sd_host_sdmmc_slot_t *slot, const sd_host_
11901190

11911191
if (slot_id == 0) {
11921192
#if !SDMMC_LL_SLOT_SUPPORT_GPIO_MATRIX(0)
1193-
if (use_gpio_matrix &&
1194-
SDMMC_SLOT0_IOMUX_PIN_NUM_CLK == io_config->clk_io &&
1195-
SDMMC_SLOT0_IOMUX_PIN_NUM_CMD == io_config->cmd_io &&
1196-
SDMMC_SLOT0_IOMUX_PIN_NUM_D0 == io_config->d0_io &&
1197-
SDMMC_SLOT0_IOMUX_PIN_NUM_D1 == io_config->d1_io &&
1198-
SDMMC_SLOT0_IOMUX_PIN_NUM_D2 == io_config->d2_io &&
1199-
SDMMC_SLOT0_IOMUX_PIN_NUM_D3 == io_config->d3_io) {
1200-
use_gpio_matrix = false;
1193+
if (use_gpio_matrix) {
1194+
if (slot_width >= 1) {
1195+
if (SDMMC_SLOT0_IOMUX_PIN_NUM_CLK == io_config->clk_io && SDMMC_SLOT0_IOMUX_PIN_NUM_CMD == io_config->cmd_io && SDMMC_SLOT0_IOMUX_PIN_NUM_D0 == io_config->d0_io) {
1196+
use_gpio_matrix = false;
1197+
} else {
1198+
use_gpio_matrix = true;
1199+
}
1200+
}
1201+
if (slot_width >= 4) {
1202+
if (SDMMC_SLOT0_IOMUX_PIN_NUM_D1 == io_config->d1_io && SDMMC_SLOT0_IOMUX_PIN_NUM_D2 == io_config->d2_io && SDMMC_SLOT0_IOMUX_PIN_NUM_D3 == io_config->d3_io) {
1203+
use_gpio_matrix = false;
1204+
} else {
1205+
use_gpio_matrix = true;
1206+
}
1207+
}
12011208
} else {
12021209
ESP_RETURN_ON_FALSE(!use_gpio_matrix, ESP_ERR_INVALID_ARG, TAG, "doesn't support routing from GPIO matrix, driver uses dedicated IOs");
12031210
}

examples/storage/sd_card/sdmmc/main/Kconfig.projbuild

Lines changed: 40 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -47,84 +47,58 @@ menu "SD/MMC Example Configuration"
4747
depends on SOC_SDMMC_UHS_I_SUPPORTED
4848
endchoice
4949

50-
if SOC_SDMMC_USE_GPIO_MATRIX
51-
52-
config EXAMPLE_PIN_CMD
53-
int "CMD GPIO number"
54-
default 35 if IDF_TARGET_ESP32S3
55-
default 44 if IDF_TARGET_ESP32P4
56-
57-
config EXAMPLE_PIN_CLK
58-
int "CLK GPIO number"
59-
default 36 if IDF_TARGET_ESP32S3
60-
default 43 if IDF_TARGET_ESP32P4
50+
config EXAMPLE_PIN_CMD
51+
int
52+
prompt "CMD GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
53+
default 35 if IDF_TARGET_ESP32S3
54+
default 44 if IDF_TARGET_ESP32P4
55+
default 15 if IDF_TARGET_ESP32
56+
57+
config EXAMPLE_PIN_CLK
58+
int
59+
prompt "CLK GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
60+
default 36 if IDF_TARGET_ESP32S3
61+
default 43 if IDF_TARGET_ESP32P4
62+
default 14 if IDF_TARGET_ESP32
63+
64+
config EXAMPLE_PIN_D0
65+
int
66+
prompt "D0 GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
67+
default 37 if IDF_TARGET_ESP32S3
68+
default 39 if IDF_TARGET_ESP32P4
69+
default 2 if IDF_TARGET_ESP32
6170

62-
config EXAMPLE_PIN_D0
63-
int "D0 GPIO number"
64-
default 37 if IDF_TARGET_ESP32S3
65-
default 39 if IDF_TARGET_ESP32P4
71+
if EXAMPLE_SDMMC_BUS_WIDTH_4
6672

67-
if EXAMPLE_SDMMC_BUS_WIDTH_4
73+
config EXAMPLE_PIN_D1
74+
int
75+
prompt "D1 GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
76+
default 38 if IDF_TARGET_ESP32S3
77+
default 40 if IDF_TARGET_ESP32P4
78+
default 4 if IDF_TARGET_ESP32
6879

69-
config EXAMPLE_PIN_D1
70-
int "D1 GPIO number"
71-
default 38 if IDF_TARGET_ESP32S3
72-
default 40 if IDF_TARGET_ESP32P4
7380

74-
config EXAMPLE_PIN_D2
75-
int "D2 GPIO number"
76-
default 33 if IDF_TARGET_ESP32S3
77-
default 41 if IDF_TARGET_ESP32P4
81+
config EXAMPLE_PIN_D2
82+
int
83+
prompt "D2 GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
84+
default 33 if IDF_TARGET_ESP32S3
85+
default 41 if IDF_TARGET_ESP32P4
86+
default 12 if IDF_TARGET_ESP32
7887

79-
config EXAMPLE_PIN_D3
80-
int "D3 GPIO number"
81-
default 34 if IDF_TARGET_ESP32S3
82-
default 42 if IDF_TARGET_ESP32P4
8388

84-
endif # EXAMPLE_SDMMC_BUS_WIDTH_4
89+
config EXAMPLE_PIN_D3
90+
int
91+
prompt "D3 GPIO number" if SOC_SDMMC_USE_GPIO_MATRIX
92+
default 34 if IDF_TARGET_ESP32S3
93+
default 42 if IDF_TARGET_ESP32P4
94+
default 13 if IDF_TARGET_ESP32
8595

86-
endif # SOC_SDMMC_USE_GPIO_MATRIX
96+
endif # EXAMPLE_SDMMC_BUS_WIDTH_4
8797

8898
config EXAMPLE_DEBUG_PIN_CONNECTIONS
8999
bool "Debug sd pin connections and pullup strength"
90100
default n
91101

92-
if !SOC_SDMMC_USE_GPIO_MATRIX
93-
config EXAMPLE_PIN_CMD
94-
int
95-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
96-
default 15 if IDF_TARGET_ESP32
97-
98-
config EXAMPLE_PIN_CLK
99-
int
100-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
101-
default 14 if IDF_TARGET_ESP32
102-
103-
config EXAMPLE_PIN_D0
104-
int
105-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
106-
default 2 if IDF_TARGET_ESP32
107-
108-
if EXAMPLE_SDMMC_BUS_WIDTH_4
109-
110-
config EXAMPLE_PIN_D1
111-
int
112-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
113-
default 4 if IDF_TARGET_ESP32
114-
115-
config EXAMPLE_PIN_D2
116-
int
117-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
118-
default 12 if IDF_TARGET_ESP32
119-
120-
config EXAMPLE_PIN_D3
121-
int
122-
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS
123-
default 13 if IDF_TARGET_ESP32
124-
125-
endif # EXAMPLE_SDMMC_BUS_WIDTH_4
126-
endif
127-
128102
config EXAMPLE_ENABLE_ADC_FEATURE
129103
bool "Enable ADC feature"
130104
depends on EXAMPLE_DEBUG_PIN_CONNECTIONS

0 commit comments

Comments
 (0)