STM32L4 HAL UART DMA does not recover after error
The exact issue I am experiencing with the STM32L4 series (both L476 and L412), is described here: https://stackoverflow.com/a/71297149/10909834
The solution I came to independently is to reinitialize the uart. I used HAL_UART_DeInit() followed by HAL_UART_Init() calls, the poster of the SO answer called the MX_USARTx_UART_Init() function again.
I would like to know what happens during the procedure that recovers the uart. What is the minimum I need to do to recover?
I did implement the error callbacks, and called HAL_UART_Abort_IT() in it, with a HAL_UARTEx_ReceiveToIdle() call in the HAL_UART_AbortCplt() callback. The uart handle got stuck in DMA error state though, so I added a check for that in the main loop and just reinitialized the whole thing when I got in that state.
Do anybody understand what's going on and what is the correct procedure to elegantly recover the DMA and/or UART?
