Posted via mailing list.
|Posted: Thu Sep 03, 2009 1:43 pm Post subject: Strange SerialPort issue
I've developed a Java GUI application with NetBeans. Its running on
WindowsXP. It sends commands and receives responses via a SerialPort. On the
other end is a Linux box. At certain points in time, the Linux box is
executing U-Boot and the Java app sends U-boot commands and receives
responses. This works fine. By the way, the Baud rate is 115200.
Later in time, the Linux box is booted up into Linux. At this point the Java
app sends Linux commands and receives responses. Now for the problem.
Sometimes Linux doesn't see the entire command string. Here is an example. I
intend to send this command to the Linux box to be executed (its a basic
ping 192.168.111.1 -c 2 -w 4
However, Linux sees only part of the command line sometimes. Here are some
of the commands that it "sees":
ping 192.168.111.1 -c 2 w 4 (missing -)
ping 192.168.111.1 -c -w 4 (missing 2)
ping 92.168.11 (lots missing)
ping 220.127.116.11 -c 2 -w 4 (missing 1)
Here is a code snipit to show how I contruct the PrintStream:
protected BufferedReader is; /* input stream from DUT */
protected PrintStream os; /* output serial stream to DUT */
private String dutComPort = "";
dutComPortIdentifier = (CommPortIdentifier)map.get(dutComPort); /* this is
previously filled in with map.put */
theDutPort = dutComPortIdentifier.open("Serial Port", TIMEOUTSECONDS *
myDutPort = (SerialPort)theDutPort;
/* setup DUT input stream */
is = new BufferedReader(new InputStreamReader(theDutPort.getInputStream()));
/* setup DUT output stream */
os = new PrintStream(theDutPort.getOutputStream(), true);
Throughout my code, I basically do the following to send the commands:
os.println(commandString); /* commandString is a string */
Here is an exact command line:
os.print("ping " + wifiPingIpAddressString + " -c 2 -w 4\n");
Any ideas why a port of the stream get chopped from the perspective of
The reason I know its getting chopped is that if I exit my Jaav app to
release the serial port and then open TeraTerm to access the Linux command
lnie, I can then "up-arrow" and see the commands it thinks it got. The
examples I gave above show what it sees.
Shouldn't I be able to use the same serial port stream and configuration
when I talk with U-boot vs. Linux?
Any help would be greatly appreciated.
Thanks in advance,
View this message in context: http://www.nabble.com/Strange-SerialPort-issue-tp25276355p25276355.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum