Skip to main content
Visitor II
October 9, 2024
Question

STML4 UART Errors - Generic Catch-all reset

  • October 9, 2024
  • 2 replies
  • 602 views

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

    Super User
    October 9, 2024

    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.

     

    Graduate II
    October 11, 2024

    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?