I’m sure you’ve figured this out, but could the corrupt serial data be related to the kernel console issue we discussed :
It would seem very weird for serial to behave in such a way it needs flushed after each transaction. The 10 attempt reconnect is a good idea, and won’t hurt. I would log the connection reattempts at INFO or ERROR level though to bring attention to the fact something is wrong
Just my 2p, having recently got the m-bus all working with a supercal5