Strange behavior with python serial and RS485

Greetings @rema,

At the moment it’s hard to say with certainty what the exact issue here could be. But let me list some common issues that you could check on your side.

First of all, I see you only set a single ioctl to enable rs485, is that correct? We typically recommend a few ioctls to be enabled as documented here: UART (Linux) | Toradex Developer Center

Perhaps try enabling the recommended ioctls and try again.

Another thing to check is whether the rs485 connections you have are terminated with 120ohm resistors. Also I’ve heard that if the lines are too long this could cause an echo effect as well.

Finally there’s also a few threads I’ve found that reported similar issues, perhaps your issue is the same or similar to one of these:

Let me know if any of these helped or not.

Best Regards,
Jeremias