Black jaguars: not working

I am trying to get the new black jaguars working and am getting errors when I attempt to use them. Here is the setup and the errors I am getting:

First, the jaguars have been updated (done by another member of our team). I put the file at http://firstforge.wpi.edu/sf/frs/do/listReleases/projects.canjaguar/frs.blackjagbridgeplugin onto the cRIO via FTP according to the directions at http://firstforge.wpi.edu/sf/sfmain/do/viewProject/projects.canjaguar, under the heading “Getting Started.”

I got the Jaguar code from http://firstforge.wpi.edu/sf/frs/do/listReleases/projects.canjaguar/frs.canjaguar_for_c and modified it so that it compiles, as shown in this thread: http://www.chiefdelphi.com/forums/showthread.php?t=80706

The code I am using is:


// This code has been simplified for the purposes of posting.
#include "WPILib.h"
#include "CANJaguar.h"

class Spy : public SimpleRobot
{
	Joystick* leftStick;
	CANJaguar* frontRightMotor;

public:
	Spy(void)
	{
		GetWatchdog().SetEnabled(false);

		leftStick = new Joystick(1);
		frontRightMotor = new CANJaguar(1);
	}

	void Autonomous(void)
	{

	}

	void OperatorControl(void)
	{
		while (true)
			frontRightMotor->Set(leftStick->GetY());
	}
};

START_ROBOT_CLASS(Spy);

When I run the code, I get the following error, repeatedly, in the console (and the Jaguar, of course, does not run):


>>>>ERROR: status == -52007 (0xFFF34D9) in sendMessage() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 176

I assume that the correct port is 1; we’re daisy-chaining our CAN Jaguars, and the Jaguar of interest is the first one in the chain. I’ve also tried 0 as the port for the jaguar, which gives the same error.

Does anyone know what’s going on? I would really appreciate any help.

Thanks,
Kevin

I’m realizing that this really isn’t a C++ Windriver specific question. Would a moderator mind moving my thread into the general programming forum? Thanks.

I certainly cannot be 0, since that is the broadcast address. 1 is what all Jaguars ship as. You must assign a unique ID to each Jaguar with a tool such as the bdc-comm utility from TI. This has nothing to do with wiring order. All Jags are on a shared bus. The CAN bus is wired straight through between the 2 CAN connectors on the Jags.

TI recommends that you use addresses in the range 2 - 63.

BTW, the error code is “Operation Timed Out”.

Also, have you tested your serial cable adapter with a PC serial port and bdc-comm to make sure it’s functioning properly? Is your serial cable plugged into the left RJ-12 plug on the Black Jag? Does the plugin appear to be loading properly on the console (you would have to use a network console to see it since your serial port is in use!)?

-Joe

Thanks for the reply. I talked to the control systems people on my team and they set the ID of the black Jaguar using the bdc-comm utility to 2. I tried the code again, however, with the ID given in the constructor of the black jaguar to 2, and I still get the exact same behavior.:confused: So, while it seems that I did have the wrong port, that isn’t the reason I get these errors. Any advice?

Thanks,
Kevin

EDIT: yes, the driver loads correctly, as seen from the network console. The black jaguar utilities show that the Jaguar is functioning fine and the wiring is fine. I’m very confused…

What about the other list of suggestions in my last post? Also… if you have LabVIEW installed, you could run the voltage mode example to see what enumerates on your robot.

-Joe

Yes, we’ve tried the other suggestions. The cable is fine, it’s plugged in on the left, there is a 100 ohm resistor on the left jack, and I can see the driver loading on the console when the cRIO boots.

EDIT:
Here’s the startup message from the cRIO’s console:


FPGA Hardware GUID: 0xAD(a bunch of hex digits)
FPGA Software GUID: 0xAD(a bunch of hex digits)
FPGA Hardware Version: 2010
FPGA Software Version: 2010
FPGA Hardware Revision: 1.3.0
FPGA Software Revision: 1.3.0
* Loading StartupDlls: FRC_BlockJagBridgePlugin
FRC_BlockJagBridgePlugin was compiled from SVN revision 10
task 0x12d9610 (t2) deleted: erno=0 (0) status=0 (0)
* Loading StartupDls: FRC_UserProgram
...FRC_UserProgram failed to load.

NI-VISA Server 4.5 started successfully.
task 0xe414e8 (t1) deleted: errno=1835009 (0x1c001) status=1 (0x1)

Welcome to LabVIEW Real-Time 8.6.1f2

(the last line is odd, considering that it’s not in LabVIEW mode…)

When I run the aforementioned program, I get the following error at startup, presumably from the call to Init of the CANJaguar in the constructor of the program:


>>>>ERROR: status == -63194 (0xFFFF0926) in InitJaguar() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 32

If you just unplug the serial connector from the cRIO and plug it into a PC, does bdc-comm see the Jaguars?

Hi, we had a seemingly similar problem with our CAN bus setup (using LabView). the driverstation would display an error regarding “CAN-Recieve.vi” and “operation not completed in time” (or something like that), so a timeout error of sorts. essentially, the cRIO was not getting a confirmation of initial setup from the black jag, or other jaguar- I forget exactly which. Anyway, we went into the code for initializing a 4motor robot drive system. and modified it such that it bypassed this error point (removing CAN-Recieve.vi). Then it worked perfectly. So my guess is that you may be able to do something similar in C++.

Answering for ellisk and in answer jhersh’s question… yes the same cable works fine off a PC to talk to the Jaguar via the command line and GUI interface. The firmware was updated and ID set. No other changes were made to the Jaguar’s settings. Also, for what it’s worth, different cRIOs exhibit the same problem.

Once thing we didn’t do was wire any of the the RS-232 handshake lines in the connector, things like CTS, RTS, DTR, DSR. The manual didn’t say anything about that so we’re assuming the cRIO doesn’t care. Is that true?

As a side thought, is your CAN bus properly terminated? To make the CAN bus work it is my understanding that you need approximately a 100ohm resistor joining CANH and CANL on the last Jaguar. The pin outs can be found in the data sheet available here: http://www.luminarymicro.com/products/mdl-bdc24.html. I don’t know if this will fix the problem but it may be something in the right direction.

-Ian
Programmer, Team 2022

The Jaguar only has connections for RX and TX.

That a great point… I forgot to ask if the robot was enabled when you got this error. The current image (v19) will not cause a reply if the robot is disabled. This means that, for the moment, you can’t call any “Set” commands while the robot is disabled without an error. This will be addressed in the next update. It won’t cause any trouble (the way the C++ library is written), but it will create some errors on the DS. As ChristopherBuck noted, in LabVIEW it is written with status chaining so one of these errors will prevent it from working from then on.

We do have the 100 ohm terminator in place. We know the Jaguars only have TX and RX but I wasn’t clear whether the cRIO needed to have the other handshake lines jumpered at it’s end. ellisk will have to answer about the robot being enabled.

They were trying a 2CAN ethernet adapter when I left the lab tonight to see if that yields better results. We’d still like to get the “official” RS-232 solution working though.

The cRIO does support hardware flow control, but it’s disabled by default and the BlakJagBridgePlugin does not enable it.

-Joe

I have been having an issue with intermittent signals getting to the Jags. We currently have updated the firmware on both Jags connected (One black and one gray each with its respective firmware update) through the RS232 port on the cRio. There is a 100 ohm termination resistor inside the DB9 shield between CANL and CANH (the green and red wires). There is a 6 pin cable running from the RS232 to CAN inverter to the LEFT port of the black Jag. I have then tried both a 4pin and 6pin cable from the RIGHT port of the black Jag to the LEFT port of the gray Jag (just to see if I had made a bad cable). I then created a short Termination cable that only has a 100ohm resistor between the green and red wires. This short cable is plugged into the RIGHT port of the Gray Jag. I have tried communications with and without this termination cable and get similar results.

If I just send the Jags a constant max output value, they will run and then sputter, and then run, yada yada yada. It sounds as if I have a physical layer problem - i.e., signals not propagating properly.

Also, I have obviously been able to connect with BD-COM to assign IDs and re-flash the firmware…

So my questions are:

Should the termination resistor be on the cable at the LEFT port of the Gray Jag, or is it correct the way I have it?

Has anyone else been able to get a connection, but suffers from intermittent signal loss?

  • Bryce

P.S. I have attached some pictures of errors that I am receiving in the NetConsole.

P.S.S. This is somewhat of a bummer, because I have written code to make use of the Speed and Position modes, but can’t test it until I at least have a reliable communication interface…







It may not be your problem, but we ordered a RJ11 cable tester to test our CAN cables. We have 9 Jaguars on our board and can’t have one of those cables being marginal if we can help it! You can get one for anywhere between $7 and $100+.

We still don’t have our first Jaguar working on CAN so we’ll see if we get to use that spiffy tester. For what it’s worth we’re getting this onebecause of it’s good reviews and middle range price.

Two 120 ohm resistors are required on a CAN bus. One at each end of the BUS. The 2CAN contains one of the resistors internally that can be removed via a jumper. The second jumper needs to be placed by the user. My suggestion is to use the second RJ-11/12 connector on the Jag for this. I do not know if the Jaguar has an internal 120 ohm resistor or not. Maybe Scott Emley can answer this. If it does not, you will need to place one at the beginning of the BUS as well.

I stand corrected on the terminator! In re-reading page 29 of the Jaguar BDC24 getting started guide it clearly says you need a 100 ohm resistor at both ends. I wonder if that’s our problem with getting the Jaguars to work via CAN! It would seem unlikely given that we only have one Jaguar in our test setup but it’s certainly worth a try.

Dale,

The instructions in the Getting Started Guide show a 100 ohm connected between red and green (CAN_L and CAN_H) inside the RS-232 to CAN converter. If you did this, you should have the proper termination.

  • Bryce

P.S. I wonder if the termination needs to occur closer the the black jag than at the converter. Our cable is only 5 inches or so, but maybe even that is too long?

We had a 100 ohm terminator in the empty RJ11 plug on the Jaguar but didn’t have one in the left one where the serial data was coming in.