Hello everyone,
I’m currently trying to integrate an MCP2515 CAN controller with my Jetson Orin NX (devkit). I’ve been following some instructions to modify the Device Tree and set up the pinmux configuration, but I’m encountering several issues.
First of all, I connected MCP2515 with spi1 on 40p-header (19,21,23,24,26) and interrupt pin on PIN31( PQ.06). Next, I install mcp251x.ko module and check it with “lsmod”. I created the .dts by modifying the Seeed Studio
mcp2515.dts for the compatible with Orin NX and build it to .dtbo:
/dts-v1/;
/plugin/;
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/gpio/tegra234-gpio.h>
#include <dt-bindings/pinctrl/tegra234-p3767-0000-common.h>
/ {
overlay-name = "MCP251x CAN Controller";
jetson-header-name = "Jetson 40pin Header";
compatible = "nvidia,p3768-0000+p3767-0000", "nvidia,p3509-0000+p3767-0000", "nvidia,p3767-0000", "nvidia,tegra234", "nvidia,tegra23x";
fragment@0 {
target-path = "/";
__overlay__ {
clocks {
can_clock: can_clock {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <16000000>;
clock-accuracy = <100>;
};
};
};
};
fragment@1 {
target-path = "/spi@3210000/spi@0";
__overlay__ {
status = "disabled";
};
};
fragment@2 {
target-path = "/spi@3210000/spi@1";
__overlay__ {
status = "disabled";
};
};
fragment@3 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
spi@0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
compatible = "microchip,mcp2515";
reg = <0x0>;
spi-max-frequency = <10000000>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x7>;
clocks = <&can_clock>;
interrupt-parent = <&tegra_main_gpio>;
interrupts = <TEGRA234_MAIN_GPIO(Q, 6) IRQ_TYPE_LEVEL_LOW>;
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>;
};
};
spi@1 {
status = "disabled";
};
};
};
fragment@4 {
target = <&pinmux>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
spi1_pins: exp-header-pinmux {
pin19 {
nvidia,pins = "spi1_mosi_pz5";
nvidia,function = "spi1";
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
pin21 {
nvidia,pins = "spi1_miso_pz4";
nvidia,function = "spi1";
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
pin23 {
nvidia,pins = "spi1_sck_pz3";
nvidia,function = "spi1";
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
pin24 {
nvidia,pins = "spi1_cs0_pz6";
nvidia,function = "spi1";
nvidia,pull = <TEGRA_PIN_PULL_UP>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
};
};
};
};
After copy to /boot, with Jetson-IO I applied overlay to Device-Tree, reboot and get “Unable to boot via extlinux”. My main question: where is my mistakes? I have already lost hope that I will be able to configure CAN. Additional question is how to debug boot of kernel to understand what exactly is the conflict in the overlay, are there any ways? Many thanks in advance!!