How to flush SPI buffer when using SPI over DMA.
I am using STM32G071RBTx on our custom boards. The controller is connected to a Beaglebone Black over SPI. The STM32 controller is working as an SPI slave and the Beaglebone as the master. There are not CS lines defined for the communication. FreeRTOS with CMSIS_V2 is used as middleware. The highest priority task polls the SPI lines over DMA for any incoming command. Sometimes the SPI messages are not in sync. They get shifted by a few bytes and a flush of the buffer is required. I am trying to use the HAL_SPIEx_FlushRxFifo API to flush the Rx buffer for any out of sync message. But it does not seem to work. I don't know if it works when I am using SPI over DMA? Any suggestions on how to flush the SPI is welcome.
