Comments (12)
Did it actually wait for 5 seconds before returning ErrTimeout? if set timeout to 0 (infinity), do you still get the error?
from modbus.
It does wait. If I set the timeout to 0 it hangs until I stop it.
from modbus.
To be honest, I have never tried running this on RPi but I'm willing to fix this issue so I'd be grateful if you can help me this:
- Can you please enable debug with your C program & libmodbus (
ctx->debug
) to check if data sent is exactly same to01030008001645c6
. - Would you be able to connect your board to a computer or something that can verify serial data was sent?
- Do you have kermit installed on the RPi to send this binary
01030008001645c6
to see if there is any response.
from modbus.
I'd be happy to help you fix it.
I unfortunately am not physically at the location where the RPi and solar charger are, so I won't be able to plug my computer into either of them to verify operation.
Here is the output with the C program's debugging turned on:
Opening /dev/ttyUSB0 at 9600 bauds (N, 8, 2)
[01][03][00][08][00][16][45][C6]
Waiting for a confirmation...
<01><03><2C><0F><FD><00><00><0F><EF><00><00><00><DC><00><10><00><11><00><11><00><19><00><03><00><00><0F><FD><00><00><00><00><99><ED><00><00><99><ED><02><1B><00><01><00><00><0E><B6><00><00><94><76>
I installed kermit, but I've never used it before and I'm not sure how to send that binary data to it. I ran:
ckermit -l /dev/ttyUSB0
set carrier-watch off
set speed 9600
set stop-bits 2
set parity none
connect
but from there it didn't seem like anything I was typing was going through. If you can point me in the right direction I would appreciate it.
Thanks for helping out with this.
from modbus.
I will also add that, although I am not in the same location as the RPi/solar setup mentioned above, I do have a raspberry pi, arduino, and USB FTDI chip where I am now. I could probably hack something together with that if necessary.
from modbus.
So the frame data is similar [01][03][00][08][00][16][45][C6]
I'm wondering if this is the problem with fd select with serial port. Would you please go to $GOPATH/src/github.com/goburrow/serial/serial_linux.go and comment out line 125 to 129 and rebuild it (https://github.com/goburrow/serial/blob/master/serial_linux.go#L125)
if !fdIsSet(fd, &rfds) {
// Timeout
err = ErrTimeout
return
}
I'd like to see if it can read any data at all.
from modbus.
With that commented out I get:
mb: rtuclient.go:120: modbus: sending 01 03 00 08 00 16 45 c6
error reading registers: EOF
from modbus.
Is there a test I could do with the serial package and the raspberry pi and arduino I have on hand to see if there's an issue at the serial communications layer?
from modbus.
I have got a RPi2, will install ArchLinux and test with my usb-serial port this weekend.
from modbus.
Great, thank you!
from modbus.
Hi @brianfoshee
It seems the problem has been fixed in github.com/goburrow/serial
package. Would you please reset any changes made to the serial package in local and pull the latest:
go get -u github.com/goburrow/serial
Let me know if the fix does (not) work for you.
Thank you.
from modbus.
It is working now! Thank you very much @nqv, I appreciate it!
from modbus.
Related Issues (20)
- Error: response transaction id does not match request HOT 2
- Use of the library with Raspberry Pi 3 and a MAX13487E that has AutoDirection Control HOT 1
- reading of holding register limited to 125 bytes HOT 3
- illegal function HOT 1
- Is there something like keep alive flag?
- golang >v.1.16.3 couldn't find package serial
- Write registers in parallel over tcp HOT 1
- write negative value. HOT 1
- Error "too many open files" on ReadHoldingRegisters for RTUClient HOT 1
- SYS_IOCTL (RS485): inappropriate ioctl for device HOT 1
- Why serial: timeout HOT 1
- WriteSingleRegister time out, though Python code works HOT 2
- About the functionFail
- How to tell if server closes the connection?
- Interface{} to modbus-compatible slice conversion
- panic due to concurrent closeIdle and Send()
- Modbus read velocity
- protocol error' on CentOS7 Ubantu20.04
- parity bit not working
- The ReadCoils method returned a value that was not expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modbus.