Debian Codegraph @

SerialPortInstructions.txt

raw
1 Thu Jan 18 15:59:35 MST 2001 removed jcl references for rxtx 1.5 Trent.
2
3 The Following was contributed by Vaibhav Andleigh [email protected] in hopes
4 that it will make getting started easier for people new to commAPI.
5
6 Feel free to contribute additional information in the same spirit.
7
8 Hi Trent,
9
10 I recently installed javax.comm and RxTx on a few systems and had to write
11 a very detailed HOWTO on read/writing to your com ports on linux for
12 beginners. BTW, RxTx is a great tool! In any case, I've included the
13 HOWTO with this email for the reference of other users. Feel free to post
14 it.
15
16 ------------------------
17
18 SerialPortInstructions.txt
19
20 To get serial port stuff running:
21
22 Serial Connection without Java
23
24 First, let's setup the serial connection without java and test it.
25 Connect your computer to another computer/device via a null modem serial
26 cable. Be sure the other computer/device has software (i.e., minicom)
27 to receive the signal. For the purpose of these instructions, I'll
28 assume you have a computer at each end, and will use minicom to
29 perform the connection testing.
30
31 In the case of minicom (on the receiving machine), you'll probably have
32 to run it as root (since the serial port is owned by root for security
33 purposes). It's not a good idea to change these permissions. If this
34 is the first time minicom is being run, you'll have to configure it
35 first. To do this, ssh to root (not su, anywhere in these instructions)
36 and type 'minicom -s' without the quotes. Arrow to option 3 and change
37 the serial configuration device to '/dev/ttyS0' without the quotes.
38 Exit minicom. Then go and run minicom by typing 'minicom -m -c on'
39 without the quotes. Assuming you're running minicom on both machines,
40 run a quick test of the serial connection. Type Alt-Z (or whatever
41 key-combo gives you help on special keys) and select "Local Echo"(E).
42 Now type text on both minicom screens and see that the text is going
43 back and forth.
44
45 Java.comm and RxTx installation
46
47 First install javax.comm api following Sun's instructions
48 Be sure to follow the instructions about placing the comm.jar
49 in the correct directories. You can ignore the details of
50 the javax.comm.properties files since it'll be replaced by RxTx
51 anyways.
52
53 Then install rxtx-1.4-4 following instructions given in
54 their install page. They have a really useful bit of info
55 in the INSTALL file talking about where the comm.jar,
56 javax.comm.properties files(and its contents) are supposed to go
57 (and what other files (libSerial.so and libParallel.so)should
58 have been created and where). Verify this happened properly.
59 Assuming you're using jdk-1.2, you can ignore the CLASSPATH
60 stuff in their extra directions. If you still have problems, they
61 have a really useful COMMON PROBLEMS section further down in the
62 INSTALL file.
63
64 Running Trial Applications
65
66 We'll test two apps: BlackBox and the Simple demos. These are
67 included in your .../java/commapi/samples directory. Go to
68 .../java/commapi/samples/BlackBox/ and type javac *.java to compile
69 all the classes.
70
71 Then create a run shell script as follows (substitute your own relative
72 java location if necessary):
73
74 runBlackBox.sh
75 #!/bin/sh
76 /usr/local/java/bin/java -classpath
77 ./:/usrlocal/java/jre/lib/ext/comm.jar:/usr/local/java/samples/BlackBox/BlackBox.jar
78 BlackBox
79
80 Run this script as ROOT using ssh, not su!
81 [or make sure permissions for the device files allow the user/group to read
82 them. See also: lockfiles in INSTALL]
83
84 It should put up a screen with a GUI of everything going on for each
85 of your serial ports. At the top of the screen, you can set the baud
86 rate. Unless you changed the settings on minicom, it should be expecting
87 38400 so select that. Go ahead and type in the first left text window
88 and you should see the text appear in the receiving minicom window.
89
90 If you choose to run the apps labeled as "Simple", go to the
91 .../java/commapi/samples/Simple/ directory and edit the SimpleWrite.java
92 and SimpleRead.java files. Convert the /dev/tty/a to /dev/ttyS0 in both
93 files. Compile both files using javac *.java . Use a run script very
94 similar to that above (deleting the path reference to BlackBox.jar and
95 replacing BlackBox with SimpleRead/SimpleWrite as appropriate).
96 Set up minicom on the other machine and go ahead and run the script.
97 It should all work. I've attached the run scripts I used for both
98 programs below:
99
100 runSimpleRead.sh
101 #!/bin/sh
102 /usr/local/java/bin/java -classpath
103 ./:/usrlocal/java/jre/lib/ext/comm.jar
104 SimpleRead
105
106 runSimpleWrite.sh
107 #!/bin/sh
108 /usr/local/java/bin/java -classpath
109 ./:/usrlocal/java/jre/lib/ext/comm.jar
110 SimpleWrite
111
112
113
114
115
116 **********************************************
117 Vaibhav Andleigh
118 [email protected]
119 http://utopia1.mit.edu/vab/
120 ------------------------------------------------------
121 Ph.D. Student, Dept. Mat. Sci. & Engr
122 MIT Room 13-5142 Ph: 617-258-8847
123 Cambridge, MA Fax: 530-348-8219
124 **********************************************
125 "Every man dies, not every man really lives."
126 --William Wallace, Braveheart