RTU RS232 communication problem
-
While using ReadSerialTest inside the package com.serotonin.modbus4j.test, I am getting the error mentioned below for Modbus RTU over RS232.
at com.serotonin.modbus4j.sero.messaging.InputStreamListener.runActually the software doesn't transmit any data over RS232. Hence its receiving a null pointer exception on the receive side.
Output stream this.out is null, not assigned.
public StreamTransport(InputStream in, OutputStream out) {
this.out = out;
this.in = in;
}What could be the reason. Please help me to resolve the problem.
-
Hi libu7alex,
-
ReadSerialTest throws a null pointer because TestSerialPortWrapper returns nulls for its input and output streams. That looks like a bug in the test, and shouldn't affect the larger issue you seem to be asking about, so,
-
I believe you're writing code to use Modbus4J? We offer limited free support for this.
-
You are providing the SerialPortWrapper to the Modbus master you're creating an instance of, correct? If so you should set a breakpoint in your serial port wrapper and see what happens in the serial library you're wrapping for the 232 setup you're testing when it tries to get the input or output stream from your wrapper.
-