PiCAN 2 on Jetson Nano

Hi, I am new in delevoping with Nvidia devices.

I am trying to use a PiCAN 2 (PiCAN2 - Controller Area Network (CAN) Bus Interface for Raspberry Pi 2 ) with the jetson nano. When I used it with the Raspberry PI 4, it was just requiered the following configurations into the configuration file (/boot/config.txt):

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay

I was following this tutorial (CanBus on the Nano - #19 by Dan0811), but I have some questions.

I have converted de dtb file into a dts file in order to follow this solution. In the step 3, I decided to use the spi1 with this configuration:

can_clock: can_clock {
	compatible = “fixed-clock”;
	#clock-cells = <0>;
	clock-frequency = <16000000>;
	clock-accuracy = <100>;
	};
	spi@7000d600 { /* SPI 1 to 40 pin header */
	status = “okay”;
	spi@0 {
	compatible = “microchip,mcp2515”;
	reg = <0x0>;
	spi-max-frequency = <16000000>;
	nvidia,enable-hw-based-cs;
	nvidia,rx-clk-tap-delay = <0x7>;
	clocks = <&can_clock>;
	// interrupts = <&gpio TEGRA_GPIO(Z, 0) 0x19>; // GPIO pin chosen from 40 pin header
	controller-data {
	nvidia,cs-setup-clk-count = <0x1e>;
	nvidia,cs-hold-clk-count = <0x1e>;
	nvidia,rx-clk-tap-delay = <0x1f>;
	nvidia,tx-clk-tap-delay = <0x0>;
	};

		  };
	  };

In the PiCAN2 there is no pin for interruption like in the tutorial, so I assume that it is no required to do this step.

Then, in the step 4 I did some changes in the input and tristate from 0x1 to 0x0 like in the example below. But, I don’t know how to change the function property, and how to add the GPIO entry.

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

Also, according to the tutorial it is necessary to flash the devide, but since I am using the SD card method. I am not sure how to do it.

I would appreciate any help with my doubts.

From Nano, you are connecting through SPI right? If yes, it needs interrupt connection.
Please follow this doc: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_can.html#wwpID0ELHA

Check MCP on Jetson-Nano

1 Like

Thanks for your answer.

I have some questions about the steps in the link that you provided. I understand in this case two MCP251x chips are connected to the nano. So, jetson works with both of them as terminals of a CAN network, that is why both SPIs are used right?

The first step is about connecting the MCP device’s INT pin to the SPI1 INT pin (pin 31) on the nano. However, when I use the io tool for the MCP251x, it shows the SPI1 INT pin as unused. I think this pin should have some configuration too. You can see this in the following picture:

In my case, I need to configure the PiCAN2 board with the jetson nano, this is node A of the CAN network. The node B is a MCP2515 module connected to an arduino nano just for initial tests. I have followed the steps and, after using the io tool the jetson detected the can0 interface.

I used the follwing commands to set the link up:

sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up

Then I install the CAN utilities:

sudo apt-get install can-utils

I was using the test programs ( ./cansend and ./candump ) to verify if the network was working fine. But, when I connected both nodes of my CAN network the message sent from the jetson was not received on the arduino. I used Wireshark and I found out that just the initial message was read, although I sent several messages.

Additionaly, in my dtb I have the one you can see in the picture. Before of this, I had more dtb files in this folder, but I had to delete them, because otherwise the io tool did not execute. Although there are more dtb files in the boot folder.

Screenshot_5

I am not sure why this is happening, and I would appreciate any comment to solve this issue.