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

Mutex does not protect parallel access to same serial port correctly #9

Open
SeasDiver opened this issue Dec 17, 2019 · 1 comment
Open

Comments

@SeasDiver
Copy link

If you have a multidrop serial configuration - multiple devices on same serial port using unique Device IDs, the mutex that is created to protect communications does not work if there are parallel accesses to the Read/Write register functions. The problem is that each Create Serial Master generates a unique Mutex whereas it should be a unique mutex for each serial port, not each device on the serial port. You will not see a problem if using a single device or if all of your register accesses are serialized, but if you parallelize the application, then you can have two different accesses to the same serial port which will screw up communications resulting in error 56.

@SeasDiver
Copy link
Author

Note: This may also occur if you have multiple devices going to different IP Ports on the same TCP IP Address, but I have not tested that use case. It is a rare one and would only occur if you have multiple programs on the same computer offering multiple TCP Modbus interfaces on different ports which would be a fairly unusual use case.

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

1 participant