The CAN standard has been designed to be resistant to noise and message corruption, both on a hardware and protocol level.
RS232 has not.
Thus, while you can wire your CAN bus just about anywhere around the robot, you have to be more careful with your initial wire from the the cRIO to the bridging Black Jaguar.
Several teams have reported problems from running this initial cable next to motors.
Rather than wiring it up and hoping it works, I’d like some more protection. I was thinking a braided shield would do nicely.
The question is, what should the shield be connected to? Should it be connected to somewhere on the robot frame, or should it be connected to ground-potential? (The negative lead on the battery)
The first things that come to mind:
Don’t build your cable to the manufacturer’s spec, i.e. using flat wire and putting the CAN terminator in the DB9. This may work for short cables, but it opens up lots of noise/crosstalk potential with CAN and RS232 traffic on parallel pairs of wires. Use shielded twisted pair instead, and put your CAN terminator at the Jaguar end of the cable.
I can’t determine from your post if you intend to use cable with an integral braided shield (STP), or if you intend to slip a separate braided shield over your otherwise unshielded cable. I recommend the former.
If you use shielded wire, you have some connection choices: the DB9 connector shell on the cRIO which is connected internally to cRIO chassis ground and should have true ground potential, or the robot chassis, which is not necessarily true ground potential, as your electrical system should be isolated from the robot chassis. Since the cRIO is normally isolated from the robot chassis (required by the rules), connecting the shield to both the cRIO and the chassis should be avoided. The signal ground (pin 5) is sourced from the cRIO. Since you already have a cRIO-sourced ground running through your RS232 cable, it makes sense to ground the shield to the same place, ie. the cRIO. This might be tough with an RJ-12 to DB9 adapter though, as these are usually plastic.
Maybe the easiest way to go about this would be to re-purpose an existing serial cable. They’re usually already shielded and have the shield connected to the DB9 shell at one end. Just cut off the other end and attach a CAN terminator and RJ-12 connector, and you’re good to go. Shorter is also better in this business - don’t make your cable longer than necessary.
Connect it to the “ground” pin on the serial connector at the cRIO end. Connect it only to that pin. Do not connect it to anything at the other end.
Other options are possible, but this is the most common way to use a shielded cable.
Okay, so ground potential is best.
MattG, I’m curious how you mean to do twisted pair. Would I twist the RX and TX, or RX and GND, or something else?
Well, I was thinking of buying it, something like this:
But you could certainly make your own.
EDIT: Ignore my previous advice about which wires to twist, and here’s a better cable choice that matches Joes’s recommendation (see next post) about which pairs to twist.
I would expect that if you want the “twisted” pair to help you at all, you would have 2 twisted pair… one TX and ground, the other RX and ground. You can also ground the shield around both pairs. The point of twisted pairs is that those pairs are twisted at different rates so that over a longer distance, the induced voltages tend to cancel out. If you twist RX and TX with each other, then you are promoting coupling between RX and TX the same as if you had a flat cable. Technically it’s even a little worse than a flat cable since the twisted cable would have to be a little longer.
kamocat, listen to Joe’s advice and not mine: he has the correct info. I don’t know why I’ve always associated the ‘twist’ with the two sides of a ‘channel,’ but now I know better. Learn something new every day!
So a twisted pairs help reduce interference between two signals in the same cable?
That’s interesting, but not what I’m looking for. It sounds like just shielding the cable is the correct approach here. Perhaps I need to pull out an O-scope and find out.
As far as types of shielding, what are my options?
I have some bonding braid I can slip around the 6 conductor ribbon cable. Assuming I’ve insulated the braid, why would I not want to do this?
It actually is a component of what you want. While it is likely that the CAN traffic coupling onto the serial wires is the source of your problems, you also don’t want the serial TX coupling to the RX or vice versa. That’s not as likely since the frequency is an order of magnitude lower than the CAN traffic, but if you’re building a custom cable anyway, this can help. Shielding will help your use case more though, for sure.
You can do that and it will probably be pretty effective, but also ugly and a bit unwieldy. Generally there are plenty of manufactured shielded cables out there that will do just great for your application. You can go with the 2 twisted pair as I described, or you will probably be fine with a simple shielded 3 conductor cable. Just don’t be tempted to use the shield as the ground conductor for the serial port in a cable such as the one linked to earlier. As Alan suggested, only ground the shield at the DB9 end.
i actully have turned old serial cables into can cables. let me warn you now that as rosy as it sounds with all of the shielding, getting that type of cable to work and work well is a challange… doable but still a pain if you are not careful and lucky. the gauge of wire used for the rj-12 is somewhat difficult to strip and solder witout breaking… it takes a lot of skill to get it right. get it wrong and a few days after you made the cable, the solder breaks and the cable dies. not a lot of fun to fix.
my team is using the db9 to rj12 adapter with a terminator in the db9-half and standard flat 6p cable. the cable runs right under two CIMs and we have not been having any issues.
besides, i thought flat cables were supposed to be more crosstalk resistant than other types.
Twisted pairs minimize noise only when the receiver takes the signal differentially from both wires. This method makes the signal opposite in polarity (phase) on each wire at the transmitter while the noise is in polarity (phase) on each wire. For short distances on single ended wiring (RS232), twisting has no effect on noise pickup. If you think about it, the induced noise must exceed the trigger threshold in the receiver to be an issue. It is for this reason that RS232 implementations can use relatively high voltage for signaling. (Up to +/- 15 volts.)
The CAN buss is a balanced or differential pair so noise immunity is pretty high on those connections. The receivers are also Schmidt Trigger inputs. Shielding may help if wired as Alan has pointed out above. There is no ground on the robot but the common point for noise picked up by the shield is returned to the Crio chassis and then to the negative lead of the battery.