RS485 Receiving Data Corruption
Yo have to start the receive with interrupt, with set timeout - a timeout timer that restarts at received char. So you should start receive and this should trigger an interrupt when last character is received + timeout_char / or if no character is received + timeout_recv
Then you you have to parse the received telegram by using receive complete callback.
You do wait in endless loop, but the interrupt will call a callback, so no need to wait in loop.