From c0695e4216f53ccb37d615e640b3e6c5d894fdcf Mon Sep 17 00:00:00 2001 From: SalimTerryLi Date: Wed, 6 Oct 2021 14:22:03 +0800 Subject: [PATCH] example/storage: fix incorrect SDSPI DMA setting on c3 Closes https://github.com/espressif/esp-idf/issues/7389 --- examples/storage/sd_card/main/sd_card_example_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/storage/sd_card/main/sd_card_example_main.c b/examples/storage/sd_card/main/sd_card_example_main.c index d669f15b17..83fdf17ba2 100644 --- a/examples/storage/sd_card/main/sd_card_example_main.c +++ b/examples/storage/sd_card/main/sd_card_example_main.c @@ -33,12 +33,18 @@ static const char *TAG = "example"; // #define USE_SPI_MODE // ESP32-S2 and ESP32-C3 doesn't have an SD Host peripheral, always use SPI: -#if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 + #ifndef USE_SPI_MODE #define USE_SPI_MODE #endif // USE_SPI_MODE // on ESP32-S2, DMA channel must be the same as host id +#if CONFIG_IDF_TARGET_ESP32S2 #define SPI_DMA_CHAN host.slot +#elif CONFIG_IDF_TARGET_ESP32C3 +#define SPI_DMA_CHAN SPI_DMA_CH_AUTO +#endif //CONFIG_IDF_TARGET_ESP32S2 + #endif //CONFIG_IDF_TARGET_ESP32S2 // DMA channel to be used by the SPI peripheral