Skip to content

Commit 0b1b549

Browse files
committed
[bsp][stm32f429-apollo] Disable the SPI DMA mode. It has some problem when using big data transmission.
1 parent 62ed2b9 commit 0b1b549

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bsp/stm32f429-apollo/drivers/drv_spi.c

+4
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ struct stm32f4_spi stm32f4_spi5 =
526526
/* .spi_handle = */{
527527
/* .Instance = */ SPI5,
528528
},
529+
#ifdef SPI_USE_DMA
529530
/* .hdma_rx = */ {
530531
DMA2_Stream3,
531532
DMA_CHANNEL_2,
@@ -537,6 +538,7 @@ struct stm32f4_spi stm32f4_spi5 =
537538
DMA_CHANNEL_2,
538539
},
539540
/* .hdma_tx_irq = */ DMA2_Stream4_IRQn,
541+
#endif /* SPI_USE_DMA */
540542
};
541543

542544
static struct rt_spi_bus spi5_bus;
@@ -703,6 +705,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
703705
return RT_ENOSYS;
704706
}
705707

708+
#ifdef SPI_USE_DMA
706709
/* Configure the DMA handler for Transmission process */
707710
p_spi_bus->hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
708711
p_spi_bus->hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
@@ -727,6 +730,7 @@ rt_err_t stm32_spi_bus_register(SPI_TypeDef * SPI,
727730
p_spi_bus->hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
728731
p_spi_bus->hdma_rx.Init.MemBurst = DMA_MBURST_INC4;
729732
p_spi_bus->hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4;
733+
#endif /* SPI_USE_DMA */
730734

731735
spi_bus->parent.user_data = &stm32f4_spi5;
732736

bsp/stm32f429-apollo/drivers/drv_spi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include "stm32f4xx_hal.h"
2222

23-
#define SPI_USE_DMA
23+
//#define SPI_USE_DMA
2424

2525
struct stm32f4_spi
2626
{

0 commit comments

Comments
 (0)