Teleop to No Comms?


I am at a loss here.

I was able to download and run C++ code just fine on our robot, but when I went to make a small change, something happened…

The Driver Station connects (tethered) to the cRIO, and the “Teleoperated Disabled” message appears, but less than 2 seconds later, it loses communications, and then cycles through this process.

We have tried reformatting the cRIO, and it did not help.


Forgot to mention, we have tried changing out the battery, and this does not help.

Code vs hardware

After you reimaged the cRIO

  • Did you get a solid Communications before downloading any code?
    *]Did you download and test with unadulterated default code?

We tried default code, with still the same error.

We are able to get solid communications before we downloaded, and after downloading the default code, we get the same problem.

To help determine if it is user code or something else, you may want to flip the user code dip switch off and reboot to see if the symptom goes away.

Also, when you say you reformatted the cRIO, the dialog is a bit confusing to some, and if it took only a few seconds, it didn’t actually reformat. There is a checkbox below for formatting, and it will typically take ten minutes to reformat.

If this seems to be code, look more closely at the latest small code change, work backwards until the issue goes away, or set a breakpoint and step through the new code.

Greg McKaskle

We solved the issue after several hours of formatting the cRIO and reverting to previous code.

What happened was:

We would
1: Download code to the cRIO.
2: Launch the Driver Station and connect.
3: Get connection (the Robot Code, Connection lights etc) would work, and the Driver Station would display: “Teleop Disabled”, for like I said, less than 2 seconds, and it would instantly lose communication.

We would then be unable to connect long enough to the cRIO to download new code, meaning we would format the cRIO everytime.

I flipped the Safe Mode switch and the Console Out switch, and used the cRIO imaging tool to format it. After it formatted the cRIO, I would flip the dip switches back to normal, and use the cRIO imaging tool to set the cRIO for C++.

The same problem would persist, even with default code.

Eventually I got it to work, by using the Safe Mode, Console Out, the IP Reset one, and by holding down the reset button.

I was then able to get default code working, and downloaded code that was working from the day before.

So I guess it was my code doing something. However, the only change I made, right before the cRIO started hating me ( :frowning: ) was I added 2 printf statements.
One of the printf was displaying the rate of one of our encoders, because I think the encoder might have died.

Would that have caused the issue? Trying to read data from a broken encoder?

Although I think it is weird that my code would effect the robot before it was enabled…

Like I said in the earlier post, were you really reformatting, or just running the tool to change languages? A true format takes minutes and reboots the controller numerous times.

The dip switches for resetting IP and things like that should have had no impact.

As for how a printf can crash a program? Are you calling functions inside the printf or are you dereferencing pointers or calling copy constructors, constructors, descructors? Those sorts of things can have bugs in them that haven’t been visited, then you call them as a side-effect and BOOM.

Greg McKaskle

Yes, we really re-formatting. We checked the Format check-box.

I was calling the functions inside it, to return a number.

I don’t know why, but when we flipped the IP Reset switch and pressed the reset button on the cRIO, it finally worked.

Also, we had a similar problem the day before, but less “severe”.

We could get a steady connection, and download the code we used during competition just fine, and it would run the autonomous code without crashing, but as soon as you enabled tele-op, it would lose connection. (This was without any printfs)

Your code is running as soon as the robot finishes booting. It doesn’t wait to be Enabled.
Enabled is just another state your code should check for as it’s running.

You might want to look at what your code is doing during the disabled states.