Menu

#7 Feature needed to solve CRC error problems

v1.2
open
nobody
5
2014-07-23
2010-10-13
bounzer
No

I am using your library to develop a java application used to query various kind of modbus slaves;
I noted that I catch a lot of CRC errors reading a device on a rs485 bus via a usb to serial adapter.
Checking the library source, I noted that you read the response immediately after executing the request, without any delay, (See class ModbusSerialTranscation.java, method execute) :
------------------------------------------------------------------------------------------------------------
//write request message
m_IO.writeMessage(m_Request);
//read response message
m_Response = m_IO.readResponse();
finished = true;
} catch (ModbusIOException e)
------------------------------------------------------------------------------------------------------------
I had modified the code adding a short delay between the execution of the request and the response reading, just to be sure that the response "buffer" is fully completed:
------------------------------------------------------------------------------------------------------------
//write request message
m_IO.writeMessage(m_Request);
//read response message
Thread.sleep(500); //Delay introduced by cianna to resolve CRC error problems
m_Response = m_IO.readResponse();
finished = true;
} catch (ModbusIOException e)
------------------------------------------------------------------------------------------------------------

Now I don't have any CRC error, communication is ok.
Do you think that is better to introduce this line in you library code? Can you give me a feedback?

I have another problem, and i would know if you see this kind of error anymore; When opening the serial connection, sometimes i got this message: "This port has not been opened yet".
The occurrence of the message is completely random, is driving me crazy.
I'm using the software on:
Java:
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
Kernel:
Linux 2.6.26-2-686

In attached you'll find the code that i'm using.
Many thanks for your precious work!!

Discussion

  • bounzer

    bounzer - 2010-10-13
     
  • Marlon Trujillo

    Marlon Trujillo - 2014-07-23

    don't you think there is a better solution for this? add a fixed delay for small or large transactions is inefficient.

     

    Last edit: Marlon Trujillo 2014-07-23

Log in to post a comment.