NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Steven Zedeck Posted via mailing list.
|
Posted: Thu Sep 03, 2009 1:43 pm Post subject: Strange SerialPort issue |
|
|
Hi,
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 command):
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 192.68.111.1 -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 */
CommPortIdentifier dutComPortIdentifier;
SerialPort myDutPort;
CommPort theDutPort;
private String dutComPort = "";
dutComPortIdentifier = (CommPortIdentifier)map.get(dutComPort); /* this is
previously filled in with map.put */
theDutPort = dutComPortIdentifier.open("Serial Port", TIMEOUTSECONDS *
1000);
myDutPort = (SerialPort)theDutPort;
myDutPort.setSerialPortParams(BAUD, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
/* 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
Linux?
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,
Steve
--
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. |
|
| Back to top |
|
 |
|
|
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
|
|