Skip to main content
arduo
Associate III
February 27, 2019
Question

When is HAL_UART_RxCpltCallback called?

  • February 27, 2019
  • 6 replies
  • 5105 views

Hi there,

I am new with UART and want to use my own UART Functions and i found the function

HAL_UART_RxCpltCallback and HAL_UART_TxCpltCallback.

When are this Functions called? I found them in the documentation of stm but that didn't explain well when they will be called.

Thanks in advance

This topic has been closed for replies.

6 replies

Bob S
Super User
February 27, 2019

You have the HAL source code. Go look for it.

arduo
arduoAuthor
Associate III
February 28, 2019

the explanation there isn't very helpful

Bob S
Super User
February 28, 2019

"Give a person a fish, you feed him for a day. Teach a person to fish and you feed them for a lifetime".

I'm not going to spoon feed you the answer. Show us that you've done a little bit of work first. Have you tried looking at the HAL UART source? If you can't find where or when the function is called, or have trouble understanding the circumstances when it is called, I'll be glad to help. The HAL code can be a bit difficult to follow some times, though at least in the L4xx HAL library this particular function usage looks pretty straight forward.

MNapi
Senior II
February 27, 2019

it is rather simple you setup UART as global interrupt in Cube MX

the best way is to setup for example

 HAL_UART_Receive_DMA in you main() loop, not while(), it will listen all the time and jump there to execute whatever you want

and you use for example in Keil

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

 UNUSED(huart);

}

for example in /* USER CODE BEGIN 4 */ and put inside whatever you want to execute.