HAL_SPI_TransmitReceive_IT is not calling HAL_SPI_TxRxCpltCallback
Hello everyone,
I am having a bit of trouble with the SPI communication between two STM32L053R8 boards.
I have a master who is sending 15 bytes every second to the slave. The slave must also return 15 Bytes.
Tha master works properly and I confirmed it with a logic analyzer.
In the slave I enabled the SPI global interrupt (via Cube) and I have the following code:
uint8_t dataTxSlave[15]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
uint8_t dataRxSlave[15]={0};int main(void)
{HAL_Init();
SystemClock_Config(); MX_GPIO_Init(); MX_USART2_UART_Init(); MX_SPI1_Init(); while (1) { HAL_SPI_TransmitReceive_IT(&hspi1, (uint8_t*) dataTxSlave, (uint8_t*) dataRxSlave, 15); while(HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY); HAL_GPIO_TogglePin(GPIOA,LD2_Pin); HAL_Delay(500); }}
I can confirm that the callback:
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{ printf('End InterrupTXRX\r\n');}Is never called. Neverthelees the HAL_SPI_TransmitReceive_IT is working since the Master is receiving the data from the slave.
Does anyone knows what I missing here?
Your help is very much appreciated.
Greetings,
Diego.
