Modbus RTU Debugging

Topics about the Software of Revolution Pi
Post Reply
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Modbus RTU Debugging

Post by RR4711 »

Hi,
I hooked up a bronkhorst Pressure Controller to the embedded RS485 on my RevPi Connect+ 32GB. I see cyclic transfers on the RS485 bus and the Pressure Controller flashes a LED whenever there is traffic on the bus (in the action intervals I have defined). I'm pretty sure about the wiring, termination and such. Looks OK on the Oscilloscope as well. I tried also the addresses and addresses+1 in case there is this weird "off by 1" effect.

The Modbus_Master_Status stays 0 and on the 2 Action IDs I have defined get a "110" status back in the corresponding action status Modbus_Action_Status_1 and Modbus_Action_Status_2, which I cannot reset with the corresponding Action_Status_Reset_1 and Action_Status_Reset_2 Bits

I don't get any error messages in the daemon.log, and the Modbus_Master_Status stays 0 even if I disconnect the Controller (I would expect to flag an error after some time).

Is there any checklist to follow to debug such a setup?
Is there a way to turn on more debug or debug to console for the "piModbusMaster" program? Is there the source available for it BTW?

Markus
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Modbus RTU Debugging

Post by dirk »

Hi Markus, what you do seans pretty straightforward.
Error code 110 means "Connection timed out" see tutorial
https://revolution.kunbus.de/tutorials/ ... enden-con/

Do a driver reset via "piTest -x".
Perform a reset of the module via "sudo reboot"
Verify your configuration step-by-step i.e. serial configuration baud rate, parity etc.
The source code of the piModbusMaster is unfortunately not available.
Try to use the following Modbus Slave software:
https://sourceforge.net/projects/modrssim2/
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Modbus RTU Debugging

Post by RR4711 »

Ok so you suggest "sniffing" with the Slave Software on a windows PC to see what going on?

Driver reset I did via the pictory menu or does that behave different then the commandline with piTest -x?

What I don't understand why the master GLOBAL error flag is not set if I take my slave from the bus? I would expect if there is no device at all responding that this should be flagged as a global error when only 1 slave is configured.

Markus
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Modbus RTU Debugging

Post by RR4711 »

So, turns out that the P output on the RevPi that according to the schematics diagram RevPiConnectBridgeSide.pdf (see https://revolution.kunbus.de/download/5322/ ) is the A-Line on the transceiver U401A needs to be connected to the D1 Line/B/B' of the MODBUS and the N output that should be the B-line of the transceiver needs to be connected to the D0/A/A' line of the MODBUS.

This is against any common sense and I guess this is worth an entry in the "HowTo Modbus RTU Manual" because this costed me quite some time to figure it out. The bus seems to work now.

Markus
Eduard
KUNBUS
Posts: 209
Joined: 18 Jun 2018, 16:16
Answers: 0

Re: Modbus RTU Debugging

Post by Eduard »

Hi Markus,
I agree with you, the terms P and N are chosen unhappily. The P stands for A and N for B, we will add this in the tutorial.
But I have put several Modbus devices into operation with our RevPi Connect and never had to connect P (A) to B and N (B) to A line of another Modbus device.
But always the P(A) line of the RevPi Connect with A line of the Modbus device and N(B) line of the RevPi Connect with B line of the Modbus device.

Could it be that the label of your Modbus device is wrong?
Eduard
KUNBUS
Posts: 209
Joined: 18 Jun 2018, 16:16
Answers: 0

Re: Modbus RTU Debugging

Post by Eduard »

Here is a link to the tutorial „How to Connect Serial Devices
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Modbus RTU Debugging

Post by RR4711 »

Eduard wrote: 26 Nov 2019, 13:28 Could it be that the label of your Modbus device is wrong?
I link to the Datasheet of the manufacturer here: https://www.bronkhorst.co.uk/files/down ... erface.pdf , they use "Modbus Spec" nomenclature. I have no idea if it is wrong, i think they sell several thousands of the units, would need to ask the distributor here if there is more complaints, but I guess they would have fixed their docs then.

If you look at page 7 there is the pinout. I have to connect Pin 8 on the RJ45 ("D1 Modbus (B/ B')") to the P pin and Pin 7 ("D0 Modbus (A/A')") to the N pin to make it work.

Markus
Eduard
KUNBUS
Posts: 209
Joined: 18 Jun 2018, 16:16
Answers: 0

Re: Modbus RTU Debugging

Post by Eduard »

I found the following warning on page 6. I think that explains your problem.
Warning.PNG
Warning.PNG (18.32 KiB) Viewed 6358 times
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Modbus RTU Debugging

Post by RR4711 »

That is just to clarify that the RJ45 pinout is not the one suggested by the Modbus Spec. But that doesn't hold true for the signal names.
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Modbus RTU Debugging

Post by RR4711 »

They want to make clear it's different from the RJ45 pinout [url]http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf[/url] listed here on page 29. They use 4 Pins for GND and 24V to supply the controller.
Post Reply