From b7d0cbcd574a6c9e281f0f93a65195d1a5fad2ff Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Fri, 15 May 2020 15:02:02 +0200 Subject: [PATCH] stm32/spi: Remove superfluous DMA stop call The DMA stream will automatically disable itself as soon as the transfer is finished. No need to do this an additional time after the transfer is finished --- cpu/stm32/periph/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/stm32/periph/spi.c b/cpu/stm32/periph/spi.c index b5434ae29a..28f4cb88b2 100644 --- a/cpu/stm32/periph/spi.c +++ b/cpu/stm32/periph/spi.c @@ -152,6 +152,7 @@ int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode) int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk) { + /* lock bus */ mutex_lock(&locks[bus]); #ifdef STM32_PM_STOP @@ -243,9 +244,8 @@ static void _transfer_dma(spi_t bus, const void *out, void *in, size_t len) dma_wait(spi_config[bus].rx_dma); dma_wait(spi_config[bus].tx_dma); - - dma_stop(spi_config[bus].tx_dma); - dma_stop(spi_config[bus].rx_dma); + /* No need to stop the DMA here, it is automatically disabled when the + * transfer is finished */ _wait_for_end(bus); }