Skip to main content
Visitor II
Oct 9, 2024 12:10 PM UTC
Question

STML4 UART Errors - Generic Catch-all reset

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

 

This topic has been closed for replies.

2 replies

Pavel A.
Oct 9, 2024 12:35 PM UTC

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
Super User
Oct 11, 2024 7:27 AM UTC

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? 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source