Start by making a new SD card image with Raspberry Pi OS. Follow these instructions for the download. Boot the Pi to the CLI prompt.
First do an update. At the CLI prompt type in.
sudo apt-get update
sudo apt-get upgrade
sudo reboot
Add the overlays by:
sudo nano /boot/config.txt
Add these 3 lines to the end of file:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
#dtoverlay=spi-bcm2835-overlay
Reboot Pi:
sudo reboot
You can now bring the CAN interface up:
sudo /sbin/ip link set can0 up type can bitrate 500000
Check there is no error message returned.
Now install can utils:
sudo apt-get install can-utils
To send a CAN message use :
cansend can0 7DF#0201050000000000
This will send a CAN ID of 7DF. Data 02 01 05 – coolant temperature request.