How to flush Tx/Rx FIFOs in SPI DMA
What is the procedure to flush Tx and Rx FIFOs when using SPI DMA in STM32H563ZI?
What is the procedure to flush Tx and Rx FIFOs when using SPI DMA in STM32H563ZI?
My master uses the SS pin (active low) to start and stop the SPI transfers. So, I configure the SS pin as a rising edge interrupt GPIO on the slave and if there's any data left on TX/Rx DMA channels, I abort the SPI.
void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_15)
{
if (READ_BIT(hDMASPIRx.Instance->CBR1, DMA_CBR1_BNDT) > 0 ||
READ_BIT(hDMASPITx.Instance->CBR1, DMA_CBR1_BNDT) > 0)
{
HAL_SPI_Abort(&hSPI);
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.