如何在 OpenWRT 上调出 mcp25xxfd 设备?

问题描述

我正在尝试让 mcp25xxfd 设备在 OpenWRT 上工作。目前我正在使用 ramips 平台(Linux 内核版本是 4.14.180)。我的一个 DTS 文件中有以下配置:

    osc: oscillator {
            compatible = "fixed-clock";
            clock-frequency  = <40000000>;
    };

    spidev1 {
        compatible = "spi-gpio";
        gpio-sck  = <&gpio0 25 GPIO_ACTIVE_HIGH>;
        gpio-mosi = <&gpio0 26 GPIO_ACTIVE_HIGH>;
        gpio-miso = <&gpio0 27 GPIO_ACTIVE_HIGH>;
        cs-gpios  = <&gpio0 28 GPIO_ACTIVE_HIGH>;
        num-chipselects = <1>;


        can0: mcp2517fd@0 {
                compatible = "microchip,mcp2517fd";
                status = "okay";
                clock-names = "can0_osc";
                clocks = <&osc>;
                reg = <0>;
                spi-max-frequency = <16000000>;
                interrupt-parent = <&gpio0>;
                interrupts = <11>;
        };
    };

但是,当我尝试使用 insmod 实用程序对其进行探测时,出现错误:

[   30.522030] mcp25xxfd: probe of spi1.0 failed with error -2

如果我注释掉以下部分

    compatible = "spi-gpio";
    gpio-sck  = <&gpio0 25 GPIO_ACTIVE_HIGH>;
    gpio-mosi = <&gpio0 26 GPIO_ACTIVE_HIGH>;
    gpio-miso = <&gpio0 27 GPIO_ACTIVE_HIGH>;
    cs-gpios  = <&gpio0 28 GPIO_ACTIVE_HIGH>;
    num-chipselects = <1>;

并尝试手动创建SPI设备

insmod spi-gpio-custom bus0=1,25,26,27,1000000,28

然后再次尝试加载 mcp25xxfd,没有任何反应:

root@Sensors:/# insmod mcp25xxfd
root@Sensors:/#

我可以看到 spidev1.0 在 /dev 上,但没有 can0。 有人可以帮忙解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)