26 设备树里mcp2515的描述

mcp2515工作原理及使用spi_board_info描述设备的方式请参考:http://blog.csdn.net/jklinux/article/details/74347820


mcp2515设备驱动在内核里的配置:

make menuconfig ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

[*] Networking support  --->
   <*>   CAN bus subsystem support  --->
    CAN Device Drivers  ---> 
        <*> Platform CAN drivers with Netlink support 
        [*]   CAN bit-timing calculation
            CAN SPI interfaces  --->
             <*> Microchip MCP251x SPI CAN controllers

保存退出后重编并更新内核镜像.


设备树里mcp2515设备节点的描述:
//连接在spi1控制器, 模块的int脚接PA12

&spi1 {
    #address-cells = <1>;
    #size-cells = <0>;

    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
    cs-gpios = <&pio 0 13 GPIO_ACTIVE_HIGH>;

    myspidev {
        compatible = "microchip,mcp2515";
        reg = <0>;
        clocks = <&osc24M>;
        status = "okay";
        spi-max-frequency = <5000000>;

        interrupt-parent = <&pio>;
        interrupts = <0  12  IRQ_TYPE_EDGE_FALLING>;

        vdd-supply = <&reg_vcc3v3>;
        xceiver-supply = <&reg_vcc3v3>;
    };  
};

驱动好后,可通过”ifconfig -a”查看到有can0设备.

©️2020 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值