I hunted down RXTX and got ModbusPal setup to work on my Windows XP system.
I am running RS232 19.2Kbaud no parity Modbus RTU.
It will run through several transactions, but the console window will display:
Exception in thread "serial link" java.lang.ArrayIndexOutOfBoundsException: -1
at modbuspal.toolkit.ModbusTools.getUint8(ModbusTools.java:53)
at modbuspal.link.ModbusSerialLink.run(ModbusSerialLink.java:341)
at java.lang.Thread.run(Unknown Source)
and it won't process any more unless I click the "Run" button off and on, then it restarts normallly, until the
next exception.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was browsing the source code, and my first guess is that it is not checking
received data for being a long enough message to be valid.
It creates character offsets to find the crc, etc. by subtracting from TotalLen, which
will generate a negative index if the message was invalid (and short).
I guess I'll have to set up a Java Development environment to make some changes in my copy for now…
I'm not sure why it's getting short messages.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
First many compliments for the software!
On my PC (win7) I have the same problems for RS485 modbus comunication with the master as described by you...
Have you a compiled copy of the your modified version that you can send me, so I test and confirm the solution?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the effort. Very useful software for testing and simulation of modbus.
I had the same issue on my PC (win7) and now fixed with small changed in the code. Here is the fix.
ModbusSerialLink.java
public void run()
{
.
.
.
// read crc value (located in the last two bytes
//int crcLSB = ModbusTools.getUint8(buffer, totalLen-2);
int crcLSB = 255;
if (totalLen > 2){
crcLSB = ModbusTools.getUint8(buffer, totalLen-2);
}
I hunted down RXTX and got ModbusPal setup to work on my Windows XP system.
I am running RS232 19.2Kbaud no parity Modbus RTU.
It will run through several transactions, but the console window will display:
Exception in thread "serial link" java.lang.ArrayIndexOutOfBoundsException: -1
at modbuspal.toolkit.ModbusTools.getUint8(ModbusTools.java:53)
at modbuspal.link.ModbusSerialLink.run(ModbusSerialLink.java:341)
at java.lang.Thread.run(Unknown Source)
and it won't process any more unless I click the "Run" button off and on, then it restarts normallly, until the
next exception.
I was browsing the source code, and my first guess is that it is not checking
received data for being a long enough message to be valid.
It creates character offsets to find the crc, etc. by subtracting from TotalLen, which
will generate a negative index if the message was invalid (and short).
I guess I'll have to set up a Java Development environment to make some changes in my copy for now…
I'm not sure why it's getting short messages.
Hi!
First many compliments for the software!
On my PC (win7) I have the same problems for RS485 modbus comunication with the master as described by you...
Have you a compiled copy of the your modified version that you can send me, so I test and confirm the solution?
Thanks for the effort. Very useful software for testing and simulation of modbus.
I had the same issue on my PC (win7) and now fixed with small changed in the code. Here is the fix.
ModbusSerialLink.java
public void run()
{
.
.
.
Last edit: Tamilkumaran S 2014-09-30