2021-01-31 03:17 PM
Board: Nucleo-WB55
I'm attempting to continuously interrupt when data is received via UART.
The program is able to receive data when it is sent without fail, however the Rx interrupt is triggered when new data is not sent. I implement the following logic in my HAL_UART_RxCpltCallback routine:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
strcpy((char*)command, (char*)UART1_rxBuffer);
rx_flag = 1;
HAL_UART_Receive_IT(&huart1, UART1_rxBuffer, 5);
}
I call HAL_UART_Receive_IT after each complete call back so that a new receive request is ready. My methodology is clearly missing something, perhaps clearing a buffer or resetting a flag somewhere?
2021-01-31 03:47 PM
Turns out this was caused by another UART that was being used triggering the same interrupt routine. I am yet to work out how to fix it. Will update.
2021-02-01 02:18 PM
Fixed by placing conditions in the call-back that check the UART Handle that triggered the interrupt, allowing me to execute specific logic for each UART.