We have two CAN interfaces on our board and I am looping between them. I have added them to the device tree and enabled the drivers. Everything appears to be working correctly – the drivers are loaded at boot and I can enable both CAN ports. I can send a packet of data and the transmit and receive information looks perfect. Now to the problem – when I run candump to confirm the data is correct, the command just stops and never returns to the prompt. I can use Ctrl-C to terminate it but no data is ever displayed. I am providing my findings below. Appreciate any help!
Here is the dmesg output. Is the ‘supply xceiver not found’ message a problem?
root@imx6qc398:~# dmesg | grep -i can
[ 1.277826] CAN device driver interface
[ 1.280764] 2090000.can supply xceiver not found, using dummy regulator
[ 1.286810] flexcan 2090000.can: device registered (reg_base=f0288000, irq=142)
[ 1.292971] 2094000.can supply xceiver not found, using dummy regulator
[ 1.298969] flexcan 2094000.can: device registered (reg_base=f0290000, irq=143)
[ 2.720615] can: controller area network core (rev 20120528 abi 9)
[ 2.728738] can: raw protocol (rev 20120528)
[ 2.731713] can: broadcast manager protocol (rev 20120528 t)
[ 2.736102] can: netlink gateway (rev 20130117) max_hops=1
Sequence of commands that shows proper operation. Note the TX and RX buffers after the send. Looks correct so I believe data is being moved.
root@imx6qc398:~# ip link set can0 up type can bitrate 125000
flexcan 2090000.can can0: writing ctrl=0x0e312005
root@imx6qc398:~# ip link set can1 up type can bitrate 125000
flexcan 2094000.can can1: writing ctrl=0x0e312005
root@imx6qc398:~# ifconfig
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:8 (8.0 B) TX bytes:0 (0.0 B)
Interrupt:142
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:143
eth0 Link encap:Ethernet HWaddr 00:01:45:05:C0:63
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 B) TX bytes:700 (700.0 B)
root@imx6qc398:~# cansend can0 150#11.22.33.44
root@imx6qc398:~# ifconfig
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:8 (8.0 B) TX bytes:4 (4.0 B)
Interrupt:142
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:4 (4.0 B) TX bytes:0 (0.0 B)
Interrupt:143
eth0 Link encap:Ethernet HWaddr 00:01:45:05:C0:63
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 B) TX bytes:700 (700.0 B)
root@imx6qc398:~# candump can1
root@imx6qc398:~#
When I run the candump command with different settings, it does reveal that some of the utility is being executed but never returning.
root@imx6qc398:~# candump -l -s 0 can1
Enabling Logfile 'candump-2016-04-14_161516.log'
^C
Warning: console output active while logging!
root@imx6qc398:~# candump -l -s 2 can1
Enabling Logfile 'candump-2016-04-14_161536.log'
^C
root@imx6qc398:~#
root@imx6qc398:~# candump -l -s 2 can111111111111111111111111111
name of CAN device 'can111111111111111111111111111' is too long!
root@imx6qc398:~# candump -t e can1
candump: unknown timestamp mode 'e' - ignored
^C
root@imx6qc398:~#
How can I edit the source code for candump.c to add additional debug code to help pinpoint the issue? I have tried to change the source file I have in my work directory, but it does not work.
Solved! Go to Solution.
Problem solved: It is not well documented, but the candump utility is used to echo packets received after it is run. It is not used to dump packets that have already been sent. Don't know if this was obvious to others but it wasn't to me.
Problem solved: It is not well documented, but the candump utility is used to echo packets received after it is run. It is not used to dump packets that have already been sent. Don't know if this was obvious to others but it wasn't to me.