2020-08-11 03:52 AM
There is a bug in the IRQHandler function that causes the callbacks associated not being correctly called.
hspi->State = HAL_SPI_STATE_READY;
if (hspi->ErrorCode != HAL_SPI_ERROR_NONE)
{
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1UL)
hspi->ErrorCallback(hspi);
#else
HAL_SPI_ErrorCallback(hspi);
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
return;
}
}
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1UL)
/* Call appropriate user callback */
if (State == HAL_SPI_STATE_BUSY_TX_RX)
{
hspi->TxRxCpltCallback(hspi);
}
else if (State == HAL_SPI_STATE_BUSY_RX)
{
hspi->RxCpltCallback(hspi);
}
else if (State == HAL_SPI_STATE_BUSY_TX)
{
hspi->TxCpltCallback(hspi);
}
#else
/* Call appropriate user callback */
if (State == HAL_SPI_STATE_BUSY_TX_RX)
{
HAL_SPI_TxRxCpltCallback(hspi);
}
else if (State == HAL_SPI_STATE_BUSY_RX)
{
HAL_SPI_RxCpltCallback(hspi);
}
else if (State == HAL_SPI_STATE_BUSY_TX)
{
HAL_SPI_TxCpltCallback(hspi);
}
else
{
/* end of the appropriate call */
}
When entering the IRQHandler, the "State" Variable is always "HAL_SPI_STATE_READY" therefore the callback functions are not called.