ADIS16448 giving "Invalid CRC" after updating the roborio

#1

Our team is using the Analog devices gyro ADIS16448. We have updated to the new image and are able to get readings from the gyro. However it is constantly giving an “Invalid CRC” in the console.

We are using Java and have imported the vendor libraries into VS Code.

0 Likes

#2

Invalid CRC means that after sending the data over, the RIO suspects (based off the CRC) that the data is corrupted - a bit got flipped, the message got cut off, etc.

I would make sure your gyro is using the CRC (it’s a configurable option) and that your connections are solid.

0 Likes

#3

Are you getting any good data points out of the part? Or do all readings give you a bad crc error?

0 Likes

#4

What roborio image are you using? Apparently anything before v13 this year had a problem interfacing with the Analog Devices IMUs. TeamUpdate04.pdf (103.3 KB)

0 Likes

#5

How often are you reading an invalid CRC? Once every few (10ish) seconds is reasonable during normal operation.

0 Likes

#6

@mrada6 Any update on this? If you have any additional questions, feel free to send me a PM or reply here.

0 Likes

#7

We believe the IMU may have been damaged during the off season we have ordered a new one and will be testing it out when it comes in.

0 Likes

#8

Sounds good. If you continue to have issues, feel free to send me a PM.

0 Likes

#9

I have the same issue. I recently got my ADIS 16448 gyro, and I struggle to get consistent output. The “Invalid CRC” error runs continuously once I upload the code. Here is the code I am running:

package frc.robot;

import edu.wpi.first.wpilibj.Joystick;

import edu.wpi.first.wpilibj.TimedRobot;

import edu.wpi.first.wpilibj.Timer;

import edu.wpi.first.wpilibj.VictorSP;

import edu.wpi.first.wpilibj.drive.DifferentialDrive;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;

import com.analog.adis16448.frc.ADIS16448_IMU;

public class Robot extends TimedRobot {
public static final ADIS16448_IMU imu = new ADIS16448_IMU();

double GyroAngle;
double GyroCoefficient = 1.0; 
int DesiredAngle;
String DesiredDirection;

private static final String RightBox  = "Right Box";
private static final String LeftBox = "Left Box";
private static final String TurnLeft = "Turn Left";

private SendableChooser<String> m_chooser = new SendableChooser<>();
private String m_autoSelected;

int i = 1;

//Joystick leftStick = new Joystick(0);
//Joystick rightStick = new Joystick(1);
Joystick arcadeStick = new Joystick(2);

VictorSP leftVictor = new VictorSP(0);
VictorSP rightVictor = new VictorSP(1);

DifferentialDrive apolloDrive = new DifferentialDrive(leftVictor, rightVictor);

      public void Turn(String Direction, int Angle) {

  GyroAngle = Math.abs(GyroCoefficient * imu.getAngleX());

  DesiredDirection = Direction;
  DesiredAngle = Angle;

  while( GyroAngle >= DesiredAngle) {

  if (DesiredDirection == "left") {
    apolloDrive.arcadeDrive(0, .5);
    imu.getAngleX();
    SmartDashboard.putNumber("Gyro Angle Degrees", GyroAngle);
  }
  else if(DesiredDirection == "right") {
  apolloDrive.arcadeDrive(0, -.5);
  imu.getAngleX();
  SmartDashboard.putNumber("Gyro Angle Degrees", GyroAngle);
  }
  imu.getAngleX();
  SmartDashboard.putNumber("Gyro Angle Degrees", GyroAngle);
}
 imu.reset();
 apolloDrive.arcadeDrive(0, 0); 
}
@Override
public void robotPeriodic() {
   apolloDrive.tankDrive(arcadeStick.getY() * .6, arcadeStick.getRawAxis(3) * .6);
SmartDashboard.putNumber("Gyro-Z",  Math.abs(imu.getAngleZ()));
SmartDashboard.putNumber("Accel-Z", imu.getAccelZ());
}

 @Override
public void autonomousPeriodic() {

switch (m_autoSelected) {
  case LeftBox:
    for(i=1; i<=4; i++) {
      apolloDrive.arcadeDrive(.5, 0);
      Timer.delay(2);
      Turn("left", 90);
  }
  case RightBox:
    for(i=1; i<=4; i++) {
      apolloDrive.arcadeDrive(.5, 0);
      Timer.delay(2);
      Turn("right", 90);
  }
  case TurnLeft:
   Turn("left", 90);
}

}

Any help is much appreciated!! Thank you!

0 Likes

#10

In addition to having this issue, I’ve noticed that this ADIS16448_IMU class is using an oddly high amount of CPU usage. When the line calling the constructor for the IMU was commented out, the CPU was at 35% versus the 90% it was at with that line of code.

0 Likes

#11

I had the same issue. I fixed it by including

imu.reset();
imu.calibrate();

in robot.init

0 Likes

#12

Did this fix both the CRC invalid issue and CPU usage?

0 Likes

#13

This fixed the CRC issue. I’m not sure about the CPU usage, I haven’t checked that

0 Likes

#14

Hi everyone,

We finally pushed a fix for Java users to maven and GitHub today. It looks like I forgot to change an IMU setting back to default after developing this year’s driver, causing the RoboRIO to have issues keeping up with the data rates. Next time you build code, be sure to connect to the internet to have VS Code pull from our repository if you used the online install method, otherwise be sure to pull the latest release from the GitHub repository. We’re still looking into reducing CPU usage to match C++ performance, but this fix should at least guarantee valid data.

Sorry for the issues!

0 Likes

#15

Do you know if this would affect python users? I’ve been seeing some crc errors reported. We are using a navx via the SPI (MXP?) interface.

0 Likes

#16

If you’re having issues using the navX you’d probably get better answers creating a new thread since this thread is about the ADIS16448 imu

0 Likes

#17

Any updates on getting CPU Usage down in java? I have the most up to date driver installed, but the CPU usage is still high.

CPU without IMU initialization:


CPU with IMU initialization:

Here is the code that is instantiating and initializing the IMU:

package frc.systems.sensors;

import com.analog.adis16448.frc.ADIS16448_IMU;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;


public class IMU {

    ADIS16448_IMU imu;

    public IMU (){
        imu = new ADIS16448_IMU();
        imu.reset();
        imu.calibrate();
    }

...
0 Likes

#18

Hi Avery, we’ve been trying to get CPU usage down as much as possible, but it looks like most of the inefficiency comes from how the JNI bindings handle the data acquisition and processing. We’ve tried stripping down as much of the driver as possible, with negligible improvements. I’m working with WPI to address this, but I don’t think there will be a fix this season. @Peter_Johnson might know more about what’s going on under the hood.

0 Likes

#19

There’s an important update in Team Update 15 with regard to using the ADIS16448 this year. Please see the following announcement: [IMPORTANT] Updates Involving the Functionality and Legality of Analog Devices IMUs and Gyro Boards

0 Likes