Overrun flag when using SPI in interrupt mode (HAL_SPI_Receive_IT())
Hello,
I'm reading data from an external device using SPI in Receive Only Master mode. For this, I'm using the HAL function HAL_SPI_Receive_IT(), which as its name suggests doesn't use DMA, but is non-blocking and calls HAL_SPI_RxCpltCallback() when it's done and my buffer holds the number of bytes I asked for.
Everything runs fine at 10Mbits/s, but when I increase the speed to 12Mbits/s (the external device supports up to 20Mbits/s SPI, and my STM32H750 runs at 400MHz SYSCLK), I start getting overruns (HAL_SPI_ErrorCallback() is called and I see that the OVR flag in the SPI SR is set). I'm always waiting until HAL_SPI_RxCpltCallback() or HAL_SPI_ErrorCallback() get called before starting a new transfer, and hspi1.State is HAL_SPI_STATE_READY when I start it. I don't understand what could cause an overrun.
From the STM32H750 reference manual:
"An overrun condition occurs when data are received by a master or slave and the RxFIFO
has not enough space to store these received data. This can happen if the software or the
DMA did not have enough time to read the previously received data (stored in the RxFIFO)."
As mentioned I'm not using DMA. And the buffer I give to HAL_SPI_Receive_IT() is allocated big enough to hold the data. What can cause this overrun?
Thank you for your help
