esp32S3 : Is it possible to change pin configuration when the firmware is running ?

ThomasESP32
Posts: 281
Joined: Thu Jul 14, 2022 5:15 am

esp32S3 : Is it possible to change pin configuration when the firmware is running ?

Postby ThomasESP32 » Mon Feb 16, 2026 4:35 pm

Good afternoon,

I have a question concerning the Esp32S3 chip please.
I am working on a firmware when the pins :
IO45 -> SD-CLK
IO48 -> SD-CMD
IO47 -> SD-DAT0
IO21 -> SD-DAT1
IO14 -> SD-DAT2
IO13 -> SD-DAT3
are used in order to dialog with an external eMMC (If present).

In order to do this, I am using the following code :
===================================================================================
ExtFlash_MountCfg.format_if_mount_failed = true;
...
sdmmc_host_t host = SDMMC_HOST_DEFAULT(); // @suppress("Invalid arguments")
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); // @suppress("Invalid arguments")
slot_config.width = 4;

// On chips where the GPIOs used for SD card can be configured, set them in
// the slot_config structure:
slot_config.clk = (gpio_num_t)CONFIG_EXAMPLE_PIN_CLK;
slot_config.cmd = (gpio_num_t)CONFIG_EXAMPLE_PIN_CMD;
slot_config.d0 = (gpio_num_t)CONFIG_EXAMPLE_PIN_D0;
slot_config.d1 = (gpio_num_t)CONFIG_EXAMPLE_PIN_D1;
slot_config.d2 = (gpio_num_t)CONFIG_EXAMPLE_PIN_D2;
slot_config.d3 = (gpio_num_t)CONFIG_EXAMPLE_PIN_D3;
slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;

err = esp_vfs_fat_sdmmc_mount(MOUNT_POINT_EXTFLASH, &host, &slot_config, &ExtFlash_MountCfg, &ExtFlash);
=====================================================================================

If the eMMC card is not present, the err variable will not be OK.
In this case, is it possible to use the same pins in order to do communication over UART2 or UART0 ?
Is it possible to change the configuration of the pins so that I can used the function : Err = uart_driver_install(UART_PROD_PORT_NUM, COM_MSG_MAX_LEN, COM_MSG_MAX_LEN, 0, NULL, 0); ???

I only need two pins amont these pins in order to communicate using UART.
Are there restriction for these pins if I want to use UART0 or UART 2 ?
Can you please confirm me that the Esp32S3 chip has 3 UART modules ?

Thank you for your help,

best regards,

Thomas TRUILHE

lbernstone
Posts: 1131
Joined: Mon Jul 22, 2019 3:20 pm

Re: esp32S3 : Is it possible to change pin configuration when the firmware is running ?

Postby lbernstone » Mon Feb 16, 2026 7:26 pm

Documentation
If you use 1-bit (width=1), you don't need d2 and d3, and can use those pins, but d3 on the sdcard side must have a pull-up resistor.

Who is online

Users browsing this forum: PetalBot, Qwantbot and 3 guests