97久久人妻精品中文无码_av老司机亚洲精品天堂_国产精品一级无码免费播放_大伊人无码综合天堂Av,_国产精品

RK3588-CAN總線

來源:jf_30051736


(資料圖片)

1. 簡介

ArmSoM-W3 RK3588 開發(fā)板中已集成AN總線:

專欄總目錄CAN(controller Area Network)CAN BUS:控制器局域網(wǎng)絡(luò)總線目前世界上絕大多數(shù)汽車制造廠商都采用CAN總線來實現(xiàn)汽車內(nèi)部控制系統(tǒng)之間的數(shù)據(jù)通信。RK3568/RK3588的CAN驅(qū)動文件:drivers/net/can/rockchip/rockchip_canfd.c

2. 內(nèi)核配置

rockchip_linux_defconfig配置:
CONFIG_CAN=yCONFIG_CAN_DEV=yCONFIG_CAN_ROCKCHIP=yCONFIG_CANFD_ROCKCHIP=y
內(nèi)核配置:
cd kernelmake ARCH=arm64 menuconfigmake savedefconfig
選擇:Networking support ---> CAN bus subsystem support ( )--->CAN Device Drivers() ---> Platform CAN drivers with Netlink support(*)

3. DTS 節(jié)點配置

3.1 主要參數(shù):

interrupts = ;

轉(zhuǎn)換完成,產(chǎn)生中斷信號。

clock

時鐘屬性,用于驅(qū)動開關(guān)clk,reset屬性,用于每次復位總線。

pinctrl

3.2 公共配置 kernel-5.10/arch/arm64/boot/dts/rockchip/rk3588s.dtsi

can1: can@fea60000 {            compatible = "rockchip,can-2.0";            reg = < 0x0 0xfea60000 0x0 0x1000 >;            interrupts = < GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH >;            clocks = < &cru CLK_CAN1 >, < &cru PCLK_CAN1 >;            clock-names = "baudclk", "apb_pclk";            resets = < &cru SRST_CAN1 >, < &cru SRST_P_CAN1 >;            reset-names = "can", "can-apb";            pinctrl-names = "default";            pinctrl-0 = < &can1m0_pins >;            tx-fifo-depth = < 1 >;            rx-fifo-depth = < 6 >;            status = "disabled";    };
compatible = “rockchip,can-1.0” ,rockchip,can-1.0用來匹配can控制器驅(qū)動。compatible = “rockchip,can-2.0” ,rockchip,can-2.0用來匹配canfd控制器驅(qū)動。assigned-clock-rates用來配置can的始終頻率,如果CAN的比特率低于等于3M建議修改CAN時鐘到100M,信號更穩(wěn)定。高于3M比特率的,時鐘設(shè)置200M就可以。pinctrl配置:根據(jù)實際板卡連接情況配置can_h和can_l的iomux作為can功能使用。

3.3 板級配置 kernel-5.10/arch/arm64/boot/dts/rockchip/rk3588-armsom-w3.dts

/* can1 */&can1 {        status = "okay";        assigned-clocks = < &cru CLK_CAN1 >;        assigned-clock-rates = < 200000000 >;        pinctrl-names = "default";        pinctrl-0 = < &can1m1_pins >;      //根據(jù)原理圖配置};
由于系統(tǒng)根據(jù)上述dts節(jié)點創(chuàng)建的CAN設(shè)備只有一個,而第一個創(chuàng)建的設(shè)備為CAN0

4. 調(diào)試

查詢當前?絡(luò)設(shè)備:
ifconfig -a
CAN啟動
ip link set can0 down   //關(guān)閉CANip link set can0 type can bitrate 500000   //設(shè)置?特率500KHzip -details -statistics link show can0    //打印can0信息ip link set can0 up     //啟動CAN
CAN發(fā)送
cansend can0 123#DEADBEEF            //發(fā)送(標準幀,數(shù)據(jù)幀,ID:123,date:DEADBEEF)cansend can0 123#R                            //發(fā)送(標準幀,遠程幀,ID:123)cansend can0 00000123#12345678    //發(fā)送(擴展幀,數(shù)據(jù)幀,ID:00000123,date:DEADBEEF)cansend can0 00000123#R                 //發(fā)送(擴展幀,遠程幀,ID:00000123)
CAN接收
candump can0       //candump can0

審核編輯:湯梓紅

標簽:

推薦

財富更多》

動態(tài)更多》

熱點