2021-04-08 04:49 AM
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?
2021-04-08 05:32 AM
Missing pull on the RX line or other end yet not powered and pulling the line to invalid state?
2021-04-08 05:43 AM
Double check how you've initialized structures, and then make sure you clear any pending errors/status, ie Framing, Noise or Overrun, etc.
2021-04-08 07:11 AM
@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?