Skip to main content
MADHUSUDAN G
Visitor II
November 3, 2017
Question

STM32F405RGT SPI Slave DMA Over-run

  • November 3, 2017
  • 1 reply
  • 587 views
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 ? 

    This topic has been closed for replies.

    1 reply

    S.Ma
    Principal
    November 3, 2017
    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)