cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405RGT SPI Slave DMA Over-run

MADHUSUDAN  G
Associate
Posted on November 03, 2017 at 13:26

We have STM32F405RGT SPI-3 configured as a slave to receive the data from the master using HAL drivers. The DMA is configured to receive 128 bytes of data from the master in Normal mode and the NSS is managed by the master. The slave is able to receive the configured number of bytes the first time and invoke DMA Rx complete callback function. However in the subsequent Rx, it is causing a over-run. 

Also when the DMA mode is set to Circular, it doesn't seem to over-run.

Could you kindly help us in understanding what is causing this behaviour ? 

1 REPLY 1
S.Ma
Principal
Posted on November 03, 2017 at 18:40

It is better to make a system that works whatever the number of bytes.

Use EXTI on the NSS rise and fall edge to capture how many bytes were received by the DMA. It only requires that you keep enough time when NSS is high for the interrupt to process the received block. To make the SW simple, we assume there is only one slave and there is no SCK pulses when NSS is high (or the DMA will also capture them if NSS is by SW)