Edit online

CAN 配置

2 Dec 2024
Read time: 1 minute(s)
CAN 包括以下配置内容:
  1. 内核配置
    [*] Networking support--->
            <*> CAN bus subsystem support--->
                    CAN Device Drivers--->
                        <*> Platform CAN drivers with Netlink support
                        [*] CAN bit-timing calculation
                        <*> Support for ARTC CAN
    
  2. DTS 配置
    CAN 模块基本配置
    can0: can@19230000 {
        compatible = "artc,artc-can";
        reg = <0x0 0x19230000 0x0 0x400>;
        interrupts-extended = <&plic0 88 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cmu CLK_CAN0>;
        resets = <&rst RESET_CAN0>;
    };
    
    can1: can@19231000 {
        compatible = "artc,artc-can";
        reg = <0x0 0x19231000 0x0 0x400>;
        interrupts-extended = <&plic0 89 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&cmu CLK_CAN1>;
        resets = <&rst RESET_CAN1>;
    };
    
    xxx/board.dts 配置
    &can0 {
        pinctrl-names = "default";
        pinctrl-0 = <&can0_pins>;
        status = "okay";
    };
    
    &can1 {
        pinctrl-names = "default";
        pinctrl-0 = <&can1_pins>;
        status = "okay";
    };