Troubleshooting CAN bus

My team is having trouble with our robot’s CAN bus, and I was wondering if anyone has any ideas on how to troubleshoot it.

See bottom for summary

Previous Issues:

  • On one of our practice bots, the PDP was wired directly to the roboRIO, but the PDP claimed it did not have CAN communication (red lights).
  • Some of our PDPs seem to randomly get a sticky fault (Orange lights), with an ID of 0 (…0x0)

Previously Working State

  • CAN bus: NI roboRIO > cut up female PWM cable > 4 Spark MAXes (drive-train) > cut up male PWM cable > PDP > long CAN wire w/ no connectors (bare wires) > 2 Victor SPXes (Intake/outtake) > 1 Spark MAX (flywheel) Related Question: Does it matter which gender is on which end of the CAN bus?
  • Both this code and the code later testing was done with worked well enough.

Current Issues and Troubleshooting:

  • I tried to add an old, previously unused Victor SPX at the start of the CAN bus. It indicated no CAN communication (alternating blinking red lights). However, the daisy chain pass-through still worked.
  • I tried it with a different Victor SPX, same result
  • I tried again, placing an older Talon SRX after the 4 Spark Maxes and before the PDP, same result
  • I moved the Victor SPX to the end of the CAN bus, after the PDP with the still enabled terminating resister, and it started working. I was able to update it in Phoenix Tuner.
  • I decided to leave the controller on the end, and to do that I soldered cut up PWM connectors onto a long CAN cable (figured it would be good to have the twisted pair wire). Related Question: How much effect does the twisted pairing have on the CAN bus and performance?
  • At some point, I had switched some of the cut up PWM cables for CAN wires with soldered Molex connectors (from the 2022 KOP). They seemed compatible, but would not quite fit in the retention clips we had (I think the insulation got messed up and then got in the way).
  • [PENDING RE-TEST] The drive-train Spark MAXes started blinking magenta at some point (No signal). Except at least one of them would sometimes switch to a faint, rapid yellow strobe (Which isn’t a thing). However, connecting to one over USB with the Rev Hardware Client allowed me to see the entire bus (at that point just the roboRIO and 1 Spark MAX). I also just realized that I can’t remember if the driver station console was logging errors about the drive-train Spark MAXes. Looking at the most recent 1/8 of my most recent DS log, it seems that it was not, although they were missing at one point earlier. I will retest the drive-train tomorrow.
  • At some point I had the CAN bus wired into the roboRIO backwards, but I fixed it and still experienced issues.
  • The PDP status lights were green (CAN link) when only connected to other motor controllers
  • The PDP worked correctly (green status lights / CAN link) when wired directly into the roboRIO with CAN wire that had not connectors (bare wire).
  • I verified that I was unable to see the missing devices in Phoenix Tuner several times.

Things I have not tried yet and other considerations:

  • Re-imaging the roboRIO
  • The robot had this code on it. I remember getting error messages in the console about the unplugged shooter Spark MAX, but I can’t remember if the drive-train Spark MAXes were actually causing errors or not. I have not actually tried driving the robot to triple check that it’s not working.
  • I have not tried placing the PDP closest to the roboRIO
  • I have not disabled the PDP terminating resistor and installed my own at the end of the CAN bus. Related Question: How much of an effect does this have? Last year, my team put the PDP first with the terminating resistor enabled and it was fine. (except possibly high bus usage, I can’t remember).

Main Questions Summary:

  • Why won’t CTRE motor controllers work when placed before the PDP?
  • I need to verify whether or not the drive-train is working because everything except the easy to confuse status lights points to it working.
  • Does anyone have any general CAN bus troubleshooting advice?

Related Questions Summary:

  • Does it matter which gender is on which end of the CAN bus?
  • How much effect does the twisted pairing have on the CAN bus and performance?
  • How much of an effect does this have? Last year, my team put the PDP first with the terminating resistor enabled and it was fine (except possibly high bus usage, I can’t remember).

I will check more things after school and update this post accordingly.

  1. You need to use wires that are twisted together to reduce electrical noise. Hobby servo wires are usually not twisted together.

  2. The termination of the chain needs to go at the end.

  3. I don’t know what you mean by ‘gender’ on the can bus. Yellow always needs to go to yellow, green always needs to go to green, they can never be connected together except by the termination resistor at the end.

  4. Requirements for can bus wiring aren’t merely suggestions. If you want a can bus network that works reliably you need to follow them.

No, it doesn’t matter if the pwm connectors go from male to female or female to male. Just have to be good connections and follow the green/yellow convention. If you can get some CAN extension cables that is even better than trying to use PWM cables. If you can’t, you can peel apart the PWM wires and twist the pairs.

Generally, the troubleshooting advice is to always start with a good connection between the RoboRIO and PDP (check that the terminator resistor jumper is set). Then you can add devices in between those two individually (or start with all the devices and subtract) until you find the device that isn’t working.

With Spark Maxes, be careful that you either have newer CAN wires (with the extra loops) or that it is fully inserted. Unlike other controllers, the like wires aren’t soldered to a junction.

1 Like

Gender is irrelevant
Twisting is important
Termination resistors are really important and are always at both ends of the bus.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.