Ubuntu javax.comm serial usb issues


Advertisements

I am experiencing some strange behavior when communicating with an Arduino board from a Java program using the javax.comm library. I am running the Java program on a VIA Pico-ITX with Ubuntu 9.04 Server 32-bit Alternate Installation. The version of javax.comm is "comm3.0_u1_linux".

If I boot the computer and immediately run the Java program, I receive about 2 lines per second with every other line being blank. I am expecting roughly 20 lines per second. In this scenario the buffer also appears to be getting backed as events on the Arduino are not carried through the serial data for several seconds.

If I boot the computer and run Minicom, I am able to receive the full 20 lines per second without issue. My config is /dev/ttyUSB0, 9600 8N1, No HW control, No SW control.

If I run the Java program after running Minicom, it behaves differently. It receives the information at the correct rate, but will stop receiving data at least once or twice. If I keep restarting the program, eventually I can receive data at the correct rate indefinitely.

I have removed all sources of interference, including my DC motors, USB wireless module and physically separating the computer from the Arduino. I have also attached the Arduino to my Windows7 PC and the Java program works perfect there.

Here's my script for setting up the javax.comm libraries and USB Serial configuration:

#!/bin/sh

# constants
JAVA_HOME=/usr/lib/jvm/java-6-sun/jre

# ensure running as root
if [ `id -u` -ne 0 ] ; then
echo error: you must be root to run this script
echo error: no changes have been made to the system
exit 1
fi

# install the library
cp commapi/lib/libLinuxSerialParallel.so $JAVA_HOME/lib/i386/
chmod 644 $JAVA_HOME/lib/i386/libLinuxSerialParallel.so
cp commapi/jar/comm.jar $JAVA_HOME/lib/ext/
cp commapi/jar/comm.jar `pwd`

# setup the javax.comm.properties file
cp commapi/docs/javax.comm.properties $JAVA_HOME/lib/
ln -s $JAVA_HOME/lib/javax.comm.properties `pwd`/javax.comm.properties

# SPECIAL add usb-to-serial device to properties file
sed -i -e '/serpath1 = \/dev\/ttyS1/aserpath2 = /dev/ttyUSB0' $JAVA_HOME/lib/javax.comm.properties

Here's the relevant part of the javax.comm.properties:

# Implementation specific driver
driver=com.sun.comm.LinuxDriver

# Paths to server-side serial port devices
serpath0 = /dev/ttyS0
serpath1 = /dev/ttyS1
serpath2 = /dev/ttyUSB0

# Paths to server-side parallel port devices
parpath0 = /dev/parport0
parpath1 = /dev/parport1

Here's the relevant part of the Java program:

CommPortIdentifier port_identifier = CommPortIdentifier.getPortIdentifier("/dev/ttyUSB0");
SerialPort serial_port = (SerialPort)port_identifier.open("Arduino", 2000);
serial_port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

InputStream input_stream = serial_port.getInputStream();
reader = new BufferedReader(new InputStreamReader(input_stream));

output_stream = serial_port.getOutputStream();

// THIS IS DONE IN A CONTINUOUS LOOP
String command = reader.readLine();
System.out.println("received=" + command);

I've tried a lot of things but haven't been able to solve this issue. I am hoping someone with more USB Serial experience will be able to point me in the right direction.

Smilar Topics

  • Ubuntu & javax.comm

    I have a Java application that requires javax.comm but I cannot find it in the package manager. I've downloaded the Sun runtime for Mozilla so I can actually run Java apps (this is a .jar) so I'm just missing this library.Anyone help, please?Ta,Xeno ...

  • Ubuntu Actiontec Prism2.5 USB issues

    I am having difficulty setting up my Actiontec Prism2.5 wireless card under Ubuntu. I have read this thread (http://www.ubuntuforums.org/showthread.php?t=209351&highlight=linux-wlan-ng+prism2.5), which discusses similar issues but does not help me. Maybe it does help but I am relatively new to l ...

  • Ubuntu EDUP Ralink Wireless USB issues with ndiswrapper

    System specs:compaq@compaq-desktop:~$ uname -aLinux compaq-desktop 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686 GNU/LinuxI made sure the system had all the latest updates on it, as of March 24I followed this web page for what I describe below:https://help.ubuntu.com/community/W ...

  • Ubuntu Netgear WNA3100 wireless USB issues

    Am brand new to Ubuntu and this forum. I have loaded Ubuntu on to an old PC also running Win XP SP3. The PC has no networking capabilities other than a Netgear WNA3100 wireless USB device.The device works perfectly when in XP, but not so when in Ubuntu. I have trawled the forums and followed various ...

  • Ubuntu Belkin (Broadcom) Wireless USB Issues

    Hi. I am trying to run a Belkin F5D7051 Wireless G USB adapter in Ubuntu. On trawling the web for info, I can only find old pages with old solutions or people stating that it is impossible to run Broadcom chipsets in Linux. I have tried installing Ndiswrapper, to absolutely no avail. I am quite a ne ...

  • Ubuntu Maxtor Mini III USB issues

    I am having trouble with my new Maxtor Mini III USB drive. When I plug it in, it seems to auto-mount just fine, and I can read/write to it (formatted as FAT32), however even when connected to a USB 2.0 port, the speed is very slow.Looking at /var/log/messages, about every 31 seconds, give or take a ...

  • Ubuntu HELP!!! I have USB issues.

    I a relivetively new user to Ubuntu Linux. I have a few issue's which i hope yall can resolve. 1. Intermittent Panel non-responce on start up.2. My blackberry phone no longer being recognized on the system. They started happening at the same time.I am running a Dell Latitude 110L laptop with a Penti ...

  • Ubuntu Continued Network and USB Issues

    After an absolutely tragic attempt at upgrading to Gutsy with a fresh install and about a week and a half's worth of trying to get my internet connection functioning by transposing CLI info to my smartphone...I gave up.I am now using a fresh install of Feisty and it has been working like a dream unt ...

  • Ubuntu Help with serial-usb & programing

    I'm trying to read out a RS232 device from ttyUSB0... all I get is garbage.The cable/converter is fine - works under windows.It's recognized by the driverBus 002 Device 013: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Portbut when I read it out (java or low level 'c') I just get garbage... ...

  • Using javax.comm under Ubuntu

    I am trying to use the javax.comm package (Java serial comm under Ubuntu server edition.I downloaded the package from the Java site and did the following:1 - copied libLinuxSerialParallel.so to /usr/lib/2 - copied javax.comm.properties to [JDK-directory]/jre/lib/3 - copied comm.jar to [JDK-directory ...

  • Ubuntu java javax.comm installation

    I am using ubuntu 7.04 and I have gotten java setup and eclipse setup for programming java apps. Now I am trying to get the javax.comm package from sun setup so I can program the serial port but I am having troubles. Does anyone have any good references that step through how to install this in ubunt ...

  • Serial comm over USB

    New to programming serial comm over usb and cannot find what I am looking for through google yet.When doing I/O multiplexing using a select() call, how do you detect when a USB cable is unplugged, as I don't see select returning an error. ...

  • Ubuntu has anyone gotten a Wacom Digitizer 2 tablet to work with a serial/usb converter?

    i've got a old but previously functioning tablet i'd like to start using with my laptop. it's a wacom digitizer 2, and it only has a serial port. unfortunately, my laptop has no serial ports so i'll have to use a serial/usb converter. has anyone out here in ubuntu land gotten this to work with this ...

  • Ubuntu connecting to hp photosmart in serial usb

    sorry if what i need is already posted, apart from where i posted it before in the wrong forum, oops, i searched but couldnt find anything i could make work! and i'm not really sure what i'm doing, as i'm a bit clueless on kubuntu still........i'm trying to connect to my printer, i'm running Linux v ...

  • Ubuntu Serial USB/Perl 5 issue

    Did anyone have a problem accessing a serial USB device using perl5 on ubuntu 10.10?I have a script written in perl that was working fine on ubuntu 10.04, when accessing /dev/ttyUSB0 (USB to serial port)In the current version this script freeze or goes to an infinite loop when accessing the ttyUSB d ...

  • Ubuntu VirtualBox, Guest Windows networking and USB issues...

    I am using Ubuntu Intrepid 64 bit and and learning to solve many a issues. It has been interesting journey so far. Currently, struggling with some virtualization issues. The story goes like this:As wanted to wean from the "obvious" thrust upon option (Windows) and assert my own choice, my ...

  • Ubuntu USB Issues

    I am having some usb issues. It would be great if someone could offer some advice.I mainly use two devices. An Ipod 5th generation (ipod photo) and a samsung printer. Both devices have worked before on this computer, on this distribution (8.04).Intermittently the printer shows on lsub and connects t ...

  • Ubuntu Booting from USB issues

    I have a joggler device and have Ubuntu installed on a USB drive. If that USB drive is the only thing plugged in it boots fine. If I plug another USB device it doesn't boot.Now I am assuming this is a GRUB issue but I'm not really sure what to change and what I need to change it too.I was told this ...

  • Ubuntu Multiple Serial USB

    I have several serial USB converters attached to my computer. I have written some software that I use to monitor equipment via these serial ports. The problem I am having is that when ever the system reboots the /dev/ttyUSB? device names are assigned to different physical devices.How can I force the ...

  • Ubuntu Serial USB Device - cant load usbserial

    I have a problem to load the usbserial module.if i sudo modprobe usbserial vendor=0x0471 product=0x082dmy dmesg states [ 1062.416238] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic[ 1062.416276] /build/buildd/linux-2.6.24/drivers/usb/serial/usb- ...

  • Ubuntu 10.10 and USB 3.0 ?

    I recently got a Lenovo thinkpad W510 at work and I loaded Ubuntu 10.10 64 on it.I'm having some strange issues with the USB 3.0 on it though. When I plug in my hard drive dock into the USB 3.0 ports, the drive works for a couple of minutes then fails and none of my USB ports work, not even the one ...

  • Ubuntu New build, loads of issues

    I've recently put together a new rig with the following specs:GIGABYTE GA-EP45C-UD3RIntel Core 2 Quad Q9550 @ 2.83GhzEVGA GeForce 9800GTX4gbs mushkin ddr3 ram2 640gb Western Digigal hdd's20x Sony DVD+/-R SATA750watt Corsair PSUThis rig has given rise to problem after problem. The entire system hard- ...

  • Catching Parity Error on linux with IBM's javax.comm

    HelloI hope that I was chosen right forum for my question. Sorry if I'm wrong.I wrote simple Java class that uses IBM's implementation of Communications API for serial communication (javax.comm) and it works fine, except that when I run it on linux OS (Suse 9.0 and Suse 9.1) it did not recognize par ...

  • Catching Parity Error on linux with IBM's javax.comm

    HelloI hope that I was chosen right forum for my question. Sorry if I'm wrong.I wrote simple Java class that uses IBM's implementation of Communications API for serial communication (javax.comm) and it works fine, except that when I run it on linux OS (Suse 9.0 and Suse 9.1) it did not recognize par ...

  • Java SMS API and Javax.comm in Oracle9i

    I tryed to load a java SMS API to Oracle9i RDBMS as a java stored procedure. This API can send SMS via serial port and GSM device (modem).The java SMS API need javax.comm (sun "interface" to communicate via serial port) and a win32com.dll. The java SMS API need win32com.dll for success doing.The que ...

  • javax.comm for /dev/ttyS* IO errors

    hii install jdk1.6.0_18 and javax.comm 3 for linux in my asusEEE.i can compile all java source, i can detect serial ports, but when i try open serial port (ttyS0 or ttyS1), i have this error:Exception in thread "main" java.lang.RuntimeException:Error opening "/dev/ttyS1"tcgetattr ...

  • using modem by javax.comm

    i am trying to use modem to dial phone,i am able to do it but after some time i get tones like dtmf tones on the receiver phone,i am using javax.comm package for serial communication,i think some additional AT commands other than "ATA " is to be used but could not find.someone can guide me ...

  • Ubuntu External Hard Drive Sharing Issues

    Alright, so I have faith that someone here can help me. I have Ubuntu 10.10 32-bit loaded on one of my PCs. All of my other machines are Windows 7 64-bit (Ultimate and Professional). All of my network shares on my Ubuntu machine and working fine, the shares are all on the internal hard drive.I recen ...

  • Ubuntu Please advice: phantom usb audio interface that actually works

    Hi, I know there are a lot of posting on the subject. I've spent many hours reading on. Also I do know (almost by memory) alsa's matrix page, and also ffado's one BTW. But I have plenty of bad experiences with supposedly suported audio cards. For a few ones:- Hammerfall hdsp 9632. 350€. Mine. ...