I have a Waveshare adapter powered by PoE and I was just getting timeouts. I have switched to a Waveshare USB device and get the same.
I have connected pins 3 and 4 to B and A and pin 16 (COM) to GND.
Polarity correct
Baud: 9600, 8N1
Slave: 247
I'm testing with mbpoll
mbpoll -m rtu -p none -b 9600 -a 247 -r 1 -c 1 /dev/ttyACM0
I've been trying this for days and rewired a couple of times but I don't seem to be getting anywhere.
Can anyone suggest where I might be going wrong?
Do you have a picture of the rear of the plug?
I use the USB waveshare device, and only wired up the A & B pins to it.
I use the USB waveshare device, and only wired up the A & B pins to it.
I'll get one later but on the top row I have them centre top and the one to the right of that which equates to mirror on the front. If that makes sense
- - B A -
As the top row. And I have it the same way up as the manual with the slightly offset row at the top
- - B A -
As the top row. And I have it the same way up as the manual with the slightly offset row at the top
That seems right to my head, as seen from behind (the direction you add the wires in)
1 being top left, and 5 being top right
1 2 3 4 5
- - B A -
As you are using a waveshare device that is a TCP to RS485 and should be configured as TCP to modbus protocol and the correct baud rate (9600,N,8,1), I would have expected that your modpoll would be using -m tcp (not rtu)
Also not seeing a register address to poll, for example this is the command I use on modpoll to get the model name from the inverter
Modpoll -m tcp -p 502 -a 247 -t 4 -0 -1 -c 16 -r 30000 192.168.x.x (the waveshare IP address)
Also not seeing a register address to poll, for example this is the command I use on modpoll to get the model name from the inverter
Modpoll -m tcp -p 502 -a 247 -t 4 -0 -1 -c 16 -r 30000 192.168.x.x (the waveshare IP address)
I started with the TCP device and then bought the USB device to rule out device issues. I'll try addressing the register specifically which is something I haven't done
I noticed something I'd got wrong. I had -p for parity instead of -P. I'm now getting a different error, I'm not sure if this is positive or not. I tried register 30000 with the same result.
Code: Select all
mbpoll -m rtu -P none -b 9600 -a 247 -r 30000 -c 1 -v /dev/ttyACM0
debug enabled
Set device=/dev/ttyACM0
mbpoll 1.0-0 - ModBus(R) Master Simulator
Copyright (c) 2015-2023 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.
Opening /dev/ttyACM0 at 9600 bauds (N, 8, 1)
Set response timeout to 1 sec, 0 us
Protocol configuration: ModBus RTU
Slave configuration...: address = [247]
start reference = 30000, count = 1
Communication.........: /dev/ttyACM0, 9600-8N1
t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table
-- Polling slave 247... Ctrl-C to stop)
[F7][03][75][2F][00][01][BB][59]
Waiting for a confirmation...
<F7><83><02><20><C3>
ERROR Illegal data address
Read output (holding) register failed: Illegal data address
One step further.
It works with the following command
I switched back to the PoE device and while it did not initially work I had to change a setting. In Multi Host Settings I had to change the Protocol from None to Modbus TCP to RTU (this was probably my initial problem.
I now have it working with Home Assistant and I can look forward to data coming in and creating useful dashboards and automations.
I appreciate the input and in particular seeing your command made me question my invalid -p flag and showing the 30000 register led me to the 30001 that I needed.
It works with the following command
Code: Select all
mbpoll -m rtu -P none -b 9600 -a 247 -r 30001 -c 10 -v /dev/ttyACM0I now have it working with Home Assistant and I can look forward to data coming in and creating useful dashboards and automations.
I appreciate the input and in particular seeing your command made me question my invalid -p flag and showing the 30000 register led me to the 30001 that I needed.