feat(sdspi): Add an option to modify wait time for MISO before sending next command

Closes https://github.com/espressif/esp-idf/issues/16909
This commit is contained in:
Adam Múdry
2025-12-16 15:43:52 +01:00
parent bf7fc0b0fb
commit 4a0db18ff1
8 changed files with 121 additions and 21 deletions
@@ -75,6 +75,10 @@ typedef struct {
0 means "active low", i.e. card is protected when the GPIO is low;
1 means "active high", i.e. card is protected when GPIO is high. */
uint16_t duty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128.
int8_t wait_for_miso; /*!< Timeout value in the driver will be waiting for MISO to be high before sending commands. Possible values are the following:
0: default value (40ms); -1: no waiting (0ms); 1-127: timeout in ms; else: invalid value, default will be used.
This can be used to speed up transactions in certain scenarios but should not be needed if correct pull-up resistors are used.
Use with care on devices where multiple SPI slaves use the same SPI bus.*/
} sdspi_device_config_t;
#define SDSPI_SLOT_NO_CS GPIO_NUM_NC ///< indicates that card select line is not used
@@ -86,14 +90,15 @@ typedef struct {
/**
* Macro defining default configuration of SD SPI device.
*/
#define SDSPI_DEVICE_CONFIG_DEFAULT() {\
#define SDSPI_DEVICE_CONFIG_DEFAULT() { \
.host_id = SDSPI_DEFAULT_HOST, \
.gpio_cs = GPIO_NUM_13, \
.gpio_cd = SDSPI_SLOT_NO_CD, \
.gpio_wp = SDSPI_SLOT_NO_WP, \
.gpio_int = GPIO_NUM_NC, \
.gpio_wp_polarity = SDSPI_IO_ACTIVE_LOW, \
.duty_cycle_pos = 0,\
.duty_cycle_pos = 0, \
.wait_for_miso = 0, \
}
/**