Jetson Orin - SPI interface with MCP2518 SPI Module

Hello,
I’m using a 2-Channel Isolated CAN FD Expansion HAT for Raspberry Pi, Multi Protections on a Jetson Orin devKit. It’s using the 3.3V logic.
I was able to successfully test loopback mode by shorting MOSI and MISO pins (pin19 and pin21). I had enabled SPI using jetson-io.py, by configuring header pins manually and selecting spi1(19,21,23,24,26).
I’m also able to run the following simple spidev python script and can see there’s some data being sent through the CAN pins on the CAN FD Expansion Hat :

import spidev
import time
spi = spidev.SpiDev()
spi.open(0,0)
to_send = [0x01, 0x02, 0x03,0x01, 0x02, 0x03,0x01, 0x02, 0x03]
while True:
    spi.xfer(to_send)
    time.sleep(0.01)

But I’m not sure how to use this CAN FD Expansion Hat as a CAN interface. I think I need to modify something in the device-tree ?
I see posts like these, that were tried on the Jetson Nano using similar boards https://wiki.seeedstudio.com/2-Channel-CAN-BUS-FD-Shield-for-Raspberry-Pi/#using-can-bus-shiled-with-jetson-nano . But not sure how to go about this on the Jetson Orin .
If anyone can point me in the right direction. Thank you.

Hi misbahlabs,

What’s your Jetpack version in use?

It seems you’ve configured the SPI pins and verify loopback test for SPI.

For CAN, you need to configure the device tree and port the driver for your MCP2518FD module.
You could refer to the following thread for our verification to use MCP2515 SPI-to-CAN module.
Jetson Orin NX(JP5.1.2_R35.4.1) mcp2515 can1 can send data, can not recieve data - #10 by KevinFFF

Or please get the porting guide from your vendor for your module.

Hi @KevinFFF ,
Thank you for getting back on this.

I think this step is very helpful. I tried going over it. Unfortunately, I don’t have much experience with modifying device-tree. Do you happen to know which dtb file I need to edit? (I was able to use a dtc compiler to convert the dtb files to dts and edit). But not sure which one I need to make an edit to. And after I compile it back to a dtb file, where I do place it? Is it in the dtb folder? Sorry for my elementary questions

For AGX Orin devkit, you should modify the device tree in sources/hardware/nvidia/platform/t23x/concord/kernel-dts/cvb/tegra234-p3737-0000-a04.dtsi.

1 Like

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