HOW TO USE MCP2515 MODULE ON JETSON NANO WITH DSBOARD-NX2?
WHAT YOU WILL LEARN?
2- CONNECTİNG MCP2515 TO GPIO EXTENSİON PORT
3- COMMUNİCATİON VİA CAN BUS
Hardware: DSBOX-NX2
Host OS: Ubuntu 18.04.5 LTS
CONFİGURİNG BSP FİLES
Open the NVIDIA SDK Manager. Select “JetPack 4.6.6” for Target Operating System and “Jetson Nano modules” for Target Hardware (The “Host Machine” components are not required). Then continue to Step 2.

Choose only “Jetson OS”, accept the terms & conditions and continue to Step 3.

The SDK Manager will ask the username’s password. Fill it and continue.

A few seconds later...

After the Jetson OS has created, the SDK Manager asks the Jetson module’s flashing style. Just skip it and exit from the SDK Manager.

Open the target HW image folder.
(${HOME}/nvidia/nvidia_sdk/JetPack_4.6.6_Linux_JETSON_NANO_TARGETS /)
Download MCP2515 BSP files from here & extract it.


Move Image file inside to ./Linux_for_Tegra/kernel directory and overwrite on the Image file that exist before.

Move tegra210-p3448-0002-p3449-0000-b00.dtb file inside to ./Linux_for_Tegra/kernel/dtb directory and overwrite on the file that exist before.

Return to the “Linux_for_Tegra” folder and open a Terminal.

Create the system image with this command below:
$ sudo ./flash.sh --no-flash jetson-nano-emmc mmcblk0p1

Then, type lsusb and check the device connected in Recovery mode.
• "0955:7f21 NVidia Corp

After this step, you can flash the module with the command below.
$ sudo ./flash.sh -r jetson-nano-emmc mmcblk0p1

CONNECTİNG MCP2515 TO GPIO EXTENSİON PORT

Note: The little arrow above the connector represents the first pin.
Note2: You must connect a 120 Ohm termination resistor between L and H pins.
Note3: You must connect L pin to CAN_L and H pin to CAN_H.

COMMUNİCATİON VİA CAN BUS
When device is opened, you can check MCP2515 driver with typing this command:
$ sudo dmesg | grep mcp

On next step, activate CAN drivers and activate CAN interface on MCP2515 with the following commands below:
$ sudo modprobe can
$ sudo modprobe can_raw
$ sudo modprobe mttcan
$ sudo ip link set can0 up type can bitrate 500000
$ sudo dmesg | grep can0

Now, you can use can-utils tools to communicate.
Use cangen to write random data:
$ cangen can0 -v
Use cansend to write data:
$ cansend can0 123#1122334455667788
Use candump to listen bus:
$ candump can0
Thank you for reading our blog post.