====== 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 ===== [[https://www.waveshare.com/wiki/RS485_CAN_HAT|Waveshare RS-485 / CAN Hat]] * Make sure latest [[http://www.airspayce.com/mikem/bcm2835/index.html|BCM2835 GPIO]] and [[http://wiringpi.com/|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 ===== 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