NOTE: the files /boot/uEnv.txt
and /opt/source/bb.org-overlays/src/arm/PB-MCP2515-SPI1.dts
are below in this Gist.
Download the BeagleBoard.org Debian SD card image from 2019-04-07 with kernel 4.14.108-ti-r103:
Change directory:
cd /opt/source/bb.org-overlays/
Paste the contents of PB-MCP2515-SPI1.dts
or scp the file to the PocketBeagle over USB or WiFi:
sudo nano src/arm/PB-MCP2515-SPI1.dts
Change directory:
cd /opt/source/bb.org-overlays/
Compile the dts files and install compiled dtbo files
sudo install.sh
Verify that that the dtbo exists
ls -ltar /lib/firmware/PB-MCP2515-SPI1.dtbo
Edit the boot configuration
sudo nano /boot/uEnv.txt
add this line /boot/uEnv.txt
to cause the MCP2515 overlay to be loaded:
uboot_overlay_addr0=/lib/firmware/PB-MCP2515-SPI1.dtbo
and then reboot.
Run these commands to make the SWCAN transceiver M0/M1 modes pins go high (3.3V) for normal mode.
For P2.6:
sudo bash -c "echo out > /sys/class/gpio/gpio57/direction"
sudo bash -c "echo 1 > /sys/class/gpio/gpio57/value"
For P2.18:
sudo bash -c "echo out > /sys/class/gpio/gpio47/direction"
sudo bash -c "echo 1 > /sys/class/gpio/gpio47/value"
Note: the GPIO number to pin number mappings in on the PocketBeagle pin diagram
Run these commands to initialize the can2 interface:
sudo ip link set can2 type can bitrate 33000 listen-only on
sudo ifconfig can2 up
Check that it is up:
sudo ifconfig can2
View the CAN traffic:
candump -cae can2,0:0,#FFFFFFFF
Note: The traffic received by the PocketBeagle is transmitted by a seperate Macchina M2 running SWCAN_TX_Example.ino. The mode pins on the transceiver are set in MCP2515_sw_can.cpp.
josh:
sudo ip link set can2 type can bitrate 33000 listen-only on