Hey,
Yeah, I am having a similar problem. I can write just fine. I set up
a comm connection to the hyper term. But I can't receive anything
back. I'll let you know what I find. I ended up building my own rxtx
lib, but same problem so I don't think thats the issue.
Quoting tedapt <>:
> thanks Justin. I seem to have had some limited success with rxtx 2.1
> (the one you mention first) by simply creating a symlink
> from /dev/ttyAMO to /dev/ttyS0 (ln -s /dev/ttyAM0 /dev/ttyS0). Still
> having problems communicating with a Modbus device, but otherwise
> Java is acting like it finds and can open the serial port (of course
> my "solution" may be part of the problem!)
>
> Current problem is that though my app claims to open connections and
> make Modbus requests on /dev/ttyS0, I'm unable to get a readable
> response back (this code works properly on another platform). I need
> to do some further testing with some simple Serial code to prove to
> myself I can really write and read with the port properly.
>
> I'm wondering if I need to configure my serial port somehow (not very
> experienced with serial ports, not sure if that's required or takes
> care of itself). My app sets connection params of 9600 baud, no
> parity, 8 data bits, 1 stop bit. Anyone know if the linux system
> (perhaps using stty) needs to configure the port to match this, or is
> it only the client app at the other end of the communication that
> needs to match the same parameters?
>
> Also, I'm using JamVM, so my RXTXcomm.jar was placed
> in /usr/lib/jamvm (also where I placed librxtxSerial.so)
>
> Further, I was unable to enumerate the serial ports using rxtx 2.0.
> I would settle for a working rxtx 2.1 solution, and from the rxtx
> documentation it seems that rxtx 2.1 is the preferred solution when
> possible to use it (i.e., when have ability to import gnu.io classes
> instead of javax.comm).
>
> --- In wrote:
>>
>> I am working on the same thing, didnt want to respond till I an
> answer
>>
>> You can download the most current version of the arm-unknown-linux-
> gnu
>> binary at rxtx site:
>> ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-
> 2.3.5/arm-unknown-linux-gnu/
>>
>> The easyest way to add the ttyAMx com ports is to set the system
> properties:
>> jamvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyAM0:/dev/ttyAM1 foo
>>
>> The other way:
>> RXTXCommDriver.java is
>> available in ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-7pre2/src/
> Download the
>> RXTXCommDriver.java. In this code, you will find
>>
>> if (osName.equals ("Linux")) { String[]Temp = { "ttyS", // linux
> Serial
>> Ports "ttySA" // for the IPAQs }; CandidatePortPrefixes = Temp;
>>
>> Replace this code with
>>
>> if (osName.equals ("Linux")) { String[]Temp =
> { "ttyS", "ttyAM", // linux
>> Serial Ports "ttySA" // for the IPAQs }; CandidatePortPrefixes =
> Temp; }
>>
>> Compile the RXTXCommDriver.java and add the resulting
> RXTXCommDriver.class
>> file to RXTXcomm.jar
> in /usr/java/jdk1.5.0_07/jre/lib/ext/RXTXcomm.jar
>>
>> Hope this help,
>> Justin
>>
>>
>>
>> Quoting tedapt <>:
>>
>> > Can anyone clarify Dave's statement about the use of rxtx:
>> >
>> > > note: you have to add the arm's /dev/ttyAMx to rxtx, it
> doesn't
>> > know about them
>> >
>> > Also, any notes from anyone who has successfully setup and used
> rxtx
>> > with jamvm would be appreciated!
>> >
>> > The setup I'm attempting to get working is:
>> >
>> > - TS-7250
>> > - debian on a USB thumbdrive
>> > - jamvm installed via apt-get
>> > - downloaded rxtx rxtx-2.0-7pre1 for Linux from:
>> > http://users.frii.com/jarvi/rxtx/download.html (file at
>> > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-7pre1-i686-pc-linux-
> gnu.tar.gz)
>> > - extracted librxtxSerial.so and placed it in /usr/lib/jamvm
>> > - using Sun's comm.jar (from a Java 1.3 distribution)
>> >
>> > When I invoke the test class (source below) I get these results:
>> >
>> > root# /usr/bin/jamvm -cp .:comm.jar SerialTest /dev/ttyAM0 9600
>> > Specified serial port (/dev/ttyAM0) does not exist
>> > null
>> > javax.comm.NoSuchPortException
>> > at
>> > javax.comm.CommPortIdentifier.getPortIdentifier
> (CommPortIdentifier.java:105)
>> > at SerialTest.main(SerialTest.java:32)
>> >
>> > Here's source for SerialTest.java:
>> >
>> > import java.io.IOException;
>> > import java.io.InputStream;
>> > import java.io.OutputStream;
>> > import java.util.Enumeration;
>> >
>> > import javax.comm.CommPortIdentifier;
>> > import javax.comm.NoSuchPortException;
>> > import javax.comm.PortInUseException;
>> > import javax.comm.SerialPort;
>> > import javax.comm.UnsupportedCommOperationException;
>> >
>> > public class SerialTest {
>> >
>> > private static SerialPort sp;
>> > private static InputStream sin;
>> > private static OutputStream sout;
>> >
>> > public static void main(String[] args) {
>> > try {
>> > if (args.length != 2) {
>> > System.out.println("Usage: java
> SerialTerm.tini port_name data_rate");
>> > System.out.println("Available ports
> are:\n");
>> > Enumeration ports =
> CommPortIdentifier.getPortIdentifiers();
>> > while(ports.hasMoreElements()){
>> > System.out.println
> (ports.nextElement() + "\n");
>> > }
>> > System.exit(1);
>> > }
>> > String portName = args[0];
>> > int baudRate = Integer.parseInt(args[1]);
>> > try {
>> > sp =
>> > (SerialPort)CommPortIdentifier.getPortIdentifier(portName).open
> ("SerialTerm",
>> > 5000);
>> > sp.setSerialPortParams(baudRate,
> SerialPort.DATABITS_8,
>> > SerialPort.STOPBITS_1,
>> > SerialPort.PARITY_NONE);
>> > sin = sp.getInputStream();
>> > sout = sp.getOutputStream();
>> > } catch (NoSuchPortException nsp) {
>> > System.out.println("Specified serial port ("+portName+
>> > ") does not exist");
>> > throw nsp;
>> > } catch (PortInUseException piu) {
>> > System.out.println("Serial port "+portName+
>> > " in use by another application");
>> > throw piu;
>> > } catch (UnsupportedCommOperationException usc) {
>> > System.out.println("Unable to configure
> port:"+portName);
>> > throw usc;
>> > } catch (IOException ioe) {
>> > System.out.println(
>> > "Unable to acquire I/O streams for
> port
>> > " + portName);
>> > throw ioe;
>> > }
>> > } catch (Exception e) {
>> > System.out.println(e.getMessage());
>> > e.printStackTrace();
>> > }
>> > }
>> >
>> > }
>> >
>> > --- In Dave Cramer <davec@> wrote:
>> >>
>> >> I've been running jamvm on mine for quite a while. You don't need
>> >> jikes, unless you plan to compile on the arm (Very slow)
>> >> I pulled alot of the gnuclasspath out, and the whole thing is
> quite
>> >> small. Around 4M or so
>> >>
>> >> you need rxtx for serial port work with java,, other than that
> it's
>> >> write once deploy everywhere
>> >>
>> >> note: you have to add the arm's /dev/ttyAMx to rxtx, it doesn't
> know
>> >> about them
>> >>
>> >> Dave
>> >> On 7-Nov-06, at 8:57 PM, gunghoiguana wrote:
>> >>
>> >> > The install was much easier than I anticipated:
>> >> >
>> >> > apt-get install jikes
>> >> > apt-get install jamvm
>> >> > apt-get install jikes-classpath
>> >> >
>> >> > Everything seems to work fine, and I can run class files that I
>> >> > compiled on my desktop PC. I've only checked out basic
> functions and
>> >> > console IO so far, but I'll be checking out the serial port and
>> >> > network interfaces soon. Java is *supposed* to make those
> things
>> >> > easy...
>> >> >
>> >> > Brian
>> >> >
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>>
>
>
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|