cancel
Showing results for 
Search instead for 
Did you mean: 

STML4 UART Errors - Generic Catch-all reset

Vonny232
Associate

Hi Folks, 

I am implementing a HAL/DMA UART TX / RX Routine that waits in a state machine for a line-idle interrupt, parses the inputs and immediately responds to the output.

The routine needs to work flawlessly, and if a UART error occurs, it needs resolving ASAP.

I think the best (safest) approach is a simple catch-all where if any UART error occurs (via the HAL_UART_ErrorCallback) then the firmware will simply disable/reinitialise the USART entirely.

Will such a simple "catch all" reset address:

HAL_UART_ERROR_PE, HAL_UART_ERROR_NE, HAL_UART_ERROR_FE, HAL_UART_ERROR_ORE, HAL_UART_ERROR_DMA, HAL_UART_ERROR_RTO?

I would rather do this than identify individual conditions and resolve them individually.

Does anyone see any issues with this simplistic approach?

regards

 

2 REPLIES 2
Pavel A.
Evangelist III

RTO is not an error. It is the RX "idle condition" that you want to use instead of "simple idle". Unfortunately the ST HAL library does not provide a straight way to use it. (or does it already? I haven't checked recently).

About other "errors": there's not too many of them, advice to understand the reasons and handle individually. Reset of whole UART with DMA is too heavy.

 

Karl Yamashita
Lead III

Are you actually running into errors? Or are you just implying that you want to implement something to reduce errors but have not started to write any code? 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.