Skip to main content
federico.massimi
Associate III
April 8, 2021
Question

UART Busy before Start.

  • April 8, 2021
  • 3 replies
  • 1180 views

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?

This topic has been closed for replies.

3 replies

Uwe Bonnes
Chief
April 8, 2021

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

Tesla DeLorean
Guru
April 8, 2021

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
federico.massimi
Associate III
April 8, 2021

@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?