Jetson Nano with two MCP2517FD

Hi,
we have developed our own carrier for a Nvidia Jetson Nano production module. All interfaces are working very well so far. The last thing to do now is to commission two MCP2517FD on SPI0 and SPI1 for two CAN-FD interfaces. I am having a hard time with this, what is the best way to proceed?
I have already read some topics here in the forum but nothing has really brought me forward.

For example: https://forums.developer.nvidia.com/t/mcp2517fd-setup-for-jetson-nano/84341

What is the best way to proceed:

1. Get drivers e.g. from linux-rpi/drivers/net/can/spi/mcp25xxfd at upstream-v5.0-rc3-mcp25xxfd-v6.11 · msperl/linux-rpi · GitHub
How do I get that translated and loaded into my image?
What I have already tried, is the driver from seeed to use->
2 Channel CAN BUS FD Shield for Raspberry Pi - Seeed Wiki


Then i also get an entry under lsmod:

nvidia@tegra-ubuntu:~$ lsmod
Module Size Used by

mcp25xxfd 70197 0
can_dev 13592 1 mcp25xxfd

nvidia@tegra-ubuntu:~$ dmesg | fgrep -i mcp
[ 0.772006] of_fixed_clk: probe of mcp2517fd_osc failed with error -17
[ 4.360042] mcp25xxfd: loading out-of-tree module taints kernel.
[ 4.441939] mcp25xxfd spi0.0 (unnamed net_device) (uninitialized): Failed to detect MCP2517FD (osc=0x00000000).
[ 4.603154] mcp25xxfd spi1.0 (unnamed net_device) (uninitialized): Failed to detect MCP2517FD (osc=0x00000000).


nvidia@tegra-ubuntu:~$ dmesg | fgrep -i can
[ 4.339042] CAN device driver interface


2. customize the tegra210-porg-p3448-common.dtsi file I made the following customizations for the device tree:


The tegra210-porg-pinmux-p3448-0002-b00.dtsi and gpio should be correct.

My wish would be to create a driver for mcp2517fd and install it on my system.
(I have seen that seeed creates mcp25xxfd.ko and spi-tegra114p.ko kernel modules,
but with insmod I did not get further)
And then make the correct settings in the device tree.

Thank you very much!

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

Hi kayccc,

thanks for your help, that I can use well :-) I haven’t really made any progress yet.

What I have done so far:

  1. I tried to create my own driver for a mcp2517fd from the following sources: linux/drivers/net/can/spi/mcp251xfd at master · torvalds/linux · GitHub But I did not succeed. I now use the driver from: 2 Channel CAN BUS FD Shield for Raspberry Pi - Seeed Wiki

  2. Now I tried to adjust the device tree:
    Also with the idea of ShaneCCC Moderator see here → MCP2517FD on SPI0.0 Jetson Nano

This is my current device tree:
output1.txt (319.6 KB)

but here it comes to an error see dmesg:

nvidia@tegra-ubuntu:~$ dmesg|grep spi
[ 0.461119] iommu: Adding device 7000d400.spi to group 6
[ 0.461423] iommu: Adding device 7000d600.spi to group 7
[ 1.343216] tegra210-pinctrl 700008d4.pinmux: pin DVFS_PWM PBB1 already requested by 700008d4.pinmux; cannot claim for 7000d400.spi
[ 1.343250] tegra210-pinctrl 700008d4.pinmux: pin-217 (7000d400.spi) status -22
[ 1.343288] spi-tegra114 7000d400.spi: Error applying setting, reverse things back
[ 1.343413] spi-tegra114: probe of 7000d400.spi failed with error -22
[ 1.346300] tegra210-pinctrl 700008d4.pinmux: pin DVFS_PWM PBB1 already requested by 700008d4.pinmux; cannot claim for 7000d600.spi
[ 1.346324] tegra210-pinctrl 700008d4.pinmux: pin-217 (7000d600.spi) status -22
[ 1.346358] spi-tegra114 7000d600.spi: Error applying setting, reverse things back
[ 1.346483] spi-tegra114: probe of 7000d600.spi failed with error -22
nvidia@tegra-ubuntu:~$ dmesg|grep mcp
[ 0.786026] of_fixed_clk: probe of mcp2517fd_osc failed with error -17
nvidia@tegra-ubuntu:~$

The problem comes from pinctrl-names = “default”;
pinctrl-0 = <0x3d>;

I take this out comes :

nvidia@tegra-ubuntu:~$ dmesg|grep spi
[ 0.461322] iommu: Adding device 7000d400.spi to group 6
[ 0.461623] iommu: Adding device 7000d600.spi to group 7
[ 4.398377] mcp25xxfd spi0.0 (unnamed net_device) (uninitialized): Failed to detect MCP2517FD (osc=0x00000000).
[ 4.498065] mcp25xxfd spi1.0 (unnamed net_device) (uninitialized): Failed to detect MCP2517FD (osc=0x00000000).
nvidia@tegra-ubuntu:~$

I do not yet understand this exactly?

Some more information:
I got the information to customize the device tree from the seeed overlays template:

2xMCP2518FD-spi0.dts (4.6 KB)

The two MCP2517FD are connected to the Jetson Nano at the following PINS:

FOR SPI1:
interrupts = <&gpio TEGRA_GPIO(V, 0) 0x1>;

		pin26 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x2>;
			nvidia,pins = "spi1_cs1_pc4";
			nvidia,function = "spi1";
		};

		pin24 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x2>;
			nvidia,pins = "spi1_cs0_pc3";
			nvidia,function = "spi1";
		};

		pin23 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi1_sck_pc2";
			nvidia,function = "spi1";
		};

		pin21 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi1_miso_pc1";
			nvidia,function = "spi1";
		};

		pin19 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi1_mosi_pc0";
			nvidia,function = "spi1";
		};

FOR SPI2:
interrupts = <&gpio TEGRA_GPIO(E, 6) 0x1>;

	pin18 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x2>;
			nvidia,pins = "spi2_cs0_pb7";
			nvidia,function = "spi2";
		};

		pin13 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi2_sck_pb6";
			nvidia,function = "spi2";
		};

		pin22 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi2_miso_pb5";
			nvidia,function = "spi2";
		};

		pin37 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x1>;
			nvidia,pins = "spi2_mosi_pb4";
			nvidia,function = "spi2";
		};

		pin16 {
			nvidia,enable-input = <0x1>;
			nvidia,tristate = <0x0>;
			nvidia,pull = <0x2>;
			nvidia,pins = "spi2_cs1_pdd0";
			nvidia,function = "spi2";
		};

Thank you and many greetings…

Hi kayccc,
have you already had time for an error analayse ?

Thank you…

Could you check if below topic ?
Mcp2515 on jetson nano - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums

Hi kayccc,

okay I found my (small) bug…
I forgot to adjust the gpio_default settings.
Otherwise everything was correct.
File: tegra210-porg-gpio-p3448-0002-b00-dtsi

Here are now my CAN Interfaces:

nvidia@tegra-ubuntu:~$ ifconfig -a
can0: flags=128 mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

can1: flags=128 mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Thank you!
And greetings :-)

Glad to know you found the cause and got CAN working succesfully, thanks for the update.

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