Skip to main content
Explorer
January 31, 2025
Solved

NUCLEO-H563ZI Uart3 cannot receive more than 2 characters

  • January 31, 2025
  • 1 reply
  • 591 views

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,

 

    This topic has been closed for replies.
    Best answer by mvo46

    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.

    1 reply

    mvo46AuthorAnswer
    Explorer
    January 31, 2025

    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.

    Super User
    January 31, 2025

    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.

    mvo46Author
    Explorer
    January 31, 2025

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