RS485 CAN BAS with mcp2515

Creating a bug report/issue

Required Information

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=13
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’
G_LIVE_PATCH_STATUS[0]=‘applied’
G_LIVE_PATCH_STATUS[1]=‘not applicable’

  • Distro version | bullseye

  • Kernel version | Linux DietPi 6.1.0-rc1 #1 SMP PREEMPT Wed Nov 9 01:08:14 UTC 2022 aarch64 GNU/Linux

  • SBC model | Quartz64 (aarch64)

  • Power supply used | EG: 5V 3A

  • SD card used | SAMSUNG 32 EVO

Steps to reproduce

The machine works correctly, but if I install the RS485 CAN HAT card the machine does not boot.

The card should require two command lines, which in Raspbian are placed in /boot/config.txt

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=1000000

But unfortunately I can’t install anything as I don’t know how to do this with DietPI.
The chip I use for the CAB BUS is the classic mcp2515 and uses interrupt 25 to receive calls on the communication bus.
The connection takes place via SPI which is still active.

I honestly haven’t found anything on the net and I’m sorry as DietPi is an excellent management system for the Klipper 3D printer management program on Quartz64 which, moreover, works beautifully and has no problems during installation.

Can anyone give them a hand?
Thank you

Are you sure your HAT will be working on a Quartz64? Looks like it’s designed for Raspberry Pi device.

Yes /boot/config.txt would be existing on RPi SBC but on Quartz64 we use different base image.

Maybe @MichaIng has some ideas.

dtparms, this device thee, the whole config.txt, are a RPi-only thing which does not exist on mainline kernel and U-Boot. So indeed it looks like the HAT is designed for RPi, especially if the vendor did not give any other instructions than using config.txt.

In theory, since 40-pin GPIO headers are often compatible, it might work, but no one created a device tree overlay to have the GPIO pins and SPI configured correctly for this HAT. If you are able to get it working with a device tree overlay, I’d be happy to add it to our kernel build. Generally extlinux supports device tree overlays. A start could be to have a look at the RPi overlay here: linux/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts at 4161eac00a3c1c2e756e0210005080bc90494577 · raspberrypi/linux · GitHub
But it surely needs adjustments for Quartz64, and I’m not experienced enough to do this.