View Single Post
  #2   Spotlight this post!  
Unread Today, 04:33
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 678
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Cannot find ADXRS450

Quote:
Originally Posted by mikets View Post
We have two RoboRIO's and they both showed the same error.
We still couldn't figure out why the ADXRS450 gyro is not working. I stripped down an Iterative robot template code and just added the gyro code and it still said "cannot find the gyro on SPI port 0".
Code:
package org.usfirst.frc.team492.robot;

import edu.wpi.first.wpilibj.ADXRS450_Gyro;
import edu.wpi.first.wpilibj.IterativeRobot;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Robot extends IterativeRobot {
    ADXRS450_Gyro gyro;

	/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	@Override
	public void robotInit() {
	    gyro = new ADXRS450_Gyro();
	}

	/**
	 * This autonomous (along with the chooser code above) shows how to select
	 * between different autonomous modes using the dashboard. The sendable
	 * chooser code works with the Java SmartDashboard. If you prefer the
	 * LabVIEW Dashboard, remove all of the chooser code and uncomment the
	 * getString line to get the auto name from the text box below the Gyro
	 *
	 * You can add additional auto modes by adding additional comparisons to the
	 * switch structure below with additional strings. If using the
	 * SendableChooser make sure to add them to the chooser code above as well.
	 */
	@Override
	public void autonomousInit() {
	}

	/**
	 * This function is called periodically during autonomous
	 */
	@Override
	public void autonomousPeriodic() {
	}

	/**
	 * This function is called periodically during operator control
	 */
	@Override
	public void teleopPeriodic() {
	}

	/**
	 * This function is called periodically during test mode
	 */
	@Override
	public void testPeriodic() {
	}
}
I do not think it is hardware related because we tried two ADXRS450 gyro's, one of which completely brand new from AndyMark. We also tried two RoboRIO's and got the same error. So the only thing left is the RoboRIO image. What is the latest RoboRIO image version? We have v8.
BTW, if we commented out the gyro, everything else work. We have the robot running on mecanum wheels and operating pneumatics. So the imaging process should be fine as well as the Java VM on the RoboRIO. I am running out of ideas on why it doesn't work.
I even stripped down the ADXRS450_Gyro class code and discovered that the readRegister call below was returning 4 bytes of zeros.
Code:
      // Validate the part ID
      if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
        m_spi.free();
        m_spi = null;
        tracer.traceInfo("GyroTest", "Failed to find ADXRS450 gyro on SPI port %d.", port.value);
        return;
      }
So it was truly not finding the gyro. Is there anything trivial that I missed? Perhaps a jumper or config option that enables/disables SPI in the RoboRIO image? BTW, the jumper on the ADXRS450 gyro was jumped to CS0.
__________________
Reply With Quote