CANSparkMax throws Exceptions when CAN bus is bad, and how to tell API version

java

#1

We inadvertantly shorted our CAN bus today (“oh, that’s a shorting jumper, not a termination resistor?”), and the SparkMAX Java API threw an exception, immobilizing our robot.

Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -35007. Unknown error status
Error at com.revrobotics.CANSparkMaxLowLevel.getFirmwareVersion(CANSparkMaxLowLevel.java:283): Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -35007. Unknown error status
at edu.wpi.first.hal.CANAPIJNI.writeCANPacket(Native Method)
Robots should not quit, but yours did!
at edu.wpi.first.wpilibj.CAN.writePacket(CAN.java:77)
at com.revrobotics.CANSparkMaxLowLevel.getFirmwareVersion(CANSparkMaxLowLevel.java:283)
at com.revrobotics.CANSparkMaxLowLevel.<init>(CANSparkMaxLowLevel.java:239)
at com.revrobotics.CANSparkMax.<init>(CANSparkMax.java:146)
at org.usfirst.frc3620.robot.RobotMap.init(RobotMap.java:87)
at org.usfirst.frc3620.robot.Robot.robotInit(Robot.java:53)
at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:63)
at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:263)
at org.usfirst.frc3620.robot.Main.main(Main.java:20)
The startCompetition() method (or methods called by it) should have handled the exception above.

I just notified REV support about this, but getting it “out there”. The idea of a intermittent CAN bus wiring fault rebooting the robot is not one I like.

I didn’t see any postings about this, but I’m not as adept with the new CD as I was with the old…

On a related note: how do I tell what version of the Spark MAX Java API I have? Does that auto-update once we add the vendor library to VScode, or do we need to manually update that?


#2

Thanks for the note. We’ve addressed this in our beta release, it is not part of auto-update yet since we’ve separated the beta from the ‘main’ release set. You can find more details about it here

To find the version an easy way is to go to the WPILib Menu and run ‘Manage Vendor Libraries’ which will show what you have installed for that project (checking the box will uninstall if needed).


#3

We had the same issue and tried to fix it by upgrading to beta but then the error says that the MAX on CAN 0 doesn’t have the latest firmware disabling the robot.


#4

@Will_Toth is there a way from our Java program tell what API we have ?


#5

The easiest way to tell the installed version is to go to the WPILib plugin and go to ‘Manage Vendor Libraries’.

We don’t have a way to check from the API itself right now, we will add this to our roadmap to add for a future release.