PDA

View Full Version : rxtx serial port event problems with usb adapter



siriyu
March 28th, 2009, 10:45 AM
My java application communicates with datalogger via rs232. Rxtx library works fine on *linux and windows system using serial port. The problems come when I use an usb* adapter* FTDI chip-set based (http://www.ftdichip.com/Products/EvaluationKits/US232R-10.htm) on my lunux system (2.6.24 kernel), where there is no need of driver. On windows instead I have no problem. My program is event based; This adapter works correctly using Mincom. But in my program I use serialPort.notifyOnDataAvailable(true) and serialPort.notifyOnOutputEmpty(true)* calls.
My application send first message correctly but I get an error in response:
at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
at gnu.io.RXTXPort.nativeDrain(Native Method)
at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort. java:1201)

*If I comment flush() command after send first message I have no response and my time-out exceeds. It seems there are problems when generating SerialPortEvent.DATA_AVAILABLE event.
How can I resolve this problems ?

Best regards.

Luca Catoni

Zugzwang
March 28th, 2009, 02:25 PM
Make sure to use the JVM by SUN. See the stickies on how to do that.

siriyu
March 30th, 2009, 12:40 PM
I have installed my jdk in this way: sudo apt-get install sun-java6-jdk.

So I have sun JVM.

Zugzwang
March 30th, 2009, 01:09 PM
I have installed my jdk in this way: sudo apt-get install sun-java6-jdk.

So I have sun JVM.

Not necessarily. You have installed the Sun JVM but you will normally have multiple JREs installed. Try:


sudo update-alternatives --config java