This is an old revision of the document!
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
- Make sure latest BCM2835 GPIO and WiringPi libraries are installed.
- Use raspi-config to make sure I2C and SPI are enabled
- Add BCM2835 modules to config
sudo vi /etc/modules i2c-bcm2708 i2c-dev
- For python support install these libraries
sudo apt-get install python-pip sudo pip install python-can
- Make sure boot config file is setup
sudo vi /boot/config.txt dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=1000000 * Reboot and make sure CAN and SPI devices show up
sudo reboot dmesg | grep -i '\(can\|spi\)'
Install CTRE Software
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/
Headers only are at:
wget http://www.ctr-electronics.com//downloads/lib/CTRE_Phoenix_FRC_Linux_5.12.0.zip unzip CTRE_Phoenix_FRC_Linux_5.12.0.zip unzip -d /usr/local/include/ core-5.12.0-headers.zip unzip -d /usr/local/include/ api-cpp-5.12.0-headers.zip unzip -d /usr/local/include/ wpiapi-cpp-5.12.0-headers.zip sudo apt-get install cmake sudo apt-get install libsdl2-dev