Raspberry Pi Configuration
Setup on a Raspberry Pi Machine for Waveshare 2-CH CAN HAT
Note
installation scripts are found in install
directory
1. Prepare system
Prepare freshly installed rpi (docker etc.)
prepare_system.sh
2. Install CAN hat
See waveshare docs: waveshare hat docs
install_bcm2535.sh
3. install can service
to automatically bringup interface on system startup
setup_can.sh
Test the CAN-bus with the can-utils Program
Install can-utils:
sudo apt-get install can-utils
Send a CAN Message:
cansend [interface] [id HEX]#[DATA 8 bytes HEX]
cansend can0 456#00FF010203040506
Odrive configuration
Setup odrive for use with can.
use host system, to avoid excessive container restart on device reconnects.
Preparation
install_rules.sh
on host system- connect odrive. Power odrive with 5V, connect usb.
- (optional for vcan) run
setup_vcan_service.sh
to createvcan0
adapter. It will be started on each startup.
Odrive should become available as usb device:
$ lsusb | grep 1209
Bus 001 Device 014: ID 1209:0d32 Generic ODrive Robotics ODrive v3
Configuration
Start devcontainer, odrive tool is installed automatically.
Configure odrive as described in manual
SBC with can hat setup
- run
prepare_system.sh
- prepare can hat as explained in waveshare hat docs
- modify
boot/config.txt
- run
install_bcm2835.sh
- run
setup_can.sh
, this will start can interfaces on startup.
- modify
Test connection
candump can0 -xct z -n 10
python3 -m can.viewer -c "can0" -i "socketcan"