I would like to run a CAN shield with MCP2515 controller connected to a Raspberry Pi 4 Model B. It already worked under Raspbian but because I need ROS2 I want to run it under Ubuntu (20.04) now. Here it does not work anymore.
What I did was editing /boot/config.txt
and adding the following lines:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25
dtoverlay=spi-bcm2835
But ifconfig can
gives
can: error fetching interface information: Device not found
The problem seems to be very similar to this one:
The spi-bcm2835
module is not shown as output of lsmod
and dmesg
has this entry:
[ 1.428843] spi-bcm2835 fe204000.spi: could not get clk: -517
Is this a general problem of Ubuntu on the Raspberry Pi? If so, is there a workaround for this issue?
For ubuntu the boot partition is mounted under /boot/firmware
with 3 files: config.txt, syscfg.txt, and usercfg.txt. The usercfg.txt is included by config.txt and is recommended to bearing user customized configuration. So saving your lines in usercfg.txt instead should make it works