How to configure spi0 device-tree for mcp2515

Dear all:
1: With JetPack4.6_R32.6.1,Jetson Xavier NX with custom board, we connect mcp2515 to SOM,

1660729116777

2: change tegra_defconfig

  1. CONFIG_CAN_MCP251X=y
  2. CONFIG_CAN=y

3: configure device-tree in tegra194-p3668-common.dtsi

        can_clock: can_clock {
                 compatible = "fixed-clock";
                 #clock-cells = <0>;
                 clock-frequency = <8000000>;
                 clock-accuracy = <100>;
         };
 
         spi@3210000{ /* SPI1 in 40 pin conn */
                 status = "okay";
                 spi@0 { /* chip select 0 */
                         compatible = "microchip,mcp2515";
                         reg = <0x0>;
                         spi-max-frequency = <10000000>;
                         interrupt-parent = <&tegra_main_gpio>;
                         interrupts = <TEGRA194_MAIN_GPIO(Z, 6) 0x0>;
                         clocks = <&can_clock>;
                         controller-data {
                                 nvidia,enable-hw-based-cs;
                                 nvidia,rx-clk-tap-delay = <0x10>;
                                 nvidia,tx-clk-tap-delay = <0x0>;
                         };
                 };
                 spi@1 { /* chip select 1 */
                         compatible = "tegra-spidev";
                         reg = <0x1>;
                         spi-max-frequency = <50000000>;
                         controller-data {
                                 nvidia,enable-hw-based-cs;
                                 nvidia,rx-clk-tap-delay = <0x10>;
                                 nvidia,tx-clk-tap-delay = <0x0>;
                         };
                 };
         };

4: dmesg.log:

[    2.823403] mcp251x spi0.0: MCP251x didn't enter in conf mode after reset
[    2.823654] mcp251x spi0.0: Probe failed, err=16
[    2.823836] mcp251x: probe of spi0.0 failed with error -16
[    2.823942] mcp251x: probe of spi0.1 failed with error -2

5: 4 pin (spi0_sck, spi0_MISO, spio_MOSI. spi0_CS0 voltage is normal)

I guess, incorrect configuration of device-tree may is the key. So could you have some suggestions?
Thank you very much!

hello 848145724,

could you please also refer to Topic 177675 for the SPI’s pin configuration.

You can also run the jetson-io to configure the SPI PINs.

Thanks


Related registers have change, but problem is not resolved.

Have reference to below topic.

change 10000000 to 5000000, it works