From e9bbe44d19ebff68a5a36f7f9e4cc7ff27a4119e Mon Sep 17 00:00:00 2001 From: Armando Date: Mon, 7 Mar 2022 12:29:46 +0800 Subject: [PATCH] spi_master: fix master HD mode cannot correctly receive data issue when using DMA --- components/soc/src/hal/spi_hal_iram.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/soc/src/hal/spi_hal_iram.c b/components/soc/src/hal/spi_hal_iram.c index 57f5607853..6669654017 100644 --- a/components/soc/src/hal/spi_hal_iram.c +++ b/components/soc/src/hal/spi_hal_iram.c @@ -125,12 +125,15 @@ void spi_hal_prepare_data(const spi_hal_context_t *hal) lldesc_setup_link(hal->dmadesc_rx, hal->rcv_buffer, ((hal->rx_bitlen + 7) / 8), true); spi_ll_rxdma_start(hw, hal->dmadesc_rx); } - } else { + } +#if CONFIG_IDF_TARGET_ESP32 + else { //DMA temporary workaround: let RX DMA work somehow to avoid the issue in ESP32 v0/v1 silicon - if (hal->dma_enabled) { + if (hal->dma_enabled && !hal->half_duplex) { spi_ll_rxdma_start(hw, 0); } } +#endif if (hal->send_buffer) { if (!hal->dma_enabled) {