Sample Header Ad - 728x90

How to verify CAN interfaces with Linux?

1 vote
0 answers
2686 views
I want to verify the CAN interfaces on my embedded system. It has two can ports: can0 and can1. I bring them both up with the following sequence: # ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on # ip link set can0 up # ip link set can1 type can bitrate 1000000 dbitrate 2000000 fd on # ip link set can1 up I hooked them up to each other (CANHCANH, CANLCANL & GNDGND) with termination resistors on each side after the trabnsceivers. Now when I want to send traffic out on can0 and dump rthe incoming traffic on can1. I started candump -c -a any while I invoke:
# cansend can0 01a#11223344AABBCCDD
But after this, I get a bunch of kernel errors that look like: [ 1506.337694] rcar_canfd 10050000.can can0: ch erfl 401 txerr 128 rxerr 0 [ 1506.337702] rcar_canfd 10050000.can can0: Bus error [ 1506.337707] rcar_canfd 10050000.can can0: ACK Error Appears like 128 stands for CAN_ERROR_PASSIVE_THRESHOLD which indicates that about which I read: > **Error Passive**: In this state, the CAN node is still able to transmit data, but it now raises 'Passive Error Flags' when detecting > errors. Further, the CAN node now has to wait for an extra 8 bits (aka > Suspend Transmission Time) in addition to the 3 bit intermission time > before it can resume data transmission (to allow other CAN nodes to > take control of the bus) source: https://www.csselectronics.com/pages/can-bus-errors-intro-tutorial#:~:text=A%20CAN%20node%20enters%20the,if%20the%20TEC%20exceeds%20255 There's nothing showing with candump, though. The above messages show up in dmesg. But I still can see data on the CAN lines (with a scope). What do the errors mean, how can I address them and how can I actually see data with candump?
Asked by MisdeBug (43 rep)
Jun 23, 2023, 02:35 PM
Last activity: Jun 23, 2023, 07:11 PM