Jetson TX2 MCP2515 spi can


I’m trying to enable MCP2515 CAN interface for my yocto image. I wanted to make some additions to “tegra186-quill-p3310-1000-c03-00-base.dts” file according to this guide, build kernel and flash jetson-tx2. I’m able to see spi3.0 at “/sys/bus/spi/devices”. I used “19,21,23,24” pins at “J21” header. When i try to grab some data from canbus with following commands:

  • ip link set can0 type can bitrate 500000

  • ip link set up can0

  • candump can0

There is no received data. As far as i know i should be seeing “/net/can0” under “/sys/bus/spi/devices/spi3.0” directory but it’s not there. Here is my .dts file.

Any suggestion would be appreciated.
Thanks and Best Regards.

Try enabling debug by putting #define DEBUG 1 at the top of …/kernel-4.9/drivers/net/can/spi/mcp251x.c
and putting some prints with dev_info(...) or similar in mcp251x_can_probe

Then rebuild your image, transfer it to the tx2 (no need to reflash, just copy it over to /boot), reboot, and check dmesg for your prints.

If you see your prints and the probe completes successfully then it’s probably a hardware issue (pin-mux, wiring, logic level, etc). If you do not see it probe then there’s likely a problem with your device tree.

I’m not familiar with yocto, does it modify the build process at all?

yeah, it rebuilds entire kernel. I enabled debugging and put some prints. I tried to find my prints with dmesg, but there was no output. I think my device tree is wrong as you mentioned. Is there any source to check proper addresses for spi/can at J21 header ?

Have a reference to below link should be help to know the detail information.
1 Like

For testing J21 you can try using the SpiDev module, here’s some instructions:

Did you already confirm that tegra186-quill-p3310-1000-c03-00-base.dts was the correct dtb by checking dmesg?

For example:

ubuntu@tegra-ubuntu:~$ dmesg | grep .dts
[    0.000000] DTS File Name: arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dts

Looks like all my links broke when they changed forum formats, but here’s my original guide that goes more in depth (for the TX1)