Jetson Nano and SPI CAN Bus

Hello,

I am trying to set up the SPI CAN module ( Amazon.com ).

Here is what I have done so far and where I am stuck.

Here is pinout mapping between Jetson Nano and the above SPI can module. Please note this module has 8Mhz cristal where higher prices modules use 16Mhz. Not sure if this clock is used for SPI or CAN bus signal sampling and if this needs to be accounted for somewhere on Nano configuration.

J41 Pin → SPI module
19 SI
21 SO
23 SCK
4 VCC
6 GRD
24 CS
?? INT
[EDIT} I connected INt to pin 31?

I am not sure is what I should do with pin INT (Interrupt). Which pin on Nano it should connect to. Or maybe it is unused?

Next, I did run jetson-io.py and selected spi1. Save and reboot.
After reboot I can see four devices /dev/spidev0.0 , 0.1, 1.0 and 1.1

I hope I did not miss any steps until this point.
From now on is where I am lost what needs to be done next. If I do ifconfig -a in the terminal I do not see can0 device.

Also, it would be great to add MCP2515 to jetson-io.py devices.
I just started reading documentation about jetson-io.py and it states that additional devices can be added. Has anyone succeeded?

Thank you all for your help

Could you verify the pinmux configure by loopback test via spidev_test.

@ShaneCCC I downloaded and compiled this version I found GitHub - rm-hull/spidev-test .When running

 $ ./spidev_test -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  | ................................

This implies the pins MOSI and MISO aren’t connected. But they are as I indicated above with pin mappings. Does this rest require actual hardware being connected? If so maybe my module is bad. I have another module I can swap it to test. What would be next steps diagnosing this. Running again jetson-io.py I see that pins 19, 21,23, 24, 26 are configured as SPI. I connected all pins except pin 26.

Thank you

You can connect pin 19/21 then run the spidev_test to make sure of it.

Ok connecting 19/21 and running again RX echoed TX. So that is good.
Also looking around the forums I found out that INTerupt should be connected to GPIO_PZ0, Pin 31. Correct?
I also found this post that I am trying Jetson nano and mcp2515 can module - #229 by shgarg post. After downloading attached zip file I did followed to step 8 when I get error saving. I did not rename any files and I did not copy b00 file in zip file. I see another person also has same issue as I do.
Please advise on fix related to link I provided or new steps I should follow.

NVIDIA Jetson Nano (Developer Kit Version)
L4T 32.4.4 [ JetPack UNKNOWN ]
Ubuntu 18.04.5 LTS
Kernel Version: 4.9.140-tegra
CUDA 10.2.89
CUDA Architecture: 5.3
OpenCV version: 4.1.1
OpenCV Cuda: NO
CUDNN: 8.0.0.180
TensorRT: 7.1.3.0
Vision Works: 1.6.0.501
VPI: 0.4.4

Thank you

So here is little more information about what I did cording to link to other thread.
Also, I am only interested in CAN interface on SPI1. I do not need two CAN buses. Other SPI2 I like to use it for other sensors down the road.

I only copied tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo from zip to /boot. Here is listing of my /boot

drwxr-xr-x 2 root root     4096 Nov 10 19:41 dtb
drwxr-xr-x 2 root root     4096 Nov  9 19:42 extlinux
drwxr-xr-x 2 root root     4096 Oct 15 20:18 grub
-rw-r--r-- 1 root root 34332680 Oct 27 23:14 Image
-rw-r--r-- 1 root root  5487776 Oct 16 14:45 initrd
lrwxrwxrwx 1 root root       24 Oct 15 20:18 initrd.img -> initrd.img-4.9.140-tegra
-rw-r--r-- 1 root root 15267640 Oct 15 20:33 initrd.img-4.9.140-tegra
-rw-r--r-- 1 root root     1010 Oct 27 23:14 tegra210-jetson-tx1-p2597-2180-a01-devkit-adafruit-sph0645lm4h.dtbo
-rw-r--r-- 1 root root   487257 Oct 27 23:14 tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
-rw-r--r-- 1 root root     2716 Oct 27 23:14 tegra210-jetson-tx1-p2597-2180-a01-devkit-fe-pi-audio-z-v2.dtbo
-rw-r--r-- 1 root root     3149 Oct 27 23:14 tegra210-jetson-tx1-p2597-2180-a01-devkit-hdr40.dtbo
-rw-r--r-- 1 root root   487786 Oct 27 23:14 tegra210-jetson-tx1-p2597-2180-a02-devkit-24x7.dtb
-rw-r--r-- 1 root root   242720 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a00.dtb
-rw-r--r-- 1 root root     1018 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a01-adafruit-sph0645lm4h.dtbo
-rw-r--r-- 1 root root   242680 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a01.dtb
-rw-r--r-- 1 root root     2724 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a01-fe-pi-audio-z-v2.dtbo
-rw-r--r-- 1 root root     3313 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a01-hdr40.dtbo
-rw-r--r-- 1 root root     1054 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a02-adafruit-sph0645lm4h.dtbo
-rw-r--r-- 1 root root   243182 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a02.dtb
-rw-r--r-- 1 root root     2760 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a02-fe-pi-audio-z-v2.dtbo
-rw-r--r-- 1 root root     3349 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-a02-hdr40.dtbo
-rw-r--r-- 1 root root     3305 Nov 10 19:43 tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo
-rw-r--r-- 1 root root   243182 Oct 27 23:14 tegra210-p3448-0000-p3449-0000-b00.dtb
-rw-r--r-- 1 root root   244603 Nov 10 19:21 tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb
-rw-r--r-- 1 root root   243164 Oct 27 23:14 tegra210-p3448-0002-p3449-0000-a02.dtb
-rw-r--r-- 1 root root   243160 Oct 27 23:14 tegra210-p3448-0002-p3449-0000-b00.dtb
-rw-r--r-- 1 root root     1010 Oct 27 23:14 tegra210-p3448-0003-p3542-0000-adafruit-sph0645lm4h.dtbo
-rw-r--r-- 1 root root   267056 Oct 27 23:14 tegra210-p3448-0003-p3542-0000.dtb
-rw-r--r-- 1 root root     2716 Oct 27 23:14 tegra210-p3448-0003-p3542-0000-fe-pi-audio-z-v2.dtbo
-rw-r--r-- 1 root root     3305 Oct 27 23:14 tegra210-p3448-0003-p3542-0000-hdr40.dtbo

as well /boot/dtb

-rw-r--r-- 1 root root 243182 Nov  7 00:57 tegra210-p3448-0000-p3449-0000-b00.dtb

I noticed I have tegra210-p3448-0000-p3449-0000-b00.dtb in both /boot and /boot/dtb

autobon@nano /boot/dtb
 $ ls -l tegra210-p3448-0000-p3449-0000-b00.dtb
-rw-r--r-- 1 root root 243182 Nov  7 00:57 tegra210-p3448-0000-p3449-0000-b00.dtb
autobon@nano /boot/dtb
 $ ls -l ../tegra210-p3448-0000-p3449-0000-b00.dtb
-rw-r--r-- 1 root root 243182 Oct 27 23:14 ../tegra210-p3448-0000-p3449-0000-b00.dtb

When I do xdd on each file and do diff between them I see they are not the same. Strange?

Now with tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo copied I try to run
sudo /opt/nvidia/jetson-io/jetson-io.py and after selecting MCP Can module I get error when I am trying to save.

  =================== Jetson Expansion Header Tool ===================
 |                                                                    |
 |                                                                    |
 |                            FATAL ERROR!                            |
 |                                                                    |
 |                                                                    |
 | Failed to overlay /boot/dtb/tegra210-p3448-0000-p3449-0000-b00.dtb |
 |    with /boot/tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo!     |
 |                                                                    |
 |                     Press any key to terminate                     |
 |                                                                    |
 |                                                                    |

@shgarg Do you have any input on why I am getting this error?
Also since most of people are only needing single CAN, would it be possible to add that overlay to jetson-io script so not of us have to mess around it? Looks like there is a log of confusions among a lot of users :)

Also, regarding your suggested changes. Will they be persistent between system updates (apt full-upgrade) Or is this expected to stop working and needs to be allied manually again?

Thank you

I was wondering; Does NVIDIA provide paid support? Could someone please let me know who to contact about this issue?

I follow the comment copy all of those three file to Nano and run the sudo jetson-io.py to configure and save without problem.

@ShaneCCC that is great. But how does that help me and others that has similar issues on other threads. I did try to provide all steps taken and out come. There is no better error that I can see that I can report. What and where should I check now? Where should I start? Did you run your test on in updated image you placed on your SD card? Or did you update anything. Again I am glad it worked for you… but I am still stock here.
Also there are some questions above to tell me where things stand. Classic “it works for me” I am afraid does not work here :)
I report because like others we trying to get our projects working. But at the same time help NVIDIA to make things better for every one.

Please help

OK, my image is in SD card instead of SSD.

Could you try to update the system image by below command for jetson-io.

sudo ./flash.sh jetson-nano-qspi-sd sda1 
1 Like

Thank you for pointing autocorrection error. I am also using SD Card. I corrected above. I will try with fresh image on new card and report here. Did you update to latest after booting? Or are you doing this with out apt update/full-upgrade? Just want to make sure something did not break after upgrade. I will try with out upgrade first and if it works I am assuming, it should still work after system upgrade. Or are we expected to do this after each upgrade because earlier setting will be removed. I am just making sure I understand all aspects.
Will get back to you in a few
Thank you

I update to J4.4(r32.4.3) by sdkmanager or flash.sh command.

@ShaneCCC
So I got a little further but having an issue booting, I am attaching a full serial boot log. nano_boot_MCP251x.log (19.7 KB)

I have my CAN module connected to GPIO pins outlined in initial post.

So I downloaded today’s latest image. Here is the exact size of the downloaded zip
-rw-rw-r-- 1 oxoocoffee oxoocoffee 6450819553 Nov 16 12:32 jetson-nano-4gb-jp441-sd-card-image.zip

I wrote it to a brand new 32G SD card and booted from it. After accepting the agreement I did not do a system update or any other changes. I did copy three files located in mcp-latest.zip to

$ sudo cp tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo /boot
$ sudo cp tegra210-p3448-0000-p3449-0000-a02.dtb /boot/dtb/
$ sudo cp tegra210-p3448-0000-p3449-0000-b00.dtb /boot/dtb/

Next, I did run
sudo /opt/nvidia/jetson-io/jetson-io.py

Selected MCP then save and reboot. This time I did not have a save error. But there is an error when booting. It is booting in the loop. The log file I am providing is where it stops and after some time it reboots itself again. From what I can tell there were others with such issues where they could not fully boot.

Here is my system info (without any updates)

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

cat /etc/nv_tegra_release 
# R32 (release), REVISION: 4.4, GCID: 23942405, BOARD: t210ref, EABI: aarch64, DATE: Fri Oct 16 19:44:43 UTC 2020

$ uname -a
Linux ab-sim-master 4.9.140-tegra #1 SMP PREEMPT Fri Oct 16 12:32:46 PDT 2020 aarch64 aarch64 aarch64 GNU/Linux

Do you still recommend running sudo ./flash.sh jetson-nano-qspi-sd sda1 at this point? If so where can I get flesh.sh and jetson-nano-qspi-sd

EDIT: So I found NV_Jetson_Nano_Developer_Kit_User_Guide.pdf. Reading…

Thank you

Those package was gen by the sdkmanager after you install the system image.
You should be able know the patch from the sdkmanager GUI.

Could you run jetson-io.py save without reboot and check the /boot/extlinux/extlinux.conf
Also you can modify the extlinux.conf to create a backup boot entry if you have UART connect to select the backup entry if can’t boot.

@ShaneCCC
When you say Those package are you referring to jetson-nano-4gb-jp441-sd-card-image.zip or mcp-latest.zip? Please be more specific. There are too many “packages” involved.
When you say “install the system image” do you mean create an SD card from ‘jetson-nano-4gb-jp441-sd-card-image.zip’?
“You should be able know the patch from the sdkmanager GUI.” Where can I find it? is it on the Nano SD card I booted from?

Do I have to complete the above steps first before I rerun " jetson-io.py"?
If I missed some step above please be more specific not short generic answers :)

So I did rerun jetson-io.py, selected MCP and saved without reboot

 |                    Configuration saved to file                     |
 |/boot/tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dtb.|
 |                                                                    |
 |                   Reboot system to reconfigure.                    |
 |                                                                    |
 |                                                                    |
 |                       Press any key to exit                        |

Here is contents of /boot/extlinux/extlinux.conf

TIMEOUT 30
DEFAULT MCP251x CAN Controller

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    INITRD /boot/initrd
#    APPEND ${cbootargs}

LABEL MCP251x CAN Controller
	MENU LABEL MCP251x CAN Controller
	LINUX /boot/Image
	FDT /boot/tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dtb
	INITRD /boot/initrd
	APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

Also this looks suspicious in log file I attached

## Flattened Device Tree blob at 80000000
   Booting using the fdt blob at 0x80000000
   reserving fdt memory region: addr=80000000 size=20000
   Using Device Tree in place at 0000000080000000, end 000000008003ea94

ERROR: DT property /psci/nvidia,system-lp0-disable missing in source; can't copy

at /dvs/git/dirty/git-master_linux/3rdparty/u-boot/arch/arm/mach-tegra/dt-edit.c:176/fdt_iter_copy_prop()

Thank you

You can download the sdkmanager from below link and run it on host PC.

Below link are how to flash Image to external SSD may be help.

@ShaneCCC
Please note as I pointed earlier that I am NOT using SSD. I am using SD Card. So please do not increase SSD information here. It is already unnecessarily complicated steps to get what I want.
I feel like instead of getting closer I am getting farther from my problem. I provided logs and everything I could to help navigate this issue. All I (and looks like others in other related threads) am getting is “it works for me”. So could you please explain in DETAIL how your system/setup is different based on the information I provided? When you stated “it works for me” did you mean you were able to save on the last step in jetson-io.py? Or were you able to boot? and CAN bus worked?

On a different note. I did try just a few min ago to do a system update (apt full-upgrade).
As some point of upgrade, I got this ERROR

Setting up gir1.2-gdm-1.0 (3.28.3-0ubuntu18.04.6) ...
Setting up gdm3 (3.28.3-0ubuntu18.04.6) ...
Processing triggers for nvidia-l4t-kernel (4.9.140-tegra-32.4.4-20201027211359) ...
Processing triggers for ca-certificates (20201027ubuntu0.18.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Errors were encountered while processing:
 nvidia-l4t-kernel-dtbs
E: Sub-process /usr/bin/dpkg returned an error code (1)

Running again I get issue related to dtb I copied

Do you want to continue? [Y/n] Y
Setting up nvidia-l4t-kernel-dtbs (4.9.140-tegra-32.4.4-20201027211359) ...
Decompile /boot/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb
tegra210-p3448-0000-p3449-0000-b00.dtb failed, quit.
dpkg: error processing package nvidia-l4t-kernel-dtbs (--configure):
 installed nvidia-l4t-kernel-dtbs package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 nvidia-l4t-kernel-dtbs
E: Sub-process /usr/bin/dpkg returned an error code (1)

Do you guys have plans to add MCP to jetson-io.py like two other devices that are there?

Ok, So I just set up a new VM 18.04 with the latest updates. Then I installed the latest SDK manager.
Now, after starting sdkmanager, I signed in and it looks like my Nano be connected.
So I am trying to figure out what is my next step?

  1. Do I connect USB port to VM running sdk manager?
  2. Do I have to enter some DFU mode?

Again. With very partial information I am getting back I feel like I am 10 steps closer to my problem vs one step closer. I understand everyone is busy. I just want to get this done and move on with my tasks.
Is there a paid support I can call and get this resolved in a timely matter? Or set up Zoom? Then I will do a clear write-up for others to enjoy since this looks like a very hard thing to do here.

Thank you

I saw your post linked on this thread.

I had similar issues trying to get this same CAN board up and running. I posted my experience and what I did on the other thread.