cancel
Showing results for 
Search instead for 
Did you mean: 

UART Busy before Start.

federico.massimi
Associate III

Hi, I have a problem with a STM32L476RG.

The problem is UART interface in DMA receive mode, at the beginning of my main function, after having initialized some variable, I call the function:

 __HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
HAL_UART_Receive_DMA(&huart3,TMBUS_RxBuffer, TM_RX_BUFFER_SIZE)

very often the HAL_UART_Receive_DMA function returns HAL_BUSY. What I don't understand is how does the UART get busy if it hasn't started yet?

If I disconnect the RX pin of the UART, the error does not occur, and the HAL_UART_Receive_DMA function returns correctly HAL_OK.

How can I solve?

3 REPLIES 3
Uwe Bonnes
Principal II

Missing pull on the RX line or other end yet not powered and pulling the line to invalid state?

Double check how you've initialized structures, and then make sure you clear any pending errors/status, ie Framing, Noise or Overrun, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
federico.massimi
Associate III

@Uwe Bonnes​  The UART is connected to a 422 driver which has its own internal pullup. In any case I added a delay before starting the UART to give the driver time to turn on.

I tried to simply move the line

__HAL_UART_ENABLE_IT (......)

after the

HAL_UART_Receive_DMA (.....)

and it seems to work, is it a coincidence or could this be the solution?