Menu

#28 Problems reading more than nine registers at a time

v1.2rc1
closed-out-of-date
Transport (27)
5
2007-12-21
2006-05-07
No

I've got a number of Modbus devices in a laboratory
setup. Each of them is connected to a dedicated Linux
machine (i.e. they don't share the bus). I'm able to
read and write registers and coils on each of them
using jamod - so far so good.

There is, however, one problem: I can only access up to
nine 16-bit registers at a time. If I try to, for
example, read ten registers in a row, the read will
fail because the devices won't answer. This behaviour
is consistent across

- different devices from different manufacturers (Deif
Multiline AGC diesel genset controller, Modicon TSX57
PLC, Deif MIC Switchboard instruments)
- different physical layers (RS232, RS485)
- different baud rates (9600-38400)
- different communication libs (Sun Comm API, RXTX)
- different versions of jamod (1.2rc1, cvs HEAD)

----------------------------------------------
Here's the debug output from a successful read of nine
registers. PLCAITest is essentially SerialAITest with
my own port settings and a few print statements.

olge@syslab-07 ~/devel/Panel-cvs $ java
-Dnet.wimpi.modbus.debug=true -Djava.library.path=.
-classpath comm.jar:.:jamod/src
net.wimpi.modbus.cmd.PLCAITest /dev/ttyS1 1 $((0x130)) 9
net.wimpi.modbus.debug set to: true
Encoding [rtu]
Request: 01 03 01 30 00 09
Sent: 01 03 01 30 00 09 84 3f
Serial port break detected
Response: 01 03 12 13 85 09 30 09 36 09 3a 09 35 0f f3
0f f4 0f f3 0f f3 3e 8a
Response: 01 03 12 13 85 09 30 09 36 09 3a 09 35 0f f3
0f f4 0f f3 0f f3
Word 0=4997
Word 1=2352
Word 2=2358
Word 3=2362
Word 4=2357
Word 5=4083
Word 6=4084
Word 7=4083
Word 8=4083
--------------------------------------------------
...and a failed read of ten registers:

olge@syslab-07 ~/devel/Panel-cvs $ java
-Dnet.wimpi.modbus.debug=true -Djava.library.path=.
-classpath comm.jar:.:jamod/src
net.wimpi.modbus.cmd.PLCAITest /dev/ttyS1 1 $((0x130)) 10
net.wimpi.modbus.debug set to: true
Encoding [rtu]
Request: 01 03 01 30 00 0a
Sent: 01 03 01 30 00 0a c4 3e
Serial port break detected
Last request: 01 03 01 30 00 0a c4 3e
Error reading response
execute try 1 error: I/O exception - failed to read
Sent: 01 03 01 30 00 0a c4 3e
Last request: 01 03 01 30 00 0a c4 3e
Error reading response
execute try 2 error: I/O exception - failed to read
Sent: 01 03 01 30 00 0a c4 3e
Last request: 01 03 01 30 00 0a c4 3e
Error reading response
net.wimpi.modbus.ModbusIOException: I/O exception -
failed to read
at
net.wimpi.modbus.io.ModbusRTUTransport.readResponse(ModbusRTUTransport.java:148)
at
net.wimpi.modbus.io.ModbusSerialTransaction.execute(ModbusSerialTransaction.java:151)
at
net.wimpi.modbus.cmd.PLCAITest.main(PLCAITest.java:124)

-------------------------------------------------

The reply length for a ten register read would be 25
bytes - only ten percent of the length permitted by the
modbus specs.
My suspicion is that the message sent by the master is
being treated as malformed by the slaves. Has anyone
seen similar behaviour, or do you have an idea what the
problem could be? I'd like to get as much bandwidth as
possible out of the serial connections, and splitting
all operations up into nine-register chunks will
produce serious overhead (some of the devices are quite
"rich" in registers).

Thanks
Oliver

Discussion

  • Oliver Gehrke

    Oliver Gehrke - 2006-05-07

    Logged In: YES
    user_id=1518596

    Oops - just realised that this would be a forum question AT
    THIS STAGE rather than a bug report. Sorry - have been
    updating my private Bugzilla on our Intranet half an hour
    ago, guess I was just stuck in the routine :-)
    I will go to the forums with this.

     
  • Dieter Wimberger

    • assigned_to: nobody --> jdcharlton
     
  • Dieter Wimberger

    Logged In: YES
    user_id=36782
    Originator: NO

    I am not quite sure what may cause the problem, but I suspect that it could be some timeout. Given that most of the RTU part was contributed, I hope that John finds some time to help you out.

     
  • Dieter Wimberger

    Logged In: YES
    user_id=36782
    Originator: NO

    The request from your problem is:
    01 03 01 30 00 0a

    Slave ID: 1
    Function Code: 0x03 (Read holding registers)
    Starting Address Hi: 0x01
    Starting Address Lo: 0x30
    No. of Points Hi: 0x00
    No. of Points Lo: 0x0a

    I don't see why this should be malformed. The "Error reading response" indicates that there was no response, and may hint to a timing problem....I will close this bug thread for the moment as out of date, because by now there should be ways and means to control the timeout better and rule out the problem of an unfinished read due to a timeout.

    Regards,
    Dieter

     
  • Dieter Wimberger

    • labels: --> Transport
    • assigned_to: jdcharlton --> wimpi
    • status: open --> closed-out-of-date
     

Log in to post a comment.