2024-10-09 05:10 AM
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
2024-10-09 05:35 AM
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.
2024-10-11 12:27 AM
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?