Skip to content

Device Tree Overlays to enable PiCAN 2 HAT on Raspi 4 bookworm 64bit

Hi,

first, thank you for the great work on the Debian Raspberry Pi images! Currently lots of users are switching to them from Raspberry PI OS, because some software (for example Home Assistant) stopped supporting Raspberry PI OS and only support Debian. This however comes with the problem that some hardware is not yet recognized or difficult to add by the users.

In my case I am trying to get the PiCAN2 HAT https://raspberry-valley.azurewebsites.net/ref/Raspberry-Pi-PICAN2-Hat-User-Guide.pdf working on my Raspberry Pi 4 (with 64 bit bookworm). As the PiCAN comes with a SPI MCP2515, I added the kernel module:

sudo echo mcp251x | sudo tee -a /etc/modules

and verified (lsmod) that it gets indeed loaded at boot, but still the device can0 does not get created. I also tried adding the module spi-bcm2835 but that does not change things. Just having the modules is not enough as I need to pass and overlay. But adding this

dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25

to /boot/firmware/config.txt and placing an overlay file into /boot/firmware/overlays (copied from Raspberry PI OS) does not help, as the kernel does not support overlays via config_fs.

This could also be connected to SPI issues as described here: #9 ?

Is there a way to get DT overlays working with the Debian bookworm kernel, maybe by recompiling? How would I switch on config_fs overlay support? Any help is appreciated.

Edited by M Reuter