cancel
Showing results for 
Search instead for 
Did you mean: 

I want to use DMA for UART receive. How do I generate an interrupt using the HAL for idle line? The UART Callbacks are disabled in the HAL when you use DMA. And it does not look like there is a call back for idle_line in the HAL.

KiptonM
Lead

When I setup the UART i activated both DMA TX and RX, and I turned on the UART Interrupt in the MX program.

Looking at the code in stm32f4xx_hal_uart.h Around line 680

/* Callbacks Register/UnRegister functions ***********************************/

#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)

HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID, pUART_CallbackTypeDef pCallback);

HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID);

#endif /* USE_HAL_UART_REGISTER_CALLBACKS */

So how do you do an idle_line interrupt using the HAL? 

I am using STM32F446.

1 ACCEPTED SOLUTION

Accepted Solutions
KiptonM
Lead

It appears looking in the code in stm32F4xx_hal_uart.c Around line 3037

if the USE_HAL_UART_REGISTER_CALLBACKS != 1

/*Call legacy weak Rx complete callback*/

     HAL_UART_RxCpltCallback(huart);

But it will only call that routine if  if (--huart->RxXferCount == 0U) or you are done receiving data. (Around line 3023)

View solution in original post

1 REPLY 1
KiptonM
Lead

It appears looking in the code in stm32F4xx_hal_uart.c Around line 3037

if the USE_HAL_UART_REGISTER_CALLBACKS != 1

/*Call legacy weak Rx complete callback*/

     HAL_UART_RxCpltCallback(huart);

But it will only call that routine if  if (--huart->RxXferCount == 0U) or you are done receiving data. (Around line 3023)