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>;
};
};
};
};