cancel
Showing results for 
Search instead for 
Did you mean: 

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.

TBao.16
Associate

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().

  1. when send the first byte, RXNE in SR is not set.
  2. After send the first byte, MCU receives a byte at the same time. RXNE in SR is not set.
  3. 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

0 REPLIES 0