2017-11-03 05:26 AM
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 ?
2017-11-03 10:40 AM
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)