HAL_SPI_TransmitReceive_IT(...) forgets to __HAL_UNLOCK(hspi) before __HAL_SPI_ENABLE_IT(hspi, ...)
This occasionally leads to (especially if only transferring one byte) the interrupt executing before the function has unlocked the process, leading to the function returning HAL_BUSY if you were to attempt to initiate another transfer in the transfer complete callback.
Same goes for HAL_SPI_Transmit_IT(...) and HAL_SPI_Receive_IT(...).
HAL_SPI_Receive_IT(...) even has this comment:
/* Note : The SPI must be enabled after unlocking current process
to avoid the risk of SPI interrupt handle execution before current
process unlock */
but then proceeds to not follow its own advice. So I think the unlock was accidentally removed at some point.
This bug is present in latest versions of STM32F0, STM32F4, STM32L0, STM32L4 firmwares at the very least.
