Colibri IMX6 eval board - CAN not working

Hi,

I am having trouble getting the CAN bus working on a Colibri IMX6S on the evaluation board. I’ve built and installed the angstrom-lxde-image on the board. It appears that the MCP2515 driver is installed fine and linked to CAN0 appropriately, and the can0 interface can be brought up without error, but it never shows any bytes received. I can send CAN data into the plug on the eval board and the TX/RX lights blink like the 2515 is receiving data, but the interface never shows any bytes received.

ifconfig output (after sending some data into X2)

root@colibri-imx6:/home# ifconfig -a
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: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)

ip statistics output (after sending some data into X2)

root@colibri-imx6:/home# ip -details -statistics link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state ERROR-PASSIVE restart-ms 0
          bitrate 125000 sample-point 0.875
          tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
          mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
          clock 8000000
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          2          2          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    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

MCP241X config

root@colibri-imx6:/home# zcat /proc/config.gz | grep CONFIG_CAN_MCP
CONFIG_CAN_MCP251X=y

can0 device

root@colibri-imx6:/# ls -l /sys/class/net/can0/device
lrwxrwxrwx 1 root root 0 Jun 11 14:30 /sys/class/net/can0/device -> ../../../spi3.0

Are you using candump can0 as documented in the CAN (Linux) article while receiving?

What device do you have connected? Are you using the same bitrate on both ends?

Yes I have tried candump can0, and it never shows any messages received. The device connected is some of our own hardware that we have used many years and constantly transmits some CAN data. Yes both sides are using the same bitrate (125,000).

Which software version are you using?

I have tried it with multiple builds, but the latest is the default LXDE demo image for imx6 , ie… 104968-colibri-imx6-linux-lxde-image-tezi.tar , and it still does not work.

I have noticed that before I execute the “ip link up can0…” command, if I connect a CAN device only the RX light blinks, and after executing the above command both tx and rx blink as if the MCP2515 is becoming active, but still the can0 always shows 0 bytes received and never outputs any data in candump (or any other application for that matter).

Could you try to send CAN Messages from colibri-imx6 and check if the reception on your CAN device is working well?

I found the problem- while setting up the tx test I found a bad connection! It is working now, thanks. Silly how simple it turned out to be.

Perfect, that it works. Thanks for the feedback.