PDA

View Full Version : CANJaguar timeout on cRIO startup


ekgordon2
01-11-2012, 10:58 PM
This is the third year out team is using CAN, but this problem has me stumped.

We just updated the firmware on a new black jaguar (v100 from ti.com/jaguar) and assigned it board ID 1. We have a new 4-slot cRIO imaged with the NI cRIO Imaging Tool, and we are using WindRiver C++ for programming with latest workbench/WPILib update from FIRSTForge.

The jaguar worked fine when controlled manually by BDC-COMM, but when connected to the cRIO, we are getting an error in sendMessage(), CANJaguar.cpp line 460: JaguarCANDriver timed out while waiting for a response.

Here is the code we used, basically the sample IterativeRobot with everything commented out:


#include "WPILib.h"
#include "CANJaguar.h"

class BuiltinDefaultCode : public IterativeRobot
{

CANJaguar *motor;

// Local variables to count the number of periodic loops performed
UINT32 m_autoPeriodicLoops;
UINT32 m_disabledPeriodicLoops;
UINT32 m_telePeriodicLoops;

public:

BuiltinDefaultCode(void) {
printf("BuiltinDefaultCode Constructor Started\n");

// Initialize counters to record the number of loops completed in autonomous and teleop modes
m_autoPeriodicLoops = 0;
m_disabledPeriodicLoops = 0;
m_telePeriodicLoops = 0;

printf("BuiltinDefaultCode Constructor Completed\n");
}


/********************************** Init Routines *************************************/

void RobotInit(void) {
// Actions which would be performed once (and only once) upon initialization of the
// robot would be put here.

motor = new CANJaguar(1);

printf("RobotInit() completed.\n");
}

void DisabledInit(void) {
m_disabledPeriodicLoops = 0; // Reset the loop counter for disabled mode

// Move the cursor down a few, since we'll move it back up in periodic.
printf("\x1b[2B");
}

void AutonomousInit(void) {
m_autoPeriodicLoops = 0; // Reset the loop counter for autonomous mode

}

void TeleopInit(void) {
m_telePeriodicLoops = 0; // Reset the loop counter for teleop mode

}

/********************************** Periodic Routines *************************************/

void DisabledPeriodic(void) {
static INT32 printSec = (INT32)GetClock() + 1;
static const INT32 startSec = (INT32)GetClock();


// increment the number of disabled periodic loops completed
m_disabledPeriodicLoops++;

// while disabled, printout the duration of current disabled mode in seconds
if (GetClock() > printSec) {
// Move the cursor back to the previous line and clear it.
printf("\x1b[1A\x1b[2K");
printf("Disabled seconds: %d\r\n", printSec - startSec);
printSec++;
}
}

void AutonomousPeriodic(void) {

m_autoPeriodicLoops++;


}


void TeleopPeriodic(void) {
// increment the number of teleop periodic loops completed
m_telePeriodicLoops++;

motor->Set(0.5);

} // TeleopPeriodic(void)

};

START_ROBOT_CLASS(BuiltinDefaultCode);


We tried switching out CAN cables, re-imaging the cRIO, and rewriting firmware on the Jaguar. Oddly, PWM worked perfectly when we tested it out, only CAN is having problems.

Thanks in advance!

kccowan
01-11-2012, 11:11 PM
Are you using a 2CAN? Last year, we had CAN timeout errors when the 2CAN was plugged into the radio but not when plugged into the CRIO. I know the CRIO II only has 1 ethernet port. I asked elsewhere here on how to best configure it this year.

KC

jhersh
01-12-2012, 03:06 AM
Make sure your console out is off.

Mike Copioli
01-12-2012, 06:29 AM
Are you using a 2CAN? Last year, we had CAN timeout errors when the 2CAN was plugged into the radio but not when plugged into the CRIO. I know the CRIO II only has 1 Ethernet port. I asked elsewhere here on how to best configure it this year.

KC

CAN timeout errors are usually caused by poor CAN connectivity. Connecting the 2CAN to an Ethernet port on the radio vs. the cRIO does not cause CAN timeouts. Connect the 2CAN to the radio it should perform as expected. If you continue to have issues while connected to the radio contact support@crosstheroadelectronics.com

ekgordon2
01-12-2012, 10:12 AM
Make sure your console out is off.

Thanks! Turning off the console solved the problem.

BTW I was using Serial, not 2CAN.