Jump to content

Radxa Zero 3W SPI fail


Go to solution Solved by Zokhoi,

Recommended Posts

Good afternoon everyone.

Please help me with my  problem. I have a Radha board  zero 3w and I use the Armbian distrib.  24.8.1  . Everything works fine, except that I can't activate  SPI. In the Armbian-config menu there is no hardware section (I tried different flash cards and Armbian versions, the problem persists), I also tried to edit the armbianEnv.txt  and add overlays there, but I also did not have success. Tell me what else I can try. Activation works on the native distribution radxa debian.

Link to comment
Share on other sites

Facing the same problem using kernel 6.1.75-vendor-rk35xx on trixie minimal.

 

Trying to use SPI3 M1 CS0 with the overlay:

/dts-v1/;
/plugin/;

/ {
  fragment@0 {
    target = <&spi3>;
    __overlay__ {
      status = "okay";
      #address-cells = <1>;
      #size-cells = <0>;
      pinctrl-names = "default", "high_speed";
      pinctrl-0 = <&spi3m1_cs0 &spi3m1_pins>;
      pinctrl-1 = <&spi3m1_cs0 &spi3m1_pins_hs>;
      cs-gpios = <&gpio4 22 1>;
      max-freq = <20000000>;

      spidev@0 {
        compatible = "rockchip,spidev";
        status = "okay";
        reg = <0>;
        spi-max-frequency = <20000000>;
      };
    };
  };
};

 

results in:

root@radxa-zero3:~# dmesg | grep spi
[   17.117658] rockchip-spi fe640000.spi: register misc device rkspi-dev3
[   17.117691] rockchip-spi fe640000.spi: probed, poll=0, rsd=0, cs-inactive=0, ready=0

 

 

The same overlay works for Radxa debian bullseye xfce image with kernel 5.10.160-26-rk356x:

 

root@radxa-zero3:~# dmesg | grep spi
[   18.371171] rockchip-spi fe640000.spi: probed, poll=0, rsd=0

 

Edited by Zokhoi
Link to comment
Share on other sites

Here is my image.

 

Well, dts files and dt overlay are files that specify the hardware on your board, and controls whether the kernel sees some of the pins as an interface like SPI. There are kernel drivers and userspace drivers, both of which requires the SPI to be activated in the device tree to work. The overlay I posted above activates spidev, which provides an SPI interface for the userspace to use, so something like Pimoroni ST7789 python library could communicate on the SPI on demand.

 

fbtft is a kernel module that works with small SPI displays, like the ST7796U (?) panel that I have. In the overlay for fbtft, I have to specify settings for the display, so the system can recognize and initialize the panel at boot time. I needed a custom driver, as there is no ST7796 drivers in mainline kernel, and fbtft is not accepting new drivers anymore. You should check if there is an fbtft driver in the kernel for your panel that you can use right out of the box.

 

Also the reason I put (?) after the ST7796U is that the store I bought the display from lists the panel as ST7796U, but when I try to use initialization sequence for ST7796 it didn't work. However I used the init sequence for ST7789 and it worked, but I still had to use ST7796's screen orientation settings, so I'm not sure which controller it actually is.

 

Pins that I connected:

  • MOSI: SPI3_MOSI_M1 / GPIO4_C3 / Pin 19

  • Clock: SPI3_CLK_M1 / GPIO4_C2 / Pin 23

  • Chip select: SPI3_CS0_M1 / GPIO4_C6 / Pin 24

  • Reset: GPIO3_B3 / Pin 29

  • Data/Command: GPIO3_B4 / Pin 31

  • Backlight: GPIO3_C3 / Pin 33

 

Overlay for ST7796 with fbtft:

/dts-v1/;
/plugin/;

/ {
  fragment@0 {
    target = <&spi3>;
    __overlay__ {
      status = "okay";
      #address-cells = <1>;
      #size-cells = <0>;
      pinctrl-names = "default", "high_speed";
      pinctrl-0 = <&spi3m1_cs0 &spi3m1_pins>;
      pinctrl-1 = <&spi3m1_cs0 &spi3m1_pins_hs>;
      cs-gpios = <&gpio4 22 1>;
      max-freq = <50000000>;

      st7796: panel@0 {
        compatible = "sitronix,st7796";
        reg = <0>;
        status = "okay";
        spi-max-frequency = <40000000>;
        dc-gpios = <&gpio3 12 0>;
        reset-gpios = <&gpio3 11 1>;
        led-gpios = <&gpio3 19 0>;
        rotate = <0>;
        bgr = <0>;
        width = <320>;
        height = <480>;
        fps = <60>;
        buswidth = <8>;
        // debug = <4000000>;
      };
    };
  };
};

 

 

Link to comment
Share on other sites

Posted (edited)

Thanks for your help!

I rewrote DTS using your links.

But I still have a problem how to correctly indicate the name of the pin SPI?


 

/dts-v1/;
/plugin/;

/ {
        compatible = "rockchip,rk3566";

        fragment@0 {
                target = <&spi3>;

                __overlay__ {
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&gpio4>;
                __overlay__ {
                        ads7846_pins: ads7846_pins {
                                rockchip,pins = <5 12 0 &pcfg_pull_up>;
                        };
                };
        };

        fragment@2 {
                target = <&spi3>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;

                        ads7846: ads7846@1 {
                                compatible = "ti,ads7846";
                                reg = <1>;
                                spi-max-frequency = <2000000>;
                                interrupts = <12 2>; // high-to-low edge triggered
                                interrupt-parent = <&gpio5>;
                                pendown-gpio = <&gpio4 12 0>;
                                ti,x-plate-ohms = /bits/ 16 <60>;
                                ti,pressure-max = /bits/ 16 <255>;
                        };
                };
        };
};

 

Edited by maximilian fletkar
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines