Modbus RTU Slave Stops Responding – Only Recovers After Power Cycle
[Issue] One Modbus RTU Slave Stops Responding After Several Months – Only Recovers After Power Cycle (STM32G4 / UART Interrupt)
Hello ST Community,
I’d like to ask for help with a real issue we're facing in the field.
System Overview:
We are using STM32G474 as a Modbus RTU slave.
UART is configured in interrupt mode using hal uart receive it
There are 5 slaves on the same RS485 line, with Modbus IDs 1 to 5.
The master sends regular requests to all 5 slaves continuously.
Possible Causes:
We suspect that a UART error like Framing Error or Overrun may have occurred, which caused the UART peripheral to hang,
We do not use HAL_UART_ErrorCallback(), and we do not call HAL_UART_Abort() in our code,
In HAL_UART_RxCpltCallback(), we always call HAL_UART_Receive_IT() again — so we believed it would keep working — but somehow it stops responding after a long time.
Questions:
Has anyone experienced a similar issue where a UART stops responding after months of operation?
Should we always implement HAL_UART_ErrorCallback() and call HAL_UART_Abort() to ensure recovery from errors like FE, ORE, NE, PE?
Is it advisable to add a software reset mechanism or watchdog recovery in case the UART gets stuck and stops responding?
We’re looking for a robust and long-term solution, since this is for field-deployed devices that cannot be manually reset easily.
Any insights, experiences, or advice would be greatly appreciated.
Thank you very much!
