LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-19-2006, 08:57 AM   #1
Tuatha
LQ Newbie
 
Registered: Apr 2006
Posts: 5

Rep: Reputation: 0
Question Odd Side effects of using gnu.io.SerialPort.setSerialPortParams (from RxTx v2.1.7)


I have a VFD display (Matrix Orbital VK204-24-USB) which uses a USB connector but employs serial communication. I have FTDI USB serial driver working and associated with /dev/ttyUSB0 (came with the distro, v2.6.12-10-386), I checked dmesg all was OK). javax.comm.properties has the correct driver=gnu.io.RXTXCommDriver line in it.

I downloaded RxTx v2.1.7 (from SourceForge).

I tested the port with kermit & it works fine (both simple strings and control sequnces (ie >= ASCII 128)). I then modified the sample simpleWrite class to send both strings and control sequences to the USB serial port. Former WORKS latter doesn't :-(

I checked the settings with stty & found this:

(after initial sane)
speed 19200 baud; line = 0;

(after running my app.)
speed 19200 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

Now, my question (*FINALLY*) is what is setting those values & is that what's stopping the 8bit stuff being passed to the port properly (as kermit does perfectly well)???? How do I send the char 0xFE (+ some other bytes) to control my display properly??

Summary of Libraries/Methods used in my Java code:

import java.io.*;
import java.util.*;
import gnu.io.*;

<snip>

portList = CommPortIdentifier.getPortIdentifiers();
serialPort = (SerialPort) portId.open(self, 2000);
outputStream = serialPort.getOutputStream();
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
serialPort.setSerialPortParams(19200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_N ONE);
serialPort.notifyOnOutputEmpty(true);
outputStream.write(message.getBytes()); (with 2000ms sleep)
serialPort.close();

Other details:
O/S: Ubuntu v5.1.0 (Breezy Badger)
Port Setting needed: 8N1 + no flow control

I would *LOVE* to get this great little display working in Linux as I don't want yet another XP box!

SG
 
Old 04-19-2006, 10:09 AM   #2
Tuatha
LQ Newbie
 
Registered: Apr 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Unhappy

Followup

I manually set the port to the setting shown using stty with various params cut'n'pasted in. I then tried kermit again & it still works (only thing is it added ignbrk when it started up).

So it appears that although the Java app may be settign some things you could argue it shouldn't, it doesn't seem to be that that's bearking it. Sigh...

So any idea why I can't send 0xFE char to a USB serial port using Java (OutputStream writeCharToUSBSerialPort.outputStream) ????
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
side effects of removing certain services tom_from_van Linux - Security 2 07-21-2005 10:33 AM
Question for serialport joypad!Help! tonewangl Linux - Software 0 06-29-2005 10:23 AM
USB Mouse randomly freezes with new 2.6.x Kernels + funny side effects phrog Linux - Hardware 0 11-23-2004 01:31 AM
Wvdial and RxTx issue Pashmina Linux - Newbie 0 07-12-2004 06:42 AM
Poll on Device::SerialPort killed by ^C chr15t0 Programming 5 10-16-2003 09:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration