STM32F103C8T as SPI slave
Hello,
I'm trying to set up SPI communication between an MCU as master and the STM32 as slave. Data reception in the STM32 works fine, but I'm not being able to transmit data to the MCU from the STM32. I'm using the interrupt callback to read and send the data as follows:
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef * hspi)
{
HAL_SPI_Receive_IT(&hspi1, rxbyte, 1);
HAL_SPI_Transmit_IT(&hspi1, txbyte, 1);
}
I expect that in the second transmission, my MCU will get the data stored in the txbyte.
But STM32 is not sending the data, on the other hand, if I place the transmit function in the while loop:
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
HAL_SPI_Transmit_IT(&hspi1, txbyte, 1);
/* USER CODE BEGIN 3 */
}
The transmission occurs, but now the transmission buffer is filed with the data in txbyte.
Is there an explanation to this behavior? the SPI configuration is as follows:
Thanks in advance.
