usually bad wiringFirst of all, Happy New Year! Thank you for your replyIt's failed to read the register, so that's likely to imply a wiring issue with the SPI data, clock, or chip select line. It's got nowhere near trying to do anything with an interrupt at that point.
Check ALL your wiring.
GPIOs 9, 10, and 11 (pins 21, 19, and 23) for MISO, MOSI, and SCLK respectively, GPIO 8 (pin 24) for chip select, your interrupt on GPIO 22 (pin 15), and a ground.. The wiring is correct as you mentioned.
I've overcome this issue by entering "dtoverlay=mcp2517fd" in /boot/firmware/config.txt and compiled a dts file into dtbo to get it working.
mcp2517fd-overlay.dts content:
*** starts below this line ****** end above this line ***Code:
/dts-v1/;/plugin/;/ { compatible = "brcm,bcm2711"; fragment@0 { target = <&spi0>; __overlay__ { status = "okay"; can0: mcp2517fd@0 { compatible = "microchip,mcp2517fd"; reg = < 0>; /* bus 0, CS0 */ spi-max-frequency = <1000000>; /* Safe for bring-up */ interrupt-parent = <&gpio>; interrupts = <22 2>; /* GPIO25, falling edge */ clocks = <&clk40m>; clock-names = "osc"; status = "okay"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { clk40m: clk40m { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <40000000>; }; }; };};
! Note: realign '}' to the respective '{' column. They are flushed to the left side due to the editor here. (I don't know how to prevent the editor from removing spacing}
I have managed to get the CAN bus up and running, but there are errors as shown below:Very seldom, but the CAN bus hang/lag, and I am not sure if the errors cause the issue.Code:
[ 5585.933272] mcp251xfd spi0.0 can0: CRC read error at address 0x0010 (length=4, data=20 11 02 f0, CRC=0x6db6) retrying.[ 5585.933291] mcp251xfd spi0.0 can0: CRC read error at address 0x0010 (length=4, data=20 11 02 f0, CRC=0x6db6).[ 5585.933307] mcp251xfd spi0.0 can0: Error -74 while reading timestamp. HW timestamps may be inaccurate.[ 5630.989180] mcp251xfd spi0.0 can0: CRC read error at address 0x0010 (length=4, data=f1 a8 6d 5b, CRC=0x511a) retrying.
May I ask what could cause these errors, and how can I overcome them? Thank you
Statistics: Posted by wcl55 — Fri Jan 09, 2026 10:55 am