STATE SPI READY - HAL Driver
Hello,
I am working on a code that uses the HAL library for SPI communication. But I have a problem with SPI's state-checking routine.
void libera_escrita(void)
{
SPI_TxBuffer[0] = 6;
HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_RESET);
while (HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);
HAL_SPI_TransmitReceive_IT(&hspi1, (uint8_t*)SPI_TxBuffer, (uint8_t *)SPI_RxBuffer, 1);
while (HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);
HAL_GPIO_WritePin(GPIOC, CS_Pin, GPIO_PIN_SET);
}
My code stays in that while, what could be causing this?