2023-05-04 01:00 AM
I have a problem using the NUCLEO-G431KB. After set-up of UART2_RX_INT, the interrupt seems to trigger and goes straight into the interrupt before any data has been put onto the receive pin of the UART. I have used Cube MX to generate the initalise. What could be causing this?
These two lines of code are used as part of the UART2 set-up.
__HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE );
HAL_UART_Receive_IT(&huart2, Rx2Buff, Uart2BuffLen);
Thanks
2023-05-04 01:35 AM
> What could be causing this?
Read out and check flags in the UART status register.
JW
PS. Note, that normally you should not run your program while debugger is reading the registers.
2023-05-04 02:12 AM
Enable the pull-up on the RX pin in GPIO configuration tab.
2023-05-04 04:14 AM
Thanks for the suggestion, but still does the same thing.
2023-05-04 08:33 AM
Probably not the issue, but are you explicitly calling __HAL_UART_ENABLE_IT()? That is typically done in HAL_UART_Receive_IT() or some function that it calls.
Perhaps post your code? And what is connected to the RX pin?