Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with reading when parity is EVEN #43

Open
munnik opened this issue Apr 4, 2024 · 1 comment
Open

Issue with reading when parity is EVEN #43

munnik opened this issue Apr 4, 2024 · 1 comment

Comments

@munnik
Copy link

munnik commented Apr 4, 2024

Hi,

Thank you for the great work with this library! I have an issue which I can't really understand. We have multiple installations with this Modbus slave https://www.emuag.ch/files/manual/1485_Manual_Modbus-Interface_Professional-II_EN.pdf. On one installation, I changed the default config of this device and set the parity from EVEN to NONE, like we are also using on other Modbus devices. When I use your library to collect data from this Modbus slave, everything works as expected.

On the next installations I didn't bother to change the config on the device but rather change the config of the software. So I changed the Modbus connection to use EVEN parity. This runs fine for a couple of minutes, but then I get protocol error errors. There are multiple locations in your code that can issue a protocol error so I'm not sure what is causing this error.

When I let our software run (it's a daemon) and on the command line issue this command modbus -s 1 -b 19200 -p 1 -P e /dev/ttyUSB4 8999 9000 (https://github.com/favalex/modbus-cli) the software starts to receive Modbus data again. I'm not sure what is going on. For now, I've created a cronjob that runs the modbus command every minute, that keeps the data flowing.

In the serial library you are using, there is a config option for RS485 https://github.com/goburrow/serial/blob/master/serial.go. But I'm unable to pass that through via your library. I'm also not sure if I can resolve my issue with this config option? More info is available at https://www.kernel.org/doc/html/latest/driver-api/serial/serial-rs485.html.

We are using your library without any issues to connect to https://www.aspar.com.pl/katalogi/IOMODULES/16I_en.pdf, they have set parity to NONE. And also to connect to Modbus slaves over TCP without any issues.

@simonvetter
Copy link
Owner

Hi Martijn,

thanks for the kind words!

Did you ever find the root cause of your issue ? Since it works for a while then mysteriously starts misbehaving, and since you can resume normal operation without restarting your daemon or target device, I'm wondering if something on your host might be modifying serial parameters.
Are you sure no other process is attempting to open or change the serial port's configuration? Something like getty for example ? Or could the kernel be using the serial port as console? (look for "console=" in /proc/cmdline)

I have multiple linux and freebsd dataloggers running without issue, each with months of uptime, so this looks more like a local configuration issue than a bug, but you never know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants