feat(usb_device): Add SDMMC support for MSC USB Device example for esp32s31 target

- Added CI build of the MSC device example with SDMMC config
This commit is contained in:
peter.marcisovsky
2026-07-16 10:19:44 +02:00
parent cc979db24b
commit 63c49d432d
5 changed files with 76 additions and 20 deletions
@@ -13,7 +13,7 @@ menu "TinyUSB MSC Example Configuration"
config EXAMPLE_STORAGE_MEDIA_SDMMC
bool "SDMMC CARD"
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4 || IDF_TARGET_ESP32S31
endchoice
if EXAMPLE_STORAGE_MEDIA_SDMMC
@@ -79,19 +79,21 @@ menu "TinyUSB MSC Example Configuration"
endif # SOC_SDMMC_USE_GPIO_MATRIX
config EXAMPLE_SD_PWR_CTRL_LDO_INTERNAL_IO
depends on SOC_SDMMC_IO_POWER_EXTERNAL
depends on SOC_SDMMC_IO_POWER_EXTERNAL || SOC_SDMMC_IO_UHS_POWER_EXTERNAL
bool "SDMMC powered by internal LDO"
default y
help
Enable when internal LDO of ESP32-P4 is used as a power supply for SD card. Specify the LDO IO.
Enable when internal LDO of an ESP32 is used as a power supply for SD card. Specify the LDO IO.
Disable when external power supply is used as a power supply for SD card.
config EXAMPLE_SD_PWR_CTRL_LDO_IO_ID
depends on SOC_SDMMC_IO_POWER_EXTERNAL && EXAMPLE_SD_PWR_CTRL_LDO_INTERNAL_IO
depends on SOC_SDMMC_IO_POWER_EXTERNAL || SOC_SDMMC_IO_UHS_POWER_EXTERNAL
depends on EXAMPLE_SD_PWR_CTRL_LDO_INTERNAL_IO
int "LDO IO"
default 4 if IDF_TARGET_ESP32P4
default 1 if IDF_TARGET_ESP32S31
help
There are several IOs in ESP32-P4 which are in "SD card IO" power domain.
There are several IOs in ESP32 SD card capable targets which are in "SD card IO" power domain.
Power has to be supplied to this power domain externally (from outside the chip) via one of the pins.
Based on the schematic, specify the LDO IO pin.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -375,6 +375,11 @@ static esp_err_t storage_init_sdmmc(sdmmc_card_t **card)
host.pwr_ctrl_handle = pwr_ctrl_handle;
#endif
#if SOC_SDMMC_IO_UHS_POWER_EXTERNAL
//for uhs-i power
host.io_voltage = 1.8f;
#endif
// This initializes the slot without card detect (CD) and write protect (WP) signals.
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();