参考文档i.MX_6_Linux_Reference_Manual.pdf,使能can1后loopback模式接收不到数据,论坛大神能否帮我看看。
以下是具体操作
root@imx6dlsabresd:~# ip link set can0 down
root@imx6dlsabresd:~# ip link set can0 type can bitrate 125000 loopback on
root@imx6dlsabresd:~# ip -details -statistics link show can0
2: can0: mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state STOPPED (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
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
root@imx6dlsabresd:~# ip link set can0 up
flexcan 2090000.can can0: writing ctrl=0x0e313005
root@imx6dlsabresd:~# candump can0 &
[1] 945
root@imx6dlsabresd:~# cansend can0 123#11223344556677
root@imx6dlsabresd:~# can0 123 [7] 11 22 33 44 55 66 77
root@imx6dlsabresd:~# ip -details -statistics link show can0
2: can0: mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
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
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
7 1 0 0 0 0