Skip to content

Lesson 5.3: CAN Bus and Hardware Debugging

🎯 What You’ll Learn

By the end of this lesson you will be able to:

  • Explain how the CAN bus connects the roboRIO to motor controllers and sensors
  • Use Phoenix Tuner X to identify, configure, and test CTRE devices
  • Use REV Hardware Client to identify and configure REV devices
  • Interpret Driver Station error messages related to hardware communication
  • Follow a troubleshooting flowchart to diagnose common CAN bus failures

What Is the CAN Bus?

The CAN bus (Controller Area Network) is the communication highway that connects the roboRIO to every motor controller, sensor, and smart device on your robot. Think of it as a single wire that all devices share to send and receive messages.

How CAN Bus Works

Every device on the CAN bus has a unique CAN ID β€” a number that identifies it. When your code says β€œset motor 21 to 50% power”, the roboRIO sends a message on the CAN bus addressed to device 21. Only the motor controller with ID 21 responds.

Your team’s CAN IDs (from Constants.java):

DeviceCAN IDSubsystem
Shooter Left21ShooterSubsystem
Shooter Right22ShooterSubsystem
Turret23TurretSubsystem
Feeder24ShooterSubsystem
Spinner25ShooterSubsystem
Intake Left31IntakeSubsystem
Intake Right32IntakeSubsystem
Deploy Left33IntakeSubsystem
Deploy Right34IntakeSubsystem
Climb Left41ClimberSubsystem
Climb Right42ClimberSubsystem
Elevator43ClimberSubsystem

CAN Bus Physical Layout

The CAN bus is a daisy-chain β€” devices are connected one after another in a chain:

roboRIO β†’ Motor 1 β†’ Motor 2 β†’ Motor 3 β†’ ... β†’ Last Device
(CAN H and CAN L wires run through each device)

This means if a wire breaks in the middle of the chain, every device after the break loses communication. This is the most common hardware failure at competition.


Common CAN Bus Errors

When something goes wrong with the CAN bus, the Driver Station console tells you. Here are the most common errors and what they mean:

Error MessageWhat It MeansLikely Cause
Device X not found on CAN busThe roboRIO can’t communicate with device XWrong CAN ID in code, device unpowered, broken wire, or device not on the bus
CAN utilization: XX% (above 70%)The bus is overloaded with messagesToo many status signals at high frequency, or too many devices
Firmware version mismatchDevice firmware doesn’t match the API versionUpdate firmware via Phoenix Tuner X or REV Hardware Client
CAN frame not receivedA specific message from a device was missedIntermittent wiring issue, bus overload, or device resetting
HAL: CAN TimeoutThe roboRIO timed out waiting for a CAN responseDevice disconnected or bus is severely overloaded

Phoenix Tuner X

Phoenix Tuner X is CTRE’s diagnostic tool for managing TalonFX, TalonFXS, Pigeon 2, and CANcoder devices. It’s essential for hardware debugging.

What Phoenix Tuner X Can Do

FeatureHow It Helps
Device discoveryShows all CTRE devices on the CAN bus with their IDs, firmware versions, and status
Self-testRuns a diagnostic on a device and reports any issues
Control testingManually spin a motor from the computer β€” no robot code needed
ConfigurationSet CAN IDs, update firmware, configure device settings
PlotReal-time graphs of motor output, velocity, current, and temperature

Using Phoenix Tuner X for Debugging

  1. Connect to the roboRIO via USB or WiFi
  2. Scan for devices β€” Tuner X will list all CTRE devices it finds
  3. Check the device list β€” Are all expected devices present? Compare to the CAN ID table above.
  4. Run self-test on any suspicious device β€” it reports faults, voltage, and communication status
  5. Test a motor β€” Use the control tab to manually spin a motor and verify it responds

Common Phoenix Tuner X Findings

FindingWhat It MeansAction
Device missing from listNot on the CAN busCheck wiring, power, and CAN connections
Device shows wrong IDID was changed or device was swappedReconfigure the ID to match your code
Firmware out of dateOrange warning iconUpdate firmware through Tuner X
Self-test shows faultsHardware issue detectedRead the fault description and address it
Motor doesn’t respond to control testMotor or controller issueCheck motor wiring, breaker, and controller LED status

You open Phoenix Tuner X and see 10 CTRE devices listed, but your robot should have 12. Two devices are missing. What's the most likely cause?


REV Hardware Client

If your team uses REV hardware (SPARK MAX, SPARK Flex), the REV Hardware Client serves a similar purpose to Phoenix Tuner X.

Key REV Hardware Client Features

FeatureHow It Helps
Device discoveryLists all REV devices connected via USB or CAN
ConfigurationSet CAN IDs, PID values, current limits, and other parameters
Firmware updatesUpdate SPARK MAX/Flex firmware
Run/testManually control a motor for testing
Status LEDsThe docs explain what each LED color/pattern means

REV SPARK LED Status Codes

SPARK MAX and SPARK Flex controllers have status LEDs that indicate their state:

LED PatternMeaning
Solid cyanBrake mode, no signal
Solid magentaCoast mode, no signal
Blinking green/redForward/reverse output
Solid orangeDevice needs firmware update
Blinking orangeCAN bus communication issue
Solid redFault condition β€” check Hardware Client for details

The CAN Bus Troubleshooting Flowchart

When a device isn’t responding, follow this flowchart:

Device not responding
β”‚
β”œβ”€ Is the device listed in Phoenix Tuner X / REV Hardware Client?
β”‚ β”œβ”€ YES β†’ Device is on the bus but code may have wrong ID
β”‚ β”‚ β†’ Check CAN ID in code matches the device
β”‚ β”‚ β†’ Run self-test to check for faults
β”‚ β”‚
β”‚ └─ NO β†’ Device is not communicating
β”‚ β”‚
β”‚ β”œβ”€ Is the device powered? (LED on?)
β”‚ β”‚ β”œβ”€ YES β†’ CAN wiring issue
β”‚ β”‚ β”‚ β†’ Check CAN H and CAN L connections
β”‚ β”‚ β”‚ β†’ Check for broken wires in the daisy-chain
β”‚ β”‚ β”‚
β”‚ β”‚ └─ NO β†’ Power issue
β”‚ β”‚ β†’ Check breaker (is it tripped?)
β”‚ β”‚ β†’ Check power wires to the device
β”‚ β”‚ β†’ Check PDP/PDH slot
β”‚
β”œβ”€ Device is listed but motor doesn't spin?
β”‚ β”œβ”€ Can you control it from Tuner X / Hardware Client?
β”‚ β”‚ β”œβ”€ YES β†’ Code issue β€” motor works but code isn't commanding it
β”‚ β”‚ β”‚ β†’ Check your subsystem code and command bindings
β”‚ β”‚ β”‚
β”‚ β”‚ └─ NO β†’ Hardware issue
β”‚ β”‚ β†’ Check motor wires (phase wires for brushless)
β”‚ β”‚ β†’ Check if motor is mechanically jammed
β”‚ β”‚ β†’ Try a different motor controller
β”‚
└─ Device works but behaves erratically?
β”œβ”€ Check CAN utilization (should be below 70%)
β”œβ”€ Check for duplicate CAN IDs
β”œβ”€ Check for loose CAN connections (intermittent contact)
└─ Check firmware versions (all devices should match)

βœ…Checkpoint: CAN Bus Debugging
Your team's shooter suddenly stops working during practice. The intake and drivetrain still work fine. The DS console shows 'TalonFX ID 21 not found on CAN bus'. Walk through the troubleshooting flowchart: (1) What does this error tell you? (2) What would you check first? (3) What's the most likely physical cause? (4) How would you verify your diagnosis?

A systematic troubleshooting response:

  1. The error tells you that the roboRIO can’t communicate with the shooter left motor (CAN ID 21). The device is either disconnected, unpowered, or has a wiring issue.

  2. Check first: Open Phoenix Tuner X and scan for devices. Is device 21 listed? If not, check if the shooter right motor (ID 22) is also missing β€” if both shooter motors are gone but intake motors (IDs 31, 32) work, the break is likely in the CAN chain between the intake and shooter sections.

  3. Most likely physical cause: A loose or broken CAN wire connection at or near the shooter motor controllers. Since the intake and drivetrain still work, the CAN bus is intact up to those devices β€” the break is between the last working device and the shooter.

  4. Verify: Check the physical CAN connections at the shooter motor controllers. Look for loose Weidmuller connectors, broken wires, or disconnected CAN cables. If the LED on the TalonFX is off, it’s a power issue (check the breaker). If the LED is on but blinking orange, it’s a CAN communication issue.


Key Terms

πŸ“– All terms below are also in the full glossary for quick reference.

TermDefinition
CAN BusController Area Network β€” the communication bus connecting the roboRIO to motor controllers, sensors, and other smart devices on the robot
CAN IDA unique number (0-62) assigned to each device on the CAN bus, used to address messages to specific devices
Phoenix Tuner XCTRE’s diagnostic tool for discovering, configuring, testing, and updating CTRE devices on the CAN bus
REV Hardware ClientREV Robotics’ diagnostic tool for discovering, configuring, and updating REV devices
Daisy-ChainThe CAN bus wiring topology where devices are connected in series β€” a break anywhere disconnects all downstream devices
CAN UtilizationThe percentage of the CAN bus bandwidth being used β€” should stay below 70% to avoid communication issues

What’s Next?

You now understand the CAN bus and how to diagnose hardware communication issues. In Activity 5.4: Inspect CAN Devices, you’ll use Phoenix Tuner X (and REV Hardware Client if applicable) to inspect every device on your team’s robot and document their status.