Skip to main content
VNava.1
Associate III
February 9, 2022
Question

Is it correct that HAL_UART_RxHalfCpltCallback and HAL_UART_RxCpltCallback are invoked even when there is nothing connected to the Tx and Rx pins of my microcontroller?

  • February 9, 2022
  • 9 replies
  • 2046 views

Hi community!

I would like to understand if it is normal that when I use DMA method to receive data the callback related to this method are invoked even when there is nothing connected to the Tx and Rx pins of my microcontroller.

I'm using a NUCLEO-F303K8

Thanks in advance

This topic has been closed for replies.

9 replies

VNava.1
VNava.1Author
Associate III
February 9, 2022

UPDATE_1: I'm using two UART peripherals: UART1 and UART2. The UART1 is used to communicate with another controller while the UART2 is used to print in a terminal some debug information. Is it possible that the reception callbacks for UART1 are invoked also when I send something to the terminal with the UART2?

VNava.1
VNava.1Author
Associate III
February 9, 2022

UPDATE_2: As I said previously, In my application I'm communicating with another controller by means of UART1 both in transmission and in reception. If I don't connect anything to the pins UART1TX and UART1RX of my controller I can see that the reception collbacks are invoked and Moreover, the msg received is the msg that I want to transmit by means of UART1Tx. Is it possible that there is some embedded loopback mode that I need to uncheck?

TDK
February 9, 2022

Callbacks aren't called unless it receives data. There is no internal connection between USART1 and USART2, so something is connecting them externally, or you are misinterpreting what is going on. Verify that the pin is idle with a scope. Look at the board schematic to verify hardware connections, or the lack thereof.

"If you feel a post has answered your question, please click ""Accept as Solution""."
VNava.1
VNava.1Author
Associate III
February 10, 2022

Thank you for the suggestions!

Piranha
Principal III
February 10, 2022

Just a reminder... HAL_UART_RxHalfCpltCallback()/HAL_UART_RxCpltCallback() are single unified callbacks for all peripheral instances. That means the user code has to find out for which instance it has been called every time. It's a kindergarten level API design by incompetent people... Though later they introduced a still bad but a bit more usable approach with the use of USE_HAL_UART_REGISTER_CALLBACKS and HAL_UART_RegisterCallback(), with which one can set separate functions for each peripheral instance.

Also a reminder... Floating pins can and will pick up a noise/signal from other pins, routes and basically any EMI source. It could be the routes for the other UART instance.

VNava.1
VNava.1Author
Associate III
February 10, 2022

Thank you for these reminders!!