Why SPI returns busy after a while of sending correctly?
- June 9, 2021
- 3 replies
- 9475 views
Hello ST community,
I use a STM32F767ZI-Nucleo. There is a timer generating interrupts every 20ms. If a timer interrupt occurs I use HAL_SPI_Transmit_DMA to send some data. I monitor the return value of this function and after some time of sending without any failure the return value is HAL_BUSY (I toggle an GPIO pin if this occurs). I also use the HAL_SPI_TxCpltCallback where I toggle another GPIO to monitor when the SPI transfer is completed.
I noticed that sometimes the HAL_SPI_TxCpltCallback is not reached after a transmission. At the next trasmission I get a HAL_BUSY and also the data is corrupted.
In pic1.png you can see what I monitored with a logic analyzer.
pic2.png shows the SPI trasmission where no HAL_SPI_TxCpltCallback is reached.
pic3.png is the next trasmission after that which returns HAL_BUSY and contains the corrupted data. There you can see anohter phenomenon. The TxCpltCallback occurs during the transmission.
In pic4.png you can see how a normal or correct transmission looks like.
Is there anyone who has an idea why my SPI is sometimes busy and therefore the data is corrupted?
