Jetson nano and mcp2515 can module

hi shgarg, my MCP nitialized successfully and interrupts assigned correctly under /proc/interrupts but no communication. (1) . I am sure 120 ohm termination is there on the bus (2) There is no activity on CAN H and L pins.
But it is ok on respberry pi

1 Like

Hi xudonglei2020, I have a working dts file modified from Linux_for_Tegra and Seed-Studio’s MCP implementation. I got it working on my Jetson Nano with an MCP2515 board from Joy-It (SBC-CAN01) running a 16 MHz oscillator. Feel free to try it.

To use:

  1. Clone the Seeed-Studio github repository as stated by andrew_h above from GitHub - Seeed-Studio/seeed-linux-dtoverlays: Device Tree Overlays for Seeed boards
  2. Download the dts file here and save it to seeed-linux-dtoverlays-master/overlays/jetsonnano
  3. In the folder seeed-linux-dtoverlays-master run “make all_jetsonnano”
  4. Remove the existing overlays in /boot - I got a conflict that prevented me from running jetson-io when both files were still present
    “sudo rm /boot/tegra210-p3448-0000-p3449-0000-a01-mcp251x.dtbo”
    “sudo rm /boot/tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo”
  5. Copy the generated jetson-mcp251x.dtbo file from seeed-linux-dtoverlays-master/overlays/jetsonnano into /boot/
  6. Run jetson-io and configure for MCP251x

If you need to run a different oscillator frequency change it under clock-frequency on line 30 of the dts file
jetson-mcp251x.dts (3.8 KB)

1 Like

I’ve been following this for a while because I too had some issues, and I would just put my 3½ cents worth of comments here. All of this was done with JetPack 4.5.1.

I have three MCP2515 modules: One from Mikroe, one that says NiRen on the pcb, and one with an identical board to the NiRen one, but it doesn’t have any other identifying print. Of those three, only one works, and it is the non-identifiable one. I tested 3 different NiRen ones, and as I mentioned, none of them worked. The Mikroe one had a 10 MHz oscillator, the other ones 8 MHz, so I updated the device tree, but it didn’t do anything. I tried with 2 different Mikroe boards.

The errors on the NiRen ones is, that they cannot receive at all. The Mikroe one will receive one frame, then the bus dies and the interface has to be restarted, after which it will be able to receive another frame. This would indicate that the 10 MHz change worked.

It seems absolutely arbitrary which things will work and which won’t.

Hi @shgarg ,

I have tried some solutions from the above thread but have not been able to send/receive any CAN data. Receiving data only one time when powering on jetson nano dev board with additional bytes, after receiving one data not able to receive it again.

cansend can0 123#ff
cansend can0 123#ff
cansend can0 123#ff

candump can0
can0 000 [2] 38 08
can0 123 [1] FF

  1. MCP2515 successfully initialized
    dmesg | grep mcp
    [ 7.833549] mcp251x spi0.0: failed to get GPIO from device tree
    [ 7.857741] mcp251x spi0.0 can0: MCP2515 successfully initialized.
    [ 7.872294] mcp251x spi1.0: failed to get GPIO from device tree
    [ 8.898680] mcp251x spi1.0: MCP251x didn’t enter in conf mode after reset
    [ 8.898694] mcp251x spi1.0: Probe failed, err=16
    [ 8.898709] mcp251x: probe of spi1.0 failed with error -16

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

  3. ip -d -s link show can0
    4: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
    link/can promiscuity 0
    can state BUS-OFF restart-ms 0
    bitrate 500000 sample-point 0.750
    tq 250 prop-seg 2 phase-seg1 3 phase-seg2 2 sjw 1
    mcp251x: tseg1 3…16 tseg2 2…8 sjw 1…4 brp 1…64 brp-inc 1
    clock 4000000
    re-started bus-errors arbit-lost error-warn error-pass bus-off
    0 0 0 1 1 1 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    RX: bytes packets errors dropped overrun mcast
    3 2 1 0 1 0
    TX: bytes packets errors dropped carrier collsns
    18446744073709551615 1 0 0 0 0

I am using jetpack4.5.1, I tried your dtb and dtbo and also complied new mcp251x.ko with patches that you have shared in above thread but its not working.
please help me.

Hi All
I am trying to interface mcp 2515 and tja1050 receiver (8Mhz)Crystal connected to Nano and one USB CAN Analyser connected to a windows machine. I first tried updating dtb with 8 Mhz crystal and was able to receive data using candump can0 command.But when I am using the command

cansend can0 123#FF

I am not getting any error but data is not being sent. please see the attached reply of command ip -d -s link show can0. At one time error frame with data 0 was sent.

ip -d -s link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE restart-ms 0
bitrate 1000000 sample-point 0.750
tq 125 prop-seg 2 phase-seg1 3 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 1 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
11 10 2 8 2 0
TX: bytes packets errors dropped carrier collsns
18446744073709551613 3 0 0 0 0

On issue i found is that whenever i try to send a data the can state changes to " BUS OFF" and i am not able to recieve any data on CAN_USB Analyser.
I also tried with changing dtb clock to 16Mhz and Tested bitrate 500kbps,250kbps but no results.
Someone please help me solve this issue.
Awaiting reply

Thanks in Advance

My jetson nano is jetpack4.51 version;
MCP251x.dtbo compiled by Seeed-Studio/seeed-linux-dtoverlays;

But when sudo ip link set can0 type can bitrate 500000 or sudo ip link set up can0, an error is reported: Cannot find device “can0”.

Excuse me, what’s the situation? And how to solve this problem?

1 Like

I have followed your instructions, but in the end an error was reported: Cannot find device “can0”。

Please follow: