USB Trouble Reading NavX

I’m probably doing something dumb, but I’m having trouble getting data from our Nav X over USB. I’ve got the code trying to read from serial port kUSB2, and when the code starts I either get no reading at all, or something nonsensical (e.g., 650 degrees for pitch). If I unplug the NavX and plug it into the other USB port, after a couple of seconds the data starts updating and makes sense. If I reset the the Robo Rio (leaving the same code), again the NavX doesn’t provide data. With the code still running, if I remove the USB cable from the current port and put it back in the first port, it starts working again.

I have a NavX classic and a RoboRio 2.0. I’ve tried different cables with the same result. I’ve connected the NavX to the PC and confirmed with the NavXUI app that the NavX functions properly.

Do I need to add code to configure the USB ports? I don’t think we’ve had to do that in the past and I don’t see it in the NavX example code.

Thanks for the assistance.

One new piece of data. When the USB is not working, sttl -F show a baud rate of 9600 on the tty device for the serial port. When I reconnect to the other USB port and it begins working, the baud rate shows 57,600. Is there anyway to set this up in advance so when the NavX AHRS class creates the serial port, its set up with this rate? Better yet, why isn’t the RoboRIO or WPILIB doing this automatically?

What happens if you use kUSB or kUSB1? This page says to use kUSB:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.