cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f1xx SPI DMA reset

Curtis.Allen
Associate II
Posted on January 07, 2016 at 21:05

Hello,

I am having difficulty recovering from failed SPI transfers when using DMA. It appears that the DMA controller maintains the state of the failed transfer and tries to complete the operation when the next transaction is started. The only way I have found to fix this problem is to reset the processor! The new DMA configuration is ignored. I do not see a DMA channel reset in the user manual. Disable/Enable the SPI interface does not clear the problem.

How do you recover from an interrupted SPI transfer when using DMA?

TIA

#dma #spi #stm32f1
2 REPLIES 2
jpeacock
Associate II
Posted on January 08, 2016 at 15:24

Before making any change to DMA registers you have to disable the DMA channel, not the SPI channel (but you should stop SPI too).  After a fault disable the DMA channel and reprogram the DMA registers before enabling the channel again.

Posted on January 08, 2016 at 17:24

DMA_DeInit() doesn't work?

How about resetting the peripheral on the AHB?

  RCC_AHBPeriphResetCmd(RCC_AHBPeriph_DMA1, ENABLE);

  RCC_AHBPeriphResetCmd(RCC_AHBPeriph_DMA1, DISABLE);

Or disassociating the DMA Rx/Tx on the SPI while you set things up

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..