How to get Pican2 Can Controller working?

Hi there,

I have an Pican2 Shield, which works well on an Raspberry Pi, but it doesn’t work on my Banana Pi M2 Berry. I get some mcp2515 dcp-Files, but they are all for orangePI. The only thing I get to work a little bit is this file: sunxi-DT-overlays/spi-mcp251x.dts at master · armbian/sunxi-DT-overlays · GitHub But it gives me some Errors after reboot like no valid map

Someone faces the same problem or better, get a solution for it?

My system is armbian buster lite version 21.02.1

regards Pascal

i am a little bit further, just to say.

I get following messages:

$ dmesg | grep spi || can
[    1.542959] sun6i-spi 1c05000.spi: Failed to request TX DMA channel
[    1.542978] sun6i-spi 1c05000.spi: Failed to request RX DMA channel
[    1.543860] sun6i-spi 1c05000.spi: chipselect 0 already in use
[    1.543881] spi_master spi0: spi_device register error /soc/[email protected]/[email protected]
[    1.543908] spi_master spi0: Failed to create SPI device for /soc/[email protected]/[email protected]
[    6.980799] mcp251x spi0.0: there is not valid maps for state default
[    8.037029] mcp251x spi0.0: MCP251x didn't enter in conf mode after reset
[    8.037237] mcp251x spi0.0: Probe failed, err=110
[    8.037263] mcp251x: probe of spi0.0 failed with error -110

This comes also:

[    7.098620] sun4i-pinctrl 1c20800.pinctrl: unsupported function irq on pin PD21

My armbianEnv.txt :

verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-r40
rootdev=UUID=6418452f-6e30-4944-b4ef-dadc965d2ee5
rootfstype=ext4
overlays=spi-spidev0
user_overlays=spi-mcp2515
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

my user overlay:

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun50i-h6";

    [email protected] {
            target-path  = "/";
            __overlay__ {
                    can0_osc_fixed: can0_osc_fixed {
                            compatible = "fixed-clock";
                            #clock-cells = <0>;
                            clock-frequency  = <8000000>;
                    };
            };
    };

    [email protected] {
            target = <&pio>;
            __overlay__ {
                    can0_pin_irq: can0_pin_irq {
                            pins = "PD21";
                            function = "irq";
                            bias-pull-up;
                    };
            };
    };

    [email protected] {
            target = <&spi0>;
            __overlay__ {
                    status = "okay";
                    #address-cells = <1>;
                    #size-cells = <0>;
                    can0:[email protected] {
                            reg = <0>;
                            compatible = "microchip,mcp2515";
                            pinctrl-names = "default";
                            pinctrl-0 = <&can0_pin_irq>;
                            spi-max-frequency = <10000000>;
                            interrupt-parent = <&pio>;
                            interrupts = <3 21 2>; /* PD21 -> 0 7 2 = PA7 IRQ_TYPE_EDGE_FALLING */
                            clocks = <&can0_osc_fixed>;
                            status = "okay";
                    };
            };
    };
};

I tried it also with irq pin PA7 and 0 7 2 as interrupts. Doesn’t work. Seems there are some problems with the pins. My knowledge is not deep enough here :frowning:

But maybe this helps someone to analyze that better. Would be nice if I can get some help here :slight_smile: