-
Notifications
You must be signed in to change notification settings - Fork 359
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
Modbus-RTU: Only first byte of answer is read from my device #4
Comments
I should provide expected length to read from serial port for each command. |
@nqv: Thank you very much. If I insert a sleep time, I can correctly receive the data (and the data is also correctly decoded, see my last commit). I guess that you can determine the sleep time from the baudrate and the expected response length. |
@gonium Thanks. I'll fix this issue as you have suggested. |
@gonium Thanks for your pull request, I believe the issue has been fixed. I'd be grateful if you can test and let me know if it works with your device. You also need to run Thanks |
@nqv I just switched from my temporary fork back to your master - now everything works as expected. Please note that I am currently using the SDM630 device in its factory settings: 9600 8N1. I didn't test higher baud rates. Thank you very much for your help! Closing this for now. |
@gonium How to connect Pi to TTL to 485 Converter? |
Hi @arnavbansal95, I prefer using cheap (as in 3 USD) USB-to-RS485 converters. If you really need to connect directly to the extension header of your RPi you can have a look at the schematics of this Sparkfun RS485 shield. |
@gonium Thanks ....I also got a Usb to 485 converter....but I don't know how to install its driver on raspian as I am new to linux....could you help me with that? |
@gonium how you did sleep thing to to read energy meter?? |
@gonium i am also working on it but didn't get the result. Can you give me some help that how you send query? |
fix(test): fix skipped tests, closes goburrow#4
I'm implementing a client for a Eastron SDM630 electricity meter using your library. The aduRequest ist composed and send correctly, but your library only reads one byte back. I suspect that this relates to the handling of the select call in serial_linux.go, but I'm not sure.
My setup consists of a RS485-USB-dongle that shows up as
/dev/ttyUSB0
under my Ubuntu 14.04-box. I can successfully read the device using the minimalmodbus python library and the following script:The output of this script looks like this:
So, in order to query the SDM630, the library generates the following ADU request (in python syntax):
'\x01\x04\x00\x00\x00\x02q\xcb'
and the device responds with'\x01\x04\x04Cj\xcf\x17\xdb\xe2'
.BUT: My program creates the correct ADU request
[]byte{0x1, 0x4, 0x0, 0x0, 0x0, 0x2, 0x71, 0xcb}
(go syntax). It fails to read the answer correctly, it just receives the first byte of the answer:[]byte{0x1}
. The output of the program is here:Any ideas?
Best regards,
-Mathias
The text was updated successfully, but these errors were encountered: