Jetson nano and mcp2515 can module

@shgarg,
My outputs:

huuver@huuver-desktop:~$ dmesg | grep mcp
[ 8.120729] mcp251x spi0.0 can0: MCP2515 successfully initialized.
[ 8.134747] mcp251x spi1.0: Cannot initialize MCP2515. Wrong wiring?
[ 8.141229] mcp251x spi1.0: Probe failed, err=19

huuver@huuver-desktop:~$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-255, parent: platform/6000d000.gpio, tegra-gpio:
gpio-0 ( )
gpio-1 ( )
gpio-2 ( |pcie_wake ) in hi
gpio-3 ( )
gpio-4 ( )
gpio-5 ( )
gpio-6 ( |vdd-usb-hub-en ) out hi
gpio-7 ( )
gpio-8 ( )
gpio-9 ( )
gpio-10 ( )
gpio-11 ( )
gpio-12 (SPI1_MOSI )
gpio-13 (SPI1_MISO )
gpio-14 (SPI1_SCK )
gpio-15 (SPI1_CS0 )
gpio-16 (SPI0_MOSI )
gpio-17 (SPI0_MISO )
gpio-18 (SPI0_SCK )
gpio-19 (SPI0_CS0 )
gpio-20 (SPI0_CS1 )
gpio-21 ( )
gpio-22 ( )
gpio-23 ( )
gpio-24 ( )
gpio-25 ( )
gpio-26 ( )
gpio-27 ( )
gpio-28 ( )
gpio-29 ( )
gpio-30 ( )
gpio-31 ( )
gpio-32 ( )
gpio-33 ( )
gpio-34 ( )
gpio-35 ( )
gpio-36 ( )
gpio-37 ( )
gpio-38 (GPIO13 )
gpio-39 ( )
gpio-40 ( )
gpio-41 ( )
gpio-42 ( )
gpio-43 ( )
gpio-44 ( )
gpio-45 ( )
gpio-46 ( )
gpio-47 ( )
gpio-48 ( )
gpio-49 ( )
gpio-50 (UART1_RTS )
gpio-51 (UART1_CTS )
gpio-52 ( )
gpio-53 ( )
gpio-54 ( )
gpio-55 ( )
gpio-56 ( )
gpio-57 ( )
gpio-58 ( )
gpio-59 ( )
gpio-60 ( )
gpio-61 ( )
gpio-62 ( )
gpio-63 ( )
gpio-64 ( )
gpio-65 ( )
gpio-66 ( )
gpio-67 ( )
gpio-68 ( )
gpio-69 ( )
gpio-70 ( )
gpio-71 ( )
gpio-72 ( )
gpio-73 ( )
gpio-74 ( )
gpio-75 ( )
gpio-76 (I2S0_FS )
gpio-77 (I2S0_DIN )
gpio-78 (I2S0_DOUT )
gpio-79 (I2S0_SCLK )
gpio-80 ( )
gpio-81 ( )
gpio-82 ( )
gpio-83 ( )
gpio-84 ( )
gpio-85 ( )
gpio-86 ( )
gpio-87 ( )
gpio-88 ( )
gpio-89 ( )
gpio-90 ( )
gpio-91 ( )
gpio-92 ( )
gpio-93 ( )
gpio-94 ( )
gpio-95 ( )
gpio-96 ( )
gpio-97 ( )
gpio-98 ( )
gpio-99 ( )
gpio-100 ( )
gpio-101 ( )
gpio-102 ( )
gpio-103 ( )
gpio-104 ( )
gpio-105 ( )
gpio-106 ( )
gpio-107 ( )
gpio-108 ( )
gpio-109 ( )
gpio-110 ( )
gpio-111 ( )
gpio-112 ( )
gpio-113 ( )
gpio-114 ( )
gpio-115 ( )
gpio-116 ( )
gpio-117 ( )
gpio-118 ( )
gpio-119 ( )
gpio-120 ( )
gpio-121 ( )
gpio-122 ( )
gpio-123 ( )
gpio-124 ( )
gpio-125 ( )
gpio-126 ( )
gpio-127 ( )
gpio-128 ( )
gpio-129 ( )
gpio-130 ( )
gpio-131 ( )
gpio-132 ( )
gpio-133 ( )
gpio-134 ( )
gpio-135 ( )
gpio-136 ( )
gpio-137 ( )
gpio-138 ( )
gpio-139 ( )
gpio-140 ( )
gpio-141 ( )
gpio-142 ( )
gpio-143 ( )
gpio-144 ( )
gpio-145 ( )
gpio-146 ( )
gpio-147 ( )
gpio-148 ( )
gpio-149 (GPIO01 )
gpio-150 ( )
gpio-151 ( |cam_reset_gpio ) out lo
gpio-152 ( |camera-control-outpu) out lo
gpio-153 ( )
gpio-154 ( )
gpio-155 ( )
gpio-156 ( )
gpio-157 ( )
gpio-158 ( )
gpio-159 ( )
gpio-160 ( )
gpio-161 ( )
gpio-162 ( )
gpio-163 ( )
gpio-164 ( )
gpio-165 ( )
gpio-166 ( )
gpio-167 ( )
gpio-168 (GPIO07 )
gpio-169 ( )
gpio-170 ( )
gpio-171 ( )
gpio-172 ( )
gpio-173 ( )
gpio-174 ( )
gpio-175 ( )
gpio-176 ( )
gpio-177 ( )
gpio-178 ( )
gpio-179 ( )
gpio-180 ( )
gpio-181 ( )
gpio-182 ( )
gpio-183 ( )
gpio-184 ( )
gpio-185 ( )
gpio-186 ( )
gpio-187 ( |? ) out hi
gpio-188 ( )
gpio-189 ( |Power ) in hi IRQ
gpio-190 ( |Forcerecovery ) in hi IRQ
gpio-191 ( )
gpio-192 ( )
gpio-193 ( )
gpio-194 (GPIO12 )
gpio-195 ( )
gpio-196 ( )
gpio-197 ( )
gpio-198 ( )
gpio-199 ( )
gpio-200 (GPIO11 )
gpio-201 ( |cd ) in lo IRQ
gpio-202 ( |pwm-fan-tach ) in hi IRQ
gpio-203 ( |vdd-3v3-sd ) out hi
gpio-204 ( )
gpio-205 ( )
gpio-206 ( )
gpio-207 ( )
gpio-208 ( )
gpio-209 ( )
gpio-210 ( )
gpio-211 ( )
gpio-212 ( )
gpio-213 ( )
gpio-214 ( )
gpio-215 ( )
gpio-216 (GPIO09 )
gpio-217 ( )
gpio-218 ( )
gpio-219 ( )
gpio-220 ( )
gpio-221 ( )
gpio-222 ( )
gpio-223 ( )
gpio-224 ( )
gpio-225 ( |hdmi2.0_hpd ) in hi IRQ
gpio-226 ( )
gpio-227 ( )
gpio-228 ( |extcon:extcon@1 ) in hi IRQ
gpio-229 ( )
gpio-230 ( )
gpio-231 ( )
gpio-232 (SPI1_CS1 )
gpio-233 ( )
gpio-234 ( )
gpio-235 ( )
gpio-236 ( )
gpio-237 ( )
gpio-238 ( )
gpio-239 ( )

gpiochip1: GPIOs 504-511, parent: platform/max77620-gpio, max77620-gpio, can sleep:
gpio-505 ( |spmic-default-output) out hi
gpio-507 ( |vdd-3v3-sys ) out hi
gpio-510 ( |enable ) out hi
gpio-511 ( |avdd-io-edp-1v05 ) out lo

Hi, @bigboy.061293,
After you configure your Jetson by /opt/nvidia/jetson-io/jetson-io.py and create tegra210-p3448-0000-p3449-0000-a02-mcp251x-can-controller.dtb you must copy this file from /boot and decompile it using command below in folder with this file (if you have different title in jetson-io.py output, you must use it. For example tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dtb):

dtc -I dtb -O dts tegra210-p3448-0000-p3449-0000-a02-mcp251x-can-controller.dtb -o can.dts

Then you can modify yours .dts file. After modification you must compile your .dts file:

dtc -@ -O dtb -o tegra210-p3448-0000-p3449-0000-a02-mcp251x-can-controller.dtb can.dts

Replace this file in /boot directory and reboot Jetson.

Thank you, I will try and get back later.
Cheer!

Hi guys, I am facing a problem, there are many packets errors. I am holding the sensor which continuously sending (streaming) data via CAN. The module worked fine in RPi. I followed previous instruction and everything seems fine until yesterday, I figure out there are a lot of missed messages. When I check the

ifconfig

It is:

can0: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 30621 bytes 244968 (244.9 KB)
RX errors 25536 dropped 0 overruns 0 frame 25536
TX packets 1 bytes 18446744073709551615 (1844.6 PB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Before that, I checked:

ip -details -statistics link show can0

And the can state was BUS-OFF (if CAN driver detects there are many errors packets, it will change to the state BUS-OFF), so I had to do:

sudo ip link set can0 up type can bitrate 500000 restart-ms 100

to restart it automatically. However there are so many packet missed.

I think the problem of being error is about invalid CRC. Everything was fine in my Raspberry Pi (hardware, resistor 120 Ohm… are the same).

Do you guys face the same situation?

Thanks.

I have a similar situation as @bigboy.061293 , I can see a lot of missing messages. I have 5 Arduino devices sending CAN messages, one Arduino listening for messages, and a Jetson Nano also listening. The Arduino receiver receives all messages without any problems, while the jetson nano misses messages (from time to time):

➜ ~ ifconfig can1
can1: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 20000 (UNSPEC)
RX packets 5916416 bytes 23665624 (23.6 MB)
RX errors 89482 dropped 0 overruns 0 frame 89482
TX packets 9 bytes 18446744073709551607 (1844.6 PB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

➜ ~ sudo ip -d -s link show can1
5: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 20000
link/can promiscuity 0
can state ERROR-ACTIVE restart-ms 10
bitrate 250000 sample-point 0.750
tq 200 prop-seg 7 phase-seg1 7 phase-seg2 5 sjw 1
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 5 5 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
23665948 5916497 89482 0 89482 0
TX: bytes packets errors dropped carrier collsns
18446744073709551607 9 0 0 0 0

I would really appreciate any help to resolve the problem of the missing messages because I already have software and hardware designs ready, but I’m unable to receive messages reliably. It would be disappointing to use can-usb converter at this point.

After a quick google search and a short test, this seems to have helped, no lost messages in 5 minutes: Too much delay between spi read operations

Try running:
sudo nvpmodel -m 0
sudo jetson_clocks

Hi, that helps a lot, thanks. However, I am facing interesting issue:

My sensor always send a notification message containing how many following messages (indicating how many objects of the sensor detected) should be received. By checking with candump, I discovered:

Before

sudo jetson_clocks

The notification messages announce N but I always receive less than N (notify 10, I receive just 4)

After

sudo jetson_clocks

The notification messages announce N, I receive enough N

It seems to be okay but RX errors still announces the same behavior, which is very close to the RX packets. In this case, I am not sure the mechanism of candump, if it also check the CRC, how ifconfig check the RX errors?

CRC check should be checked by the MCP2515 controller, not by the driver (as far as I know).

This might also happen if sample point configurations differ from your controller, try using different sample points:

ip link set can0 type can bitrate 250000 sample-point 0.75

If you don’t know what sample point is used by other controllers, try anything between 0.6 and 0.875, one of them should be good enough. I’m using 0.75, as per CAN bus protocol recommendations.

Also, make sure your clocks in DTB are properly set (can_clocks must be the same value as your MCP2515 oscillator frequency).

After nvp model change, I get an error rate of less than 0.05%, which is good enough for my application (before it was >1.5%).

Thanks for your advice. I have tried some sample-point from 0.1 to 1 and down and up the interface but nothing changes. I am sure that in DTB, the can_clocks is 8Mhz which is also the crystal for MCP2515.
The strange thing is, the sample configuration worked with Rapsberry Pi. I also did a examination on the bus with oscilloscope, the result is fine too.

I had a situation when I was not able to receive any data, the controller received a lot of errors and went to BUS-OFF state in couple of seconds (I was able to receive some nonsense messages on candump though). Then I tried setting double bitrate (500k instead of 250k) and then the controller started to receive messages, this was due to incorrect clock rates in DTB… If that seems similar, you can try setting double bitrate, just to rule out this possibility.

@shgarg Could you please provide the source to your .dtbo’s? dtc crashes when I try to decompile them:

dtc -I dtb -O dts -o a02-mcp251x.dts tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo
a02-mcp251x.dts: Warning (reg_format): "reg" property in /fragment@1/__overlay__/spi@0 has invalid length (4 bytes)         (#address-cells == 2, #size-cells == 1)
a02-mcp251x.dts: Warning (reg_format): "reg" property in /fragment@1/__overlay__/spi@1 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
a02-mcp251x.dts: Warning (reg_format): "reg" property in /fragment@3/__overlay__/spi@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /fragment@3 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@1 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@1/__overlay__/spi@0 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@1/__overlay__/spi@1 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@2 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@3 has a unit name, but no reg property
a02-mcp251x.dts: Warning (unit_address_vs_reg): Node /__local_fixups__/fragment@3/__overlay__/spi@0 has a unit name, but no reg property
a02-mcp251x.dts: Warning (pci_device_reg): Failed prerequisite 'reg_format'
a02-mcp251x.dts: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
a02-mcp251x.dts: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #address-cells value for /fragment@1/__overlay__/spi@0
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #size-cells value for /fragment@1/__overlay__/spi@0
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #address-cells value for /fragment@1/__overlay__/spi@1
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #size-cells value for /fragment@1/__overlay__/spi@1
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #address-cells value for /fragment@3/__overlay__/spi@0
a02-mcp251x.dts: Warning (avoid_default_addr_size): Relying on default #size-cells value for /fragment@3/__overlay__/spi@0
a02-mcp251x.dts: Warning (gpios_property): property 'gpio' size (135) is invalid, expected multiple of 4 in node /__fixups__
a02-mcp251x.dts: Warning (interrupts_property): Missing interrupt-parent for /fragment@1/__overlay__/spi@0
a02-mcp251x.dts: Warning (interrupts_property): Missing interrupt-parent for /fragment@1/__overlay__/spi@1
dtc: livetree.c:521: get_node_by_phandle: Assertion `(phandle != 0) && (phandle != -1)' failed.
Aborted (core dumped)

Was able to get the dtbo to decompile by building and using the latest version of dtc.

@shgarg you posted a mcp.zip with the updated driver. Can I get your updated driver source code? I am trying to accomplish the same thing but with an mcp2517fd and corresponding driver. I’d like to see what changes you made to the mcp2515 driver.

Ok i am really struggling with this. I need the CAN to control motors but i am not getting anywhere. Can you guys help me? You seem to have it working already. This Thread is already pretty long and i am kinda lost on the steps so i want to explain what i figured out and where i am in the process. Here is what i managed to understand from this thread and other guides:

The most important bit of information is this one: There are old ways and guides that don’t work anymore and are the first google results. Evade those.

You need to be able to flash the Jetson. For this i installed Ubuntu 18.04 with the SDK_Manager tools from nvidia. I have successfully flashed the Jetson this way.

In the SDK manager you can click on the folder icon next to ‘Jetson OS image’. A folder will open with all files used to flash the Jetson. (There is one called ‘Drivers for Jetson’ and one called ‘File System and OS’ but they both open the same folder).

Just for sanity here is the Folder and its structure. All relative paths i mention will be from this Folder:

dev@ubu:~/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/Linux_for_Tegra$ tree . -L 2
.
├── apply_binaries.sh
├── bootloader
│ ├── badpage.bin
│ ├── bmp.blob
│ ├── boot.img
│ ├── boot.img.sb
│ ├── BUP_generator.py
│ ├── cboot.bin
│ ├── chkbdinfo
│ ├── cvm.bin
│ ├── eks.img
│ ├── extlinux.conf
│ ├── flashcmd.txt
│ ├── flash_parameters.txt
│ ├── flash_win.bat
│ ├── flash.xml
│ ├── flash.xml.sb
│ ├── initrd
│ ├── l4t_bup_gen.func
│ ├── l4t_initrd.img
│ ├── LICENSE
│ ├── LICENSE.chkbdinfo
│ ├── LICENSE.mkbctpart
│ ├── LICENSE.mkbootimg
│ ├── LICENSE.mkgpt
│ ├── LICENSE.mksparse
│ ├── LICENSE.tos-mon-only.img.arm-trusted-firmware
│ ├── LICENSE.u-boot
│ ├── mkbctpart
│ ├── mkbootimg
│ ├── mkgpt
│ ├── mksparse
│ ├── nv_boot_control.conf
│ ├── nvidia-l4t-bootloader_32.4.3-20200625213809_arm64.deb
│ ├── NVIDIA_Trademark_License_Addendum_SW.pdf
│ ├── nvtboot.bin
│ ├── nvtboot_cpu.bin
│ ├── nvtboot_recovery.bin
│ ├── nvtboot_recovery_cpu.bin
│ ├── P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg
│ ├── qspi_bootblob_ver.txt
│ ├── rp4.blob
│ ├── sc7entry-firmware.bin
│ ├── system.img
│ ├── system.img.raw
│ ├── t210ref
│ ├── tegra210-p3448-0000-p3449-0000-b00.dtb
│ ├── tegra210-p3448-0000-p3449-0000-b00.dtb.sb
│ ├── tegrabct
│ ├── tegradevflash
│ ├── tegraflash_internal.py
│ ├── tegraflash_internal.pyc
│ ├── tegraflash.py
│ ├── tegrahost
│ ├── tegraparser
│ ├── tegrarcm
│ ├── tegrasign
│ ├── tos.img -> tos-mon-only.img
│ ├── tos-mon-only.img
│ └── warmboot.bin
├── build_l4t_bup.sh
├── flash.sh
├── jetson-nano-devkit.conf -> p3449-0000+p3448-0000-qspi-sd.conf
├── jetson-nano-devkit-emmc.conf -> p3449-0000+p3448-0002.conf
├── jetson-nano-emmc.conf -> p3449-0000+p3448-0002.conf
├── jetson-nano-qspi.conf -> p3449-0000+p3448-0000-qspi.conf
├── jetson-nano-qspi-sd.conf -> p3449-0000+p3448-0000-qspi-sd.conf
├── jetson-tx1.conf -> p2597-0000+p2180-1000.conf
├── jetson-tx1-devkit.conf -> p2597-0000+p2180-1000.conf
├── kernel
│ ├── dtb
│ ├── dtc
│ ├── Image
│ ├── kernel_headers.tbz2
│ ├── kernel_supplements.tbz2
│ ├── LICENSE
│ ├── LICENSE.dtc
│ ├── nv-enable-hard-coded-kernel-boot-display-mode.sh
│ ├── nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213809_arm64.deb
│ ├── nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213809_arm64.deb
│ └── nvidia-l4t-kernel-headers_4.9.140-tegra-32.4.3-20200625213809_arm64.deb
├── l4t_generate_soc_bup.sh
├── nvmassflashgen.sh
├── nv_tegra
│ ├── bsp_version
│ ├── config.tbz2
│ ├── graphics_demos.tbz2
│ ├── l4t_deb_packages
│ ├── l4t-usb-device-mode-filesystem.img
│ ├── LICENSE
│ ├── LICENSE.brcm_patchram_plus
│ ├── LICENSE.l4t-usb-device-mode-filesystem.img
│ ├── LICENSE.libnvargus
│ ├── LICENSE.libnvcam_imageencoder
│ ├── LICENSE.libnveventlib
│ ├── LICENSE.libnvscf
│ ├── LICENSE.libnvtracebuf
│ ├── LICENSE.libtegrav4l2
│ ├── LICENSE.minigbm
│ ├── LICENSE.wayland-ivi-extension
│ ├── LICENSE.weston
│ ├── LICENSE.weston-data
│ ├── nv-apply-debs.sh
│ ├── nvidia_drivers.tbz2
│ ├── nv_sample_apps
│ ├── nv_tools.tbz2
│ └── weston.tbz2
├── p2371.conf -> p2597-0000+p2180-1000.conf
├── p2597-0000+p2180-1000-24x7.conf
├── p2597-0000+p2180-1000.conf
├── p3448-0000.conf.common
├── p3448-0000-max-spi.conf
├── p3448-0000-max-spi-sd.conf
├── p3449-0000+p3448-0000-qspi.conf
├── p3449-0000+p3448-0000-qspi-sd.conf
├── p3449-0000+p3448-0002.conf
├── p3450.conf -> p3449-0000+p3448-0000-qspi.conf
├── README_Massflash.txt
├── rootfs
│ ├── bin
│ ├── boot
│ ├── dev
│ ├── etc
│ ├── home
│ ├── lib
│ ├── media
│ ├── mnt
│ ├── opt
│ ├── proc
│ ├── README.txt
│ ├── root
│ ├── run
│ ├── sbin
│ ├── snap
│ ├── srv
│ ├── sys
│ ├── tmp
│ ├── usr
│ └── var
├── source
│ └── nv_src_build.sh
├── sources
│ ├── hardware
│ ├── kernel
│ └── u-boot
├── source_sync.sh
├── tools
│ ├── bmp-splash
│ ├── jetson-disk-image-creator.sh
│ ├── jetson-gpio-common_2.0.8_arm64.deb
│ ├── nvptparser.py
│ ├── python3-jetson-gpio_2.0.8_arm64.deb
│ └── python-jetson-gpio_2.0.8_arm64.deb
└── TX1_boot-firmware-redundancy.txt

34 directories, 120 files

Now i think i need to make changes to these folders and then flash the Jetson with the changes so that i can have my MCP2515 running as a CAN socket.

The solution is we need to change the device tree. However i don’t know where i should do the changes.

I booted my Jetson Nano and used the following command to find out which dtb file is actually used by my jetson. This command has to be done on the jetson and not on your Ubuntu host machine:

developer@nano:~$ dmesg | grep .dts
[ 0.207848] DTS File Name: /dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[ 0.416319] DTS File Name: /dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[ 0.442907] tegra-pmc 7000e400.pmc: scratch reg offset dts data not present

from the output i figured i have to work with this file:

tegra210-p3448-0000-p3449-0000-b00.dts

its the only one mentioned by dmesg. I found the file here(on the ubuntu machine with the sdk installed):

dev@ubu:~/nvidia/nvidia_sdk/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/Linux_for_Tegra/kernel/dtb$ ls
tegra210-jetson-tx1-p2597-2180-a01-devkit-adafruit-sph0645lm4h.dtbo
tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
tegra210-jetson-tx1-p2597-2180-a01-devkit-fe-pi-audio-z-v2.dtbo
tegra210-jetson-tx1-p2597-2180-a01-devkit-hdr40.dtbo
tegra210-jetson-tx1-p2597-2180-a02-devkit-24x7.dtb
tegra210-p3448-0000-p3449-0000-a00.dtb
tegra210-p3448-0000-p3449-0000-a01-adafruit-sph0645lm4h.dtbo
tegra210-p3448-0000-p3449-0000-a01.dtb
tegra210-p3448-0000-p3449-0000-a01-fe-pi-audio-z-v2.dtbo
tegra210-p3448-0000-p3449-0000-a01-hdr40.dtbo
tegra210-p3448-0000-p3449-0000-a02-adafruit-sph0645lm4h.dtbo
tegra210-p3448-0000-p3449-0000-a02.dtb
tegra210-p3448-0000-p3449-0000-a02-fe-pi-audio-z-v2.dtbo
tegra210-p3448-0000-p3449-0000-a02-hdr40.dtbo
tegra210-p3448-0000-p3449-0000-b00.dtb
tegra210-p3448-0002-p3449-0000-a02.dtb
tegra210-p3448-0002-p3449-0000-b00.dtb

I cannot simply open the file with a text editor. I needed to download ‘dtc’. To do this, use this command:

$ sudo apt install device-tree-compiler

using the compiler i could open the read with:

$ dtc tegra210-p3448-0000-p3449-0000-b00.dtb

However it is rather long and i will not post its output here. I used the following command to get the output into a copy and pasteable format:

$ dtc tegra210-p3448-0000-p3449-0000-b00.dtb >> dtb_outfile

I have it uploaded on a pastebin site if anyone wants to see it:

https://pastebin.pl/view/6422fb08

I tried to use dtc to see the contents of ‘tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo’ but i get the same error as jake. He mentioned he could open it when he build the latest dtc from git resources but i am getting errors on that one too. So i can’t open the ‘tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo’ to see whats inside. Can anyone help me generate the file for the b00?

On the jetson i turned on SPI:

developer@nano:~$ sudo /opt/nvidia/jetson-io/jetson-io.py

there i saw that no SPI was set on the GPIOs so i choose the option to configure the 40pin header and selected the spi1. saved changes and rebooted. Now jetson-io gives me this output:

 |                        3.3V ( 1)  ( 2) 5V                          |
 |                        i2c2 ( 3)  ( 4) 5V                          |
 |                        i2c2 ( 5)  ( 6) GND                         |
 |                      unused ( 7)  ( 8) uartb                       |
 |                         GND ( 9)  (10) uartb                       |
 |                      unused (11)  (12) unused                      |
 |                      unused (13)  (14) GND                         |
 |                      unused (15)  (16) unused                      |
 |                        3.3V (17)  (18) unused                      |
 |                        spi1 (19)  (20) GND                         |
 |                        spi1 (21)  (22) unused                      |
 |                        spi1 (23)  (24) spi1                        |
 |                         GND (25)  (26) spi1                        |
 |                        i2c1 (27)  (28) i2c1                        |
 |                      unused (29)  (30) GND                         |
 |                      unused (31)  (32) unused                      |
 |                      unused (33)  (34) GND                         |
 |                      unused (35)  (36) unused                      |
 |                      unused (37)  (38) unused                      |
 |                         GND (39)  (40) unused                      |

I connected my mcp2515 according to the pinout from pinout.xyz . It powers up just fine. But i think i am missing steps because the MPC module does not show up at all in my dmesg:

developer@nano:~$ dmesg | grep can
[ 0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[ 0.964001] tegra-pwm 7000a000.pwm: PWM clk cannot sleep in ops

developer@nano:~$ dmesg | grep spi
[ 0.437858] iommu: Adding device 7000d400.spi to group 7
[ 0.438129] iommu: Adding device 7000d600.spi to group 8
[ 0.438424] iommu: Adding device 70410000.spi to group 9
[ 1.613235] tegra-qspi 70410000.spi: Prod settings list not found
[ 1.614364] qspi_mtd spi32766.0: MX25U3235F (4096 Kbytes)
[ 1.614375] qspi_mtd spi32766.0: mtd .name = spi32766.0, .size = 0x400000 (4MiB) .erasesize = 0x00001000 (4KiB) .numeraseregions = 0

Does this mean i need to first configure the DTB files?

Where do i go from here? I downloaded the newest ‘mcp.zip’ from this thread but its made for the a02 and not the b00. I used diff to compare the two and they are vastly different. How did you guys made the changes to fit your b00?

Am i right in the assumption that i can just change the files in kernel/dtb and then flash the jetson and it should work? Or do i have to rebuild the kernel somehow? I am really lost here. I wanted to use the CAN mcp modul to work with motors and have a deadline. I am desperate for help.

1 Like

Hi,
I am really sorry to check this thread in a long time being busy in other prior tasks.
You don’t need to make any changes in MCP Driver for now.

I will attach A02 and B00 files
These are the latest steps for A02 to follow after flashing J4.4 and device boots, you can follow the same for B00, just use B00 files (NOTE: mcp dtbo is same for A02 and B00 thus provided file with a02 name only)mcp-latest.zip (91.6 KB) :

  1. Connect first MCP251x chip to SPI1 on 40-pin, use CS0 pin, connect INT on Pin 31 (GPIO Z.0)
  2. Connect second MCP251x chip to SPI2 on 40-pin, use CS0 pin, connect INT on Pin 32 (GPIO V.0)
  3. Copy attached tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo under /boot/
  4. Copy attached tegra210-p3448-0000-p3449-0000-a02.dtb under /boot/dtb/
  5. Run /opt/nvidia/jetson-io/jetson-io.py
  6. Select Configure Jetson for compatible hardware
  7. Select MCP251x CAN Controller
  8. Save and reboot
  9. Make CAN0 and CAN1 inerface up on network:
    $ip link set can0 up type can bitrate 500000
    $ip link set can1 up type can bitrate 500000

I am not sure the data in dtbs will work for you as it is, as many replied saying communication issue which I could not get time to resolve . Also I do not have MCP setup with me. But I do have some pointers to mention depending on the further issues faced.
So, please try above steps and let me know how it goes.
Also, with Jetpack 4.5, you will find these dtbs already present on the device and with the steps to use MCP in CAN documentation.

Thanks & Regards,
Shubhi

Thank you for your reply!

Here is what i have done and the results:

I only have one MCP2515 module that i can connect to my motor. So i will only be able to do can0.

I connected the MCP2515 to my jetson. Here is what i connected with what:

mpc - jetson
int - pin31
sck - pin23
si - pin19
so - pin21
cs - pin24
gnd - gnd
vcc1 - pin5v
vcc - pin3.3v

i copied the provided files to my jetson via a usb stick. I tried to use dtc to look into the mcp251x.dtbo but dtc is crashing, can you upload the non compiled version via pastebin?

I copied the provided files into the /boot/ and /boot/dtb of my running jetson:

developer@nano:~/mcp-latest$ ls
tegra210-p3448-0000-p3449-0000-a02.dtb
tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo
tegra210-p3448-0000-p3449-0000-b00.dtb
developer@nano:~/mcp-latest$ sudo cp tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo /boot/
developer@nano:~/mcp-latest$ sudo cp tegra210-p3448-0000-p3449-0000-a02.dtb /boot/dtb/
developer@nano:~/mcp-latest$ sudo cp tegra210-p3448-0000-p3449-0000-b00.dtb /boot/dtb/

i ran the jetson io:

developer@nano:~/mcp-latest$ sudo /opt/nvidia/jetson-io/jetson-io.py

selected the mcp can controller.

Selected to ‘save and reboot’.

the jetson io gave me this output:

| Configuration saved to file
|/boot/tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dtb.
|
| Press any key to reboot the system now or Ctrl-C to abort

The jetson-io closed and the jetson rebooted. I waited a bit and tried joining again via an ssh session over usb:

dev@ubu:~/Downloads/mcp-latest$ ssh developer@192.168.55.1
ssh: connect to host 192.168.55.1 port 22: Network is unreachable

However even waiting 5 minutes didn’t change anything. Can’t ping either:

dev@ubu:~/Downloads/mcp-latest$ ping 192.168.55.1
PING 192.168.55.1 (192.168.55.1) 56(84) bytes of data.
From 62.155.246.18 icmp_seq=1 Destination Net Unreachable
From 62.155.246.18 icmp_seq=2 Destination Net Unreachable
From 62.155.246.18 icmp_seq=3 Destination Net Unreachable
^C
— 192.168.55.1 ping statistics —
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2000ms

Unplugged usb stick and the can module. Still the same.

Tried different usb cable. Nothing.

How can i check if my jetson is bricked?

I have it running with the barrel jack and the usb is connected to my host machine.

edit:
i put the jumper on FC REC and then the SDK could recognize it. Now i am reflashing it via the sdk manager.

OK i reflashed the Nano.

then i renamed

tegra210-p3448-0000-p3449-0000-a02-mcp251x.dtbo

to

tegra210-p3448-0000-p3449-0000-b00-mcp251x.dtbo

i had two a02 files and two b00 files. I only copied the b00 files this time.

I did the jetson io again. rebooted again.

Couldn’t ssh into the jetson anymore again.

Tried to plug into a hmdi screen to see what is even happening but the tv just tells me: ‘No Signal’


When does the JETPACK 4.5 is going to be released? is there a way to use a snapshot or something like that?


At the end i want to use the TX2 Jetson. I know it already comes with CAN bus pins but on my custom carrier board they are not available. So i am forced to use the MCP2515 with the TX2 also. Will i face the same issues with the TX2? Will the JETPACK4.5 also work with the TX2?

Hi,
Currently, it’s only for Nano.
I copied same dtbs to my Nano and it boots fine after choosing MCP on jetson-io tool.
I need to know where exactly it stucks on boot.
How do you get boot logs? via minicom UART communication

@shgarg Can I please get the source code changes to your driver?