Hello,
I am using RXTX:
Native lib Version = RXTX-2.2pre2
Java lib Version = RXTX-2.1-7
WARNING: RXTX Version mismatch
Jar version = RXTX-2.1-7
native lib Version = RXTX-2.2pre2
I have configured several UARTS, ttyO0, ttyO4 and ttyO5. When I try to open any of the serial devices using the RXTX libary I get:
Online connect to device is not available, device not ready!
I also wrote a libary in C which opens the serial port and communicates to another Beaglebone Black. This works fine and I have bi-directional communication.
I can’t see why the RXTX java library isn’t working, any suggestions, here is a snippet of the java code, with additional test lines in.
public static CommPortIdentifier validateDevice(String strDev) {
CommPortIdentifier portId = null;
System.out.println("Validating: " + strDev);
try {
portId = CommPortIdentifier.getPortIdentifier(strDev);
System.out.println("portId: " + ((portId == null)?"null":"ok"));
SerialPort serialPort = (SerialPort)portId.open("Demo application", 5000);
System.out.println("serialPort: " + ((serialPort == null)?"null":"ok"));
int intPortType = portId.getPortType();
System.out.print("port type: " + intPortType + "...");
if ( intPortType == CommPortIdentifier.PORT_SERIAL ) {
// The port is valid on this system
System.out.println("ok");
return portId;
}
} catch( Exception ex ) {
portId = null;
System.out.println(strDev + " ... could not validate");
}
return null;
}
I pass the routine “/dev/ttyO5”, but it doesn’t get as far as the second println statement.
Thank you,
Simon