forked from pymodbus-dev/pymodbus
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Serial modbus framing issues #2
Comments
This issue is still there, Sometimes its reading function code, sometimes not. @uzumaxy Please help us to resolve it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have created a python script which reads data out of a solar charge controller via an rs-485 serial connection. I can read individual registers correctly but if try to read several non-contiguous registers using a for loop then every second reply has an extra starting character (which is the function code). Below is the code I am using
I have added some debugging statements to transaction.py and get output as follows:
DEBUG:transaction_xtra:Running transaction 1
DEBUG:transaction_xtra:getting transaction 1
client receive is 02:3c:9f:e8:58 ## correct
DEBUG:transaction_xtra:Running transaction 2
frame size is 6 ## different to transaction 1, this time it is calling check_frame() in transaction.py
data is b'\x01\x04\x01'
DEBUG:transaction_xtra:getting transaction 2
client receive is 04:02:09:ec:be:ed ## response begins with 04 which is the function code throwing everything off by 1 position
DEBUG:transaction_xtra:Running transaction 3
DEBUG:transaction_xtra:getting transaction 3
client receive is 02:17:75:77:27 ## same as transaction 1
DEBUG:transaction_xtra:Running transaction 4
frame size is 6 ## Same as transaction 2
data is b'\x01\x04\x01'
DEBUG:transaction_xtra:getting transaction 4
client receive is 04:02:01:02:39:61
DEBUG:transaction_xtra:Running transaction 5
DEBUG:transaction_xtra:getting transaction 5
client receive is 02:00:0b:f8:f7
DEBUG:transaction_xtra:Running transaction 6
frame size is 6
data is b'\x01\x04\x01'
DEBUG:transaction_xtra:getting transaction 6
client receive is 04:02:3c:d2:28:6d
DEBUG:transaction_xtra:Running transaction 7
DEBUG:transaction_xtra:getting transaction 7
client receive is 02:02:6e:39:bc
DEBUG:transaction_xtra:Running transaction 8
frame size is 6
data is b'\x01\x04\x01'
DEBUG:transaction_xtra:getting transaction 8
client receive is 04:02:09:80:be:c0
DEBUG:transaction_xtra:Running transaction 9
DEBUG:transaction_xtra:getting transaction 9
client receive is 02:9b:8b:92:67
DEBUG:transaction_xtra:Running transaction 10
frame size is 6
data is b'\x01\x04\x01'
DEBUG:transaction_xtra:getting transaction 10
client receive is 04:02:00:17:f9:3e
DEBUG:transaction_xtra:Running transaction 11
DEBUG:transaction_xtra:getting transaction 11
client receive is 02:9b:8b:92:67
I would be very grateful for any suggestions as to what is going on here and while I could just bodge up a way around the issue I'm keen to correct it and not have to deal with it when I come to other devices.
Thanks for your time and please let me know if you need any more info,
cheers
Hugh
The text was updated successfully, but these errors were encountered: