Loop time of 0.02s overrun + Watchdog + etc

I’ve been getting that error for the past week. I can’t seem to figure it out. Everything else works but the tank drive with the SparkMAX neo brushless motors. We have tried commenting out the other functions other then the drive.

Here is the code:

/* Copyright © 2017-2018 FIRST. All Rights Reserved. /
Open Source Software - may be modified and shared by FRC teams. The code /
must be accompanied by the FIRST BSD license file in the root directory of /
the project. /

package frc.robot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.Spark;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.GenericHID.Hand;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import com.revrobotics.CANEncoder;
import edu.wpi.first.wpilibj.Watchdog;

public class Robot extends TimedRobot {
private DifferentialDrive m_myRobot;
//private SpeedControllerGroup m_leftDrive;
//private SpeedControllerGroup m_rightDrive;
private static final int leftDeviceID = 0;
private static final int rightDeviceID = 1;
private static final int leftDeviceID2 = 2;
private static final int rightDeviceID2 = 3;

private CANSparkMax m_leftMotor;
private CANSparkMax m_rightMotor;
private CANSparkMax m_leftMotor2;
private CANSparkMax m_rightMotor2;

private CANEncoder m_leftencoder;
private CANEncoder m_rightencoder;
private CANEncoder m_leftencoder2;
private CANEncoder m_rightencoder2;
private Spark intake;
private Spark intake2;
private XboxController gamePad;
private double leftAxisValue = 0;
private double rightAxisValue = 0;
private Spark lift;
private Watchdog help;
private DoubleSolenoid Claw;
public void robotInit() {

  • SPARK MAX controllers are intialized over CAN by constructing a CANSparkMax object
  • The CAN ID, which can be configured using the SPARK MAX Client, is passed as the
  • first parameter
  • The motor type is passed as the second parameter. Motor type can either be:
  • com.revrobotics.CANSparkMaxLowLevel.MotorType.kBrushless
  • com.revrobotics.CANSparkMaxLowLevel.MotorType.kBrushed
  • The example below initializes four brushless motors with CAN IDs 1 and 2. Change
  • these parameters to match your setup
    m_leftMotor = new CANSparkMax(leftDeviceID, MotorType.kBrushless);
    m_leftencoder = m_leftMotor.getEncoder();
    m_rightMotor = new CANSparkMax(rightDeviceID, MotorType.kBrushless);
    m_rightencoder = m_rightMotor.getEncoder();
m_leftMotor2 = new CANSparkMax(leftDeviceID2, MotorType.kBrushless);
m_leftencoder2 = m_leftMotor2.getEncoder();
m_rightMotor2 = new CANSparkMax(rightDeviceID2, MotorType.kBrushless);
m_rightencoder2 = m_rightMotor2.getEncoder();

//help= new Watchdog(0.02, callback);
SpeedControllerGroup m_left = new SpeedControllerGroup(m_leftMotor, m_leftMotor2);
SpeedControllerGroup m_right = new SpeedControllerGroup(m_rightMotor, m_rightMotor2);

m_myRobot = new DifferentialDrive(m_left, m_right);
intake = new Spark(4);

intake2 = new Spark(5);
lift= new Spark(6);
Claw= new DoubleSolenoid(1,2); 
//Solenoid_break= new DoubleSolenoid(1,2); 

// Initialize a single gamepad controller
gamePad = new XboxController(0);
leftAxisValue = gamePad.getRawAxis(1);
rightAxisValue = gamePad.getRawAxis(3);

public void teleopPeriodic() {
SmartDashboard.putNumber(“Encoder Position”, m_leftencoder.getPosition());
SmartDashboard.putNumber(“Encoder Velocity”, m_leftencoder.getVelocity());

 // Tank drive controlled with the left and right joysticks of the gamepad
 leftAxisValue = gamePad.getRawAxis(1);
 rightAxisValue = gamePad.getRawAxis(3);
 m_myRobot.tankDrive(leftAxisValue, rightAxisValue);
 // If the gamepad's right bumper is held, run the intake at 50% power
if (gamePad.getRawButton(6)) {
   } else if(gamePad.getRawButton(8)) {
     } else {
 //Elevator Lift
 if(gamePad.getRawButton(5)) {
 } else if(gamePad.getRawButton(7)) {
 }else {
 //Breaking System According to the Binder
 if(gamePad.getRawButton(2)) {
 }else if (gamePad.getRawButton(3)) {


Here is the Error:
********** Robot program starting **********
Unable to retrieve SPARK MAX firmware version please verify the deviceID field matches the configured CAN ID of the controller, and that the controller is connected to the CAN Bus.
Error at com.revrobotics.CANSparkMaxLowLevel.(CANSparkMaxLowLevel.java:253): Unable to retrieve SPARK MAX firmware version please verify the deviceID field matches the configured CAN ID of the controller, and that the controller is connected to the CAN Bus.
Default disabledInit() method… Overload me!
Default disabledPeriodic() method… Overload me!
Default robotPeriodic() method… Overload me!

If you open the Rev SPARK MAX client and connect to the speed controllers via USB-C, can you confirm that the CAN IDs are set properly for each device (0, 1, 2, 3)?


Are you able to install new firmware?


Do the device ID’s match the ID’s in the code?


I’m no expert, but I usually set these to static aswell

private static CANSparkMax m_leftMotor;
private static CANSparkMax m_rightMotor;
private static CANSparkMax m_leftMotor2;
private static CANSparkMax m_rightMotor2;

nope didn’t work ;-;

Have you tried the sample code given to you by REV? If there is an error in the code, then it should work if you try this.


Did the sample code work?

Is it it actually causing a problem with driving the motors? Or does it just show up as an error in the driver station and not cause any real problems?

I’m nowhere near the robot… not even on their team, but from the stack trace it looks like its throwing an error and disabling the robot.

Well the SPARKMAX NEO BRUSHLESS motors don’t move at all.

I believe I may know the issue. I’m guessing you’ve only copied the sample code and have edited it from there (Correct me if I’m wrong). You also need to install the API for the motor controllers to function properly. The API can be found here.

I am having the same displayed error, but there is nothing wrong when I try to drive the motors, so I believe that there might be another issue that doesn’t have to do with the displayed error. I suggest checking the API you have installed again, the Firmware on every spark max, and the wiring connections between all of the components. Also try running the neos through usb by using the pc client and see if that works, if it doesn’t then the problem is bigger than code issues. It might not fix it but that’s all I can think of.

1 Like

I’m getting this same error, but I’m only using Talons. It doesn’t remove any functionality for me, everything works perfectly fine. It is just a constant warning in the console.

You don’t have you’re ID’s set correctly for some motors.

1 Like

Sorry, I should have clarified. I’m getting the Loop time of 0.02s overrun and watchdog warnings.