4
\$\begingroup\$

We have a device which has a RS485 Modbus connection. This device supposedly acts as a server on the bus.

We are in a position where it is not clear if the Modbus feature is even turned on or active. This is a whole other story. We have all the details such as baud, parity, etc. to be able to communicate with it from a Modbus client but the server is not responding at all when we try this.

Is there anything we can do to check if the Modbus server is actually active? My understanding is that it may not do anything until it receives a valid command. Does it have an initialisation process or idle state that may indicate if it's alive aside from sending it commands?

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for all the information so far, we are going to try all the suggestions and report back. Do Modbus slave devices have any idle voltage on their lines that we may be able to check with a multimeter (with the master disconnected of course)? We have been told that the wiring to the slave is correct but would have liked to confirm. I am assuming this might not be possible if the slave doesn't do anything until data is received. \$\endgroup\$ Commented Oct 14, 2022 at 14:44
  • \$\begingroup\$ modbus.org/docs/Client-ServerPR-07-2020-final.docx.pdf \$\endgroup\$
    – Obie 2.0
    Commented Oct 14, 2022 at 20:25

4 Answers 4

7
\$\begingroup\$

A Modbus server says nothing until it's spoken to. Be aware that:

  • If there's a CRC/LRC error it will remain silent
  • Baud rates vary
  • RTU mode is required but ASCII mode is optional
  • Could it be in listen-only mode?

It's well worth reading through the specification, which is only ~50 pages Modbus over serial v1.02

And also Modbus Application Protocol v1.1b3

Search in this latter document for "Listen only mode", section 6.8.1 code 01.

As others have said, try reading a coil or a holding register. It should respond, even if it's an error. Eg: READ-HOLDING-REGISTERS(code=0x03, addr=0xffff, quantity=2) should make an ILLEGAL DATA ADDRESS error (code 02).

\$\endgroup\$
1
6
\$\begingroup\$

Some modbus controllers have implemented diagnostics in function code 8.
Operand 0 is a return query that just replies back what you sent.

If those are not available all you can do is read some other coil or register.

\$\endgroup\$
2
\$\begingroup\$

Send a command to its device address. If you don't know this, try looping over all.

There is also broadcast at device 0, but no response obviously. If you have an obvious effect from a command, you could send that (e.g. enable output, blink LED..).

\$\endgroup\$
1
\$\begingroup\$

All the other answers are great. I am giving you one other way of testing it.

If you can connect your Modbus device to a computer using an RS485 to USB converter, you can use use the following python program to check the device connectivity. You may need pymodbus library installed along with python on your computer. I am assuming you know the device address and some register details.

from pymodbus.client.sync import ModbusSerialClient  # you can install this module using pip 

c=ModbusSerialClient(method='rtu',port=com_port,baudrate=9600,timeout=1,parity='N'). #Define the connection parameters here
c.connect()
data = c.read_holding_registers(register,length,unit=slave_id)  # Input slave address and register details 

print(data.registers) # finally extracting the data from register 

Given you have provided the correct register address, you should see some data if the MODBUS on the client device is working. Else you will see some error codes.

If you do not know the server address of the device, you can loop this program for different server ids. Hope this helps!

\$\endgroup\$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.