cancel
Showing results for 
Search instead for 
Did you mean: 

I want to detect a timeout after execution of HAL_UART_Receive_IT and execute the transmission, is there a good way to do this? (I am translating Japanese to English with deepl)

TKTKTK
Associate
 
1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hi @豊和 金�?​ welcome to the Community 🙂,

When you used the Hal UART with Interrupt mode, the callback functions are declared as weak functions in the driver, with no code to execute. This means that the user can declare the Tx / Rx callback again in the application and customize it to be informed in real-time about the process completion and to execute some application code. Contrary, when you used the Hal UART with polling mode, the data processing is handled internally in a loop. A timeout (expressed in ms) is used to prevent process hanging.

For more explanation, you can refer to this article.

Also, I advise you to take a look at this example.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
KDJEM.1
ST Employee

Hi @豊和 金�?​ welcome to the Community 🙂,

When you used the Hal UART with Interrupt mode, the callback functions are declared as weak functions in the driver, with no code to execute. This means that the user can declare the Tx / Rx callback again in the application and customize it to be informed in real-time about the process completion and to execute some application code. Contrary, when you used the Hal UART with polling mode, the data processing is handled internally in a loop. A timeout (expressed in ms) is used to prevent process hanging.

For more explanation, you can refer to this article.

Also, I advise you to take a look at this example.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.