Socat and RTU?! #857
Unanswered
giulioiacom
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to emulate two RTU ends using socat on my Linux machine. This is the socat call I'm running:
socat pty,raw,echo=0,link=/tmp/rtu0 pty,raw,echo=0,link=/tmp/rtu1
also, for reference, my RTU config is 19200 baud, N-8-1. On reconnect the master side context is fully torn down and rebuilt, so modbus_new_rtu() is called every time i stop/start the slave.
Aaand I'm noticing an erratic behavior, bear in mind that I'm fairly new to embedded programming (but not to systems).
My setup is fairly simple: a Modbus master polls a slave continuously, and I'm testing what happens when the slave process is restarted mid-run.. basically the result is that the master sometimes fails to reconnect and pick up where it left off.
I've done some reading and I understand that a socat PTY is not a perfect emulation of a real RTU serial layer, from my understanding there is some timing sensitive stuff that is not being emulated by the virtual ports (inter-frame silence, baudrate..etc)
What I'm basically trying to gauge is whether this kind of erratic behavior after a slave restart is expected or not - to be honest it's just personal sanity/curiosity at this point as I'm about to move the testing to a real hardware-based slave anyway, but I like knowing.. well everything.
Thanks in advance!!
Beta Was this translation helpful? Give feedback.
All reactions