微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 OpenWRT 上调出 mcp25xxfd 设备?

如何解决如何在 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 举报,一经查实,本站将立刻删除。