Friday, March 18, 2022

How to interface CAN peripheral to Raspberry Pi


 This video demonstrates how to interface a CAN board to RaspberryPi

Buy the waveshare CAN hat at http://barsoocm.com/2HQY Run below command sudo raspi-config now navigate to Interface Options → SPI and select Yes to enable the SPI interface. Edit the config file sudo nano /boot/config.txt Add this line to the file: dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000 Now reboot your Pi and after bootup run below command to check setup CAN interface sudo /sbin/ip link set can0 up type can bitrate 500000 Verify the interface is up with below command ip addr | grep "can" Install CAN utilities with below command sudo apt install can-utils To receive data from other nodes run below command candump -tz can0 To send a sample data cansend can0 7FF#0102030405060708 This will send a CAN 11-bit ID of 7FF. Data 01 02 03 04 05 06 07 08

No comments:

How to add Wireless capability to legacy printers using Raspberry Pi

  This video tutorial demonstrates how to easily add wireless print capablity to your wired legacy printers using your Raspberry Pi. We hav...