NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Strange SerialPort issue

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Steven Zedeck
Posted via mailing list.





PostPosted: Thu Sep 03, 2009 1:43 pm    Post subject: Strange SerialPort issue Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo