cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H563ZI Uart3 cannot receive more than 2 characters

mvo46
Visitor

Hi there,

I am trying to set up UART3 to receive and transmit using Interrupt.

My setup is simple to verify the issue. These are the steps that I did:
1. Add Uart3 in .ioc file with the configuration as:

mvo46_0-1738352898067.pngmvo46_1-1738352909947.png

2. In main(), before entering while(1) loop, I start receive_IT as:
HAL_UART_Receive_IT(&huart3, bufTemp, 1);

 

3. Add Callback function as:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
HAL_UART_Receive_IT(huart, bufTemp, 1);
}

The problem that I am running into that is if I send "1234\r\n", my HAL_UART_RxCpltCallback() only triggers twice, and I can see "1" and "2" in my buffer. 

I also verified ErrorCode before HAL_UART_Receive_IT() is called in the callback function. It turned out the error was an Overrun Error.

Could someone please give me some suggestions on how to solve this issue?

 

Sincerely,

 

1 ACCEPTED SOLUTION

Accepted Solutions
mvo46
Visitor

Please ignore this post. The issue was with my code, and setting up the breakpoint did not capture one character at a breakpoint trigger, which caused the confusion.

View solution in original post

3 REPLIES 3
mvo46
Visitor

Please ignore this post. The issue was with my code, and setting up the breakpoint did not capture one character at a breakpoint trigger, which caused the confusion.

Keep in mind that reading DR while debugging can have side effects. It clears the RXNE flag.

Also note that while paused, the peripheral is still working and will overflow if characters come in without being read/handled.

If you feel a post has answered your question, please click "Accept as Solution".

I was not aware of that initially. Thank you for the advice.