Table of Contents

Using a Raspberry Pi to Run a Talon SRX Motor Controller

Configure RPi as a CAN Bus controller

apt-get install libsocketcan2
apt-get install libsocketcan-doc

Waveshare RS-485 / CAN Hat

Waveshare RS-485 / CAN Hat

sudo vi /etc/modules
  i2c-bcm2708 
  i2c-dev 
  sudo apt-get install python-pip 
  sudo pip install python-can
sudo vi /boot/config.txt 
  dtparam=spi=on 
  dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=1000000 
sudo reboot 
dmesg | grep -i '\(can\|spi\)' 

Install CTRE Software

sudo apt-get install libsdl2-dev
sudo apt-get install cmake

Example libraries, headers, and example code are at:

https://github.com/CrossTheRoadElec/Phoenix-Linux-SocketCAN-Example

wget https://github.com/CrossTheRoadElec/Phoenix-Linux-SocketCAN-Example/archive/master.zip
unzip -l master.zip 
cd Phoenix-Linux-SocketCAN-Example-master
sudo cp -R include/* /usr/local/include
sudo cp lib/raspberry/* /usr/local/lib/

chmod 755 build.sh
chmod 755 clean.sh
./build.sh