Log in

View Full Version : Trouble with serial port: HAL - VISA: Resource Not Found


Techwiz
17-03-2015, 22:36
Greetings, we hare having trouble using our NavX MXP via its USB connection.

We have our NavX connected using a USB cable as described:
https://code.google.com/p/navxmxp/wiki/AdvancedInstallOptions#One-wire_Connect_via_USB_cable

When running the sample code https://code.google.com/p/navxmxp/source/browse/trunk/roborio/java/navXMXPSimpleRobotExample/

We get the following exception:

ERROR Unhandled exception: java.lang.NullPointerException at [
org.usfirst.frc.team2465.robot.Robot.operatorContr ol(Robot.java:93),
edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:148),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]

The error appears to be referring to the first use of the imu object.
boolean is_calibrating = imu.isCalibrating();

Further investigation reveals that the SerialPort may be the culprit.
We moved the following line of code into the robotInit method yields a more descriptive error:

(Robot.java:81)SerialPort my_serial_port = new SerialPort(57600,SerialPort.Port.kUSB);

ERROR Unhandled exception: java.lang.RuntimeException: Code: -1073807343. HAL - VISA: Resource Not Found at [
edu.wpi.first.wpilibj.hal.HALUtil.checkStatus(HALU til.java:48),
edu.wpi.first.wpilibj.SerialPort.<init>(SerialPort.java:198),
edu.wpi.first.wpilibj.SerialPort.<init>(SerialPort.java:251),
org.usfirst.frc.team2465.robot.Robot.robotInit(Rob ot.java:81),
edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:121),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]

Any Ideas?

slibert
18-03-2015, 15:40
If you are using the USB serial port, make sure that the RoboRio is actually recognizing the port, by using the web dashboard. There's more info about how to ensure the binding is working correctly on the nav6 Troubleshooting page (http://code.google.com/p/nav6/wiki/Troubleshooting).