Go to Post I think with 1114 & 217 as our partners we could have won with my refrigerator on the field. - JVN [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-05-2015, 15:29
stu54 stu54 is offline
Registered User
None #2458
 
Join Date: Jul 2014
Location: US
Posts: 11
stu54 is an unknown quantity at this point
RS-232 Port Problem

I am trying to use the RS-232 port. I do have console out turned off in the NI web-based tool. Here is my init code in the constructor:

serial = new SerialPort( 9600, SerialPort.Port.kOnboard );

Then in my loop in operatorControl() I have:

String ss = serial.readString();

And that causes this trace on the driver station console:

ERROR Unhandled exception: java.lang.RuntimeException: Code: -1073807298. HAL - VISA: General IO Error at [edu.wpi.first.wpilibj.hal.HALUtil.checkStatus(HALU til.java:48), edu.wpi.first.wpilibj.SerialPort.getBytesReceived( SerialPort.java:326), ...


I get the same traceback even if I have nothing connected to the
RS-232 port.

Any ideas?
Reply With Quote
  #2   Spotlight this post!  
Unread 06-05-2015, 15:41
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: RS-232 Port Problem

I don't have time to check on it now, but you may be colliding with a predefined object named serial. Changing the name of the object to something more specific (e.g. my232port) can quickly determine if this is the issue; if you get the same error, that wasn't it.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 07-05-2015, 10:35
stu54 stu54 is offline
Registered User
None #2458
 
Join Date: Jul 2014
Location: US
Posts: 11
stu54 is an unknown quantity at this point
Re: RS-232 Port Problem

Looks like the problem is the data being transmitted. Loopback on RS-232 works fine. I am trying to read the ASCII put out by a Max Sonar but I am
guessing the syntax violates the VISA standard that the serial ports rely on so
the code crashes. I also tried the MXP port with the same results. (I did have a TTL-to-RS232 adapter when I tried the RS-232 port).
Reply With Quote
  #4   Spotlight this post!  
Unread 07-05-2015, 14:31
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: RS-232 Port Problem

I had done a longer post this morning - not sure where it went.

Have you tried serial.reset()? I would suggest this immediately after the constructor.

You might also try manually calling serial.getBytesReceived() to see if it returns zero, an error, or something else.

Have you tried getting an error message from HALUtil? I'm not familiar with the HAL subsystem, and I was surprised to see it coming from a serial port; I suppose that the USB is somewhere behind the HAL system. The following should return a string that might prove enlightening:
Code:
edu.wpi.first.wpilibj.hal.HALUtil.getHALstrerror()
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:07.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi