Let me share the block diagram of my connection and the steps to verify MCP2515 on OrinNX+p3768 devkit.
Connections
Setup
Mapping
SPI:
spi1: spi@3210000
spi3: spi@3230000
Interrupt:
PIN29 → GPIO01 → PQ.05
PIN33 → GPIO13 → PH.00
Steps to verify
Step1. Add configuration in device tree for MCP2515
diff --git a/cvb/tegra234-p3768-0000-a0.dtsi b/cvb/tegra234-p3768-0000-a0.dtsi
--- a/cvb/tegra234-p3768-0000-a0.dtsi
+++ b/cvb/tegra234-p3768-0000-a0.dtsi
@@ -162,12 +162,24 @@
};
};
};
+
+ can_clock: can_clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ clock-accuracy = <100>;
+ };
+
spi@3210000{ /* SPI1 in 40 pin conn */
status = "okay";
spi@0 { /* chip select 0 */
- compatible = "tegra-spidev";
+ compatible = "microchip,mcp2515";
reg = <0x0>;
- spi-max-frequency = <50000000>;
+ spi-max-frequency = <2000000>;
+ interrupt-parent = <&tegra_main_gpio>;
+ interrupts = <TEGRA234_MAIN_GPIO(Q, 5) IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&can_clock>;
+ nvidia,enable-hw-based-cs;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
@@ -189,9 +201,13 @@
spi@3230000{ /* SPI3 in 40 pin conn */
status = "okay";
spi@0 { /* chip select 0 */
- compatible = "tegra-spidev";
+ compatible = "microchip,mcp2515";
reg = <0x0>;
- spi-max-frequency = <50000000>;
+ spi-max-frequency = <2000000>;
+ interrupt-parent = <&tegra_main_gpio>;
+ interrupts = <TEGRA234_MAIN_GPIO(H, 0) IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&can_clock>;
+ nvidia,enable-hw-based-cs;
controller-data {
Step2. Configure pinmux for CAN bus through Jetson-IO
2-1 Run Jetson-IO
$ sudo /opt/nvidia/jetson-io/jetson-io.py
2-2 Enable spi1 and spi3
Configure Jetson 40pin Header -> Configure header pins manually -> Enable spi1/spi3 as following -> Back -> Save pin changes -> Save and reboot to reconfigure pins -> Enter
[*] spi1 (19,21,23,24,26)
[*] spi3 (13,16,18,22,37)
Step3. Enable can0/can1 and test
$ sudo ip link set can0 up type can bitrate 500000
$ sudo ip link set can1 up type can bitrate 500000
$ candump -x any &
$ cangen can0