This guide is the canonical troubleshooting playbook for channel setup and link-level diagnostics.
- Linux backend: SocketCAN (
can0,can1, ...) - Windows backend: PEAK PCAN via
PCANBasic.dll(can0/can1mapping toPCAN_USBBUS1/2)
Rules:
- Linux: configure bitrate at interface bring-up time; do not put
@bitratein--channel. - Windows PCAN:
@bitratesuffix is allowed in--channel(for examplecan0@1000000).
lsusb
lsmod | grep -E 'peak_usb|gs_usb|can_raw|can_dev'
ip -details link show type canExpected adapter mapping:
- PCAN-USB: kernel driver
peak_usb; usescripts/can_restart.sh can0. - CANable candleLight: kernel driver
gs_usb; usescripts/canable_restart.sh can0.
PCAN:
scripts/can_restart.sh can0CANable candleLight/gs_usb:
scripts/canable_restart.sh can0Then confirm can0 is UP, bitrate is 1000000, and the driver line matches the adapter.
candump can0If no frame appears during scan/control, check wiring, termination, ground reference, power, and bitrate consistency with motor firmware.
cargo run -p motor_cli --release -- \
--vendor robstride --channel can0 --mode scan --start-id 1 --end-id 16sudo ip link set can0 down 2>/dev/null || true
sudo ip link set can0 type can bitrate 1000000 restart-ms 100
sudo ip link set can0 up
ip -details link show can0Counters to watch:
RX errors,TX errors,bus-off,re-started
If bus-off grows, fix physical layer first (termination, ground reference, bitrate mismatch).
- Install PEAK driver
- Install PCAN-Basic runtime (
PCANBasic.dll) and ensure it is loadable - Confirm adapter channel availability in PEAK tools
can0->PCAN_USBBUS1can1->PCAN_USBBUS2- Optional bitrate suffix:
can0@1000000
cargo run -p motor_cli --release -- --vendor damiao --channel can0@1000000 --model 4340P --motor-id 0x01 --feedback-id 0x11 --mode scan --start-id 1 --end-id 16If startup fails with load PCANBasic.dll failed, fix PATH/runtime installation first.
if_nametoindex failed ...:- Interface name is wrong or interface not created/up
- Action:
ip link show, bring upcan0or select the correct SocketCAN interface
socketcan write failed/socketcan read failedwith hintinterface is down:- Action:
ip -details link show <ifname>, then bring link up
- Action:
... unavailable/interface not found:- Action: check USB adapter presence and interface naming
load PCANBasic.dll failed:- Action: install PCAN-Basic runtime and restart shell/IDE so DLL is discoverable
PCAN initialize failed: status=...:- Action: verify channel mapping (
can0/can1), bitrate suffix, adapter availability
- Action: verify channel mapping (
- Repeated reconnect failures:
- Action: check cable/termination/power and channel occupancy in PEAK tools
- Linux
can0: scan command returns expected device IDs - Windows
can0@1000000: scan succeeds with PEAK adapter - One control command (
mitorpos-vel) succeeds in each environment
If Linux SocketCAN and Windows PCAN scans plus one control command pass, channel support is considered aligned.