1.使用make menuconfig命令进入配置界面
选择 [*] Networking support --->
选择<*> CAN bus subsystem support --->
全选,然后进入CAN Device Drivers --->
选择上图选择的所有选项,然后保存
2.设备树配置
&am33xx_pinmux {
dcan0_pins_default: dcan0_pins_default {
pinctrl-single,pins = <
AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE2)
AM33XX_IOPAD(0x97c, PIN_INPUT_PULLDOWN | MUX_MODE2)
>;
};
ehrpwm1a_pins: pinmux-ehrpwm1a-pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
>;
};
};
&dcan0 {
status = "okay"; /* Enable only if Profile 1 is selected */
pinctrl-names = "default";
pinctrl-0 = <&dcan0_pins_default>;
};
3.make all 并将编译好的内核文件和设备树文件放到板子中即可