CANBus [MCP 2515] not working with Jetson Nano 4GB B01

Hi,

I want to communicate with my Jetson nano and MCP2515 CAN module over SPI. I’ve gone through multiple forums and none of the proposed solution worked for me. Is there a definitive guide with steps to configure Nano for MCP2515 [8Mhz clock].

Current state:
I’m running JetPack 45.1 on GB B01 board. I’ve connected a single MCP 2515 with following following pins
INT - 31
SCK - 23
SI - 19
SO - 21
CS - 24
GND - 25
VCC - 2

After configuring MCP 251X using jetson-io.py, I’m able to see can0 as one of the link types using ‘ip addr’. Other than this, i validated following

sudo dmesg | grep mcp
mcp251x spi0.0 can0: MCP2515 successfully initialized.
mcp251x spi1.0: MCP251x didn’t enter in conf mode after reset
mcp251x spi1.0: Probe failed, err=16
mcp251x: probe of spi1.0 failed with error -16
[We are configuring only can0]

cat /proc/interrupts | grep mcp
299: 2 0 0 0 GPIO 200 Edge mcp251x

ip -d -s link show can0
can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state STOPPED restart-ms 0
mcp251x: tseg1 3…16 tseg2 2…8 sjw 1…4 brp 1…64 brp-inc 1
clock 10000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 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

After bringing up the can0 link using sudo ip link set can0 up type can bitrate 125000, the candump can0 is unable to receive any packets sent via cansend can0. Strangely after sending message 10-12 times using cansend, cansend throws error ‘No buffer space available” on subsequent invocations.

To ensure that it is not an issue with loop back, I added another can module to the canbus and sent a message using that. In this case candump displays first few messages and then stops receiving any more messages.

candump can0
can0 000 [1] 23
can0 1C7 [8] 38 E3 8E 38 E3 8E 38 E3
can0 000 [1] 23
can0 1C7 [8] 38 E3 8E 38 E3 8E 38 E3
can0 000 [3] 8E 38 E3

As recommended by shgarg@ on one of the threads, I decompiled the kernel_tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller, changed the clock frequency to 16Mhz [twice of MCP2515 clock] and placed back in /boot folder. This also didn’t work.

I also tried capturing the packets using tcpdump for can link but no packets were captured.

The issues was fixed by following step suggest [here]( dev forum )

Nice! Glad to know you find the solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.