Merge branch 'feat/c5_sdio' into 'master'

sdio: supported on c5

Closes IDF-12655 and IDF-12641

See merge request espressif/esp-idf!38652
This commit is contained in:
Armando (Dou Yiwen)
2025-05-01 11:52:21 +08:00
43 changed files with 857 additions and 145 deletions

View File

@@ -47,6 +47,13 @@ menu "Example Configuration"
If the example does not work, please try disabling the HS mode.
config EXAMPLE_SDIO_HOST_DELAY
int "SDIO Host Delay"
range 0 5
default 0
help
SDIO Host delay phase
config EXAMPLE_ADJUSTABLE_PIN
bool
default EXAMPLE_SDIO_OVER_SPI || SOC_SDMMC_USE_GPIO_MATRIX
@@ -55,36 +62,42 @@ menu "Example Configuration"
int "CMD (MOSI) GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 4 if IDF_TARGET_ESP32P4
default 15
config EXAMPLE_PIN_CLK
int "CLK GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 33 if IDF_TARGET_ESP32P4
default 14
config EXAMPLE_PIN_D0
int "D0 (MISO) GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 32 if IDF_TARGET_ESP32P4
default 2
config EXAMPLE_PIN_D1
int "D1 (INTR) GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 23 if IDF_TARGET_ESP32P4
default 4
config EXAMPLE_PIN_D2
int "D2 GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 53 if IDF_TARGET_ESP32P4
default 12
config EXAMPLE_PIN_D3
int "D3 (CS) GPIO number"
depends on EXAMPLE_ADJUSTABLE_PIN
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 5 if IDF_TARGET_ESP32P4
default 13
choice EXAMPLE_SLAVE
@@ -100,11 +113,11 @@ menu "Example Configuration"
endchoice
config EXAMPLE_SLAVE_PWR_NEGTIVE_ACTIVE
bool "Slave power control pin is negtive active, otherwise postive active"
bool "Slave power control pin is negative active, otherwise positive active"
depends on !EXAMPLE_SLAVE_NONE
default n
help
Slave power control pin is negtive active, otherwise postive active
Slave power control pin is negative active, otherwise positive active
config EXAMPLE_NO_INTR_LINE
bool "The host is not connected to the interrupt line (DAT1) of slave"

View File

@@ -78,12 +78,12 @@
- 0 is the register to hold tasks. Bits:
- 0: the slave should reset.
- 1: the slave should send interrupts.
- 2: the slave should write the shared registers acoording to the value in register 1.
- 2: the slave should write the shared registers according to the value in register 1.
- 1 is the register to hold test value.
- other registers will be written by the slave for testing.
- FIFO:
The receving FIFO is size of 256 bytes.
The receiving FIFO is size of 256 bytes.
When the host writes something to slave recv FIFO, the slave should return it as is to the sending FIFO.
The example works as following process:
@@ -190,6 +190,7 @@ esp_err_t slave_init(essl_handle_t* handle)
ESP_LOGI(TAG, "Probe using SD 1-bit...");
config.flags = SDMMC_HOST_FLAG_1BIT;
#endif
config.input_delay_phase = CONFIG_EXAMPLE_SDIO_HOST_DELAY;
#ifdef CONFIG_EXAMPLE_SDIO_HIGHSPEED
config.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
@@ -440,7 +441,7 @@ void job_fifo(essl_handle_t handle)
/* CAUTION: This example shows that we can send random length of packet to the slave.
* However it takes time of two transactions if the length is not multiples of 4 bytes.
* e.g. sending 6 bytes is done by sending 4 + 2 bytes each transaction.
* Try to avoid unaligned packets if possible to get higher effeciency.
* Try to avoid unaligned packets if possible to get higher efficiency.
*/
for (int i = 0; i < sizeof(packet_len) / sizeof(int); i++) {
//Prepare data to send. The length can be random, but data should start at the 32-bit boundary.

View File

@@ -0,0 +1,2 @@
## On P4-SDMMC + C5 SDIO test runner environment, hardware delay needs to be considered
CONFIG_EXAMPLE_SDIO_HOST_DELAY=2

View File

@@ -1,4 +1,4 @@
| Supported Targets | ESP32 | ESP32-C6 |
| ----------------- | ----- | -------- |
| Supported Targets | ESP32 | ESP32-C5 | ESP32-C6 |
| ----------------- | ----- | -------- | -------- |
See README.md in the parent folder