根据SABRE-SD参考设计做了一块板,调试CAN-BUS的时候遇到一些问题。
基线:android_kk4.4.2_1.0.0
代码方面按照"How to enable CAN bus on i.MX6Q SabreSD.pdf",
初始化:
vcan: Virtual CAN interface driver
flexcan netdevice driver
flexcan imx6q-flexcan.1: device registered (reg_base=d9978000, irq=142)
can: controller area network core (rev 20090105 abi 8)
can: raw protocol (rev 20090105)
can: broadcast manager protocol (rev 20090105 t)
配置: root@sabresd_6dq:/ # ip link set can0 up type can bitrate 125000
flexcan imx6q-flexcan.1: writing ctrl=0x0e31e055
查看:root@sabresd_6dq:/ # ip -details link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT qlen 10
link/can
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 30000000
貌似一切都正常
发送:root@sabresd_6dq:/ # cansend can0 -i0x100 11 22 33 44
interface = can0, family = 29, type = 3, proto = 1
另一块板子接收也没任何现象
再查看:root@sabresd_6dq:/ # ip -details link show can0
2: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT qlen 10
link/can
can state BUS-OFF (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
已经变成 BUS-OFF 状态
在CAN1_TX上也没有量出任何数据信号波动 |