Question
I use SPI in interrupt mode with HAL_SPI_TransmitReceive_IT(). In SPI ISR, transmitting routine is invoked. But receiving routine is never be invoked.
I use STM32F407IGT6 as a SPI master.
I use SPI in interrupt mode with HAL_SPI_TransmitReceive_IT(). In ISR HAL_SPI_IRQHandler(), hspi->TxISR(hspi); is always executed while hspi->RxISR(hspi); is never executed.
I traced down in HAL_SPI_IRQHandler().
- when send the first byte, RXNE in SR is not set.
- After send the first byte, MCU receives a byte at the same time. RXNE in SR is not set.
- Goes to HAL_SPI_IRQHandler(), RXNE is still set. But EXNE is cleared whenever check if(SPI_CHECK_FLAG(itflag, SPI_FLAG_OVR) == RESET). That's why hspi->RxISR(hspi); is never be executed.
According to the STM32F407 reference manual, "Clearing the RXNE bit is performed by reading the SPI_DR register". Why if(SPI_CHECK_FLAG(itflag, SPI_FLAG_OVR) == RESET) clear RXNE?
Is there any setting I need to do?
Best regards,
Bao Tong
