- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Small TFT based on ILI9341 ST7789 - how to use
As there are so many people asking to get their CCC small displays up&running let me try to summarize here how I did that.
I'm using Bookworm OS. What is posted here has been tested under wayfire and labwc window manager only! The driver which is used is called 'mipi-dbi-spi'. It required a file with the initialization commands for the displays timing controller (TCON) in '/lib/firmware'.
I've posted several step-by-step guides on how to create such a file, so will not repeat that here!
The control signals can be configured via override parameters in config.txt. Below is example only, change as required.
Shown config.txt commands require the display to be connected to SPI0!
I'm using Bookworm OS. What is posted here has been tested under wayfire and labwc window manager only! The driver which is used is called 'mipi-dbi-spi'. It required a file with the initialization commands for the displays timing controller (TCON) in '/lib/firmware'.
I've posted several step-by-step guides on how to create such a file, so will not repeat that here!
The control signals can be configured via override parameters in config.txt. Below is example only, change as required.
Shown config.txt commands require the display to be connected to SPI0!
Last edited by aBUGSworstnightmare on Mon Dec 09, 2024 12:45 pm, edited 2 times in total.
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - Waveshare 2.4in LCD-wiki 2.8in
ILI9341 TCON
This has been tested with lcd-wiki SKU:MSP2807 and waveshare SKU:18366
Both displays have 320x240pixels resolution
http://www.lcdwiki.com/2.8inch_SPI_Modu ... KU:MSP2807
https://www.waveshare.com/2.4inch-lcd-module.htm
Download/unzip the file and copy it to required folder
add below to your config.txt
This has been tested with lcd-wiki SKU:MSP2807 and waveshare SKU:18366
Both displays have 320x240pixels resolution
http://www.lcdwiki.com/2.8inch_SPI_Modu ... KU:MSP2807
https://www.waveshare.com/2.4inch-lcd-module.htm
- wavesku18366.bin.zip
- Init command file
- (332 Bytes) Downloaded 281 times
Code: Select all
sudo cp wavesku18366.bin /lib/firmwareCode: Select all
# 320x240pixels Waveshare SKU18366 2.8in display
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=wavesku183660円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol
dtparam=width=320,height=240,width-mm=57,height-mm=43
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=23- 3.jpg
- lcd-wiki 2.8in SKU:MSP2807
- 3.jpg (203.5 KiB) Viewed 14498 times
Last edited by aBUGSworstnightmare on Mon Dec 09, 2024 12:46 pm, edited 3 times in total.
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use waveshare SKU:24832
ST7789V2 TCON
This has been tested with waveshare SKU:24382
The displays has a resolution of 240x280pixels. There are two init command files included, one in portrait, the other one in landscape orientation
https://www.waveshare.com/product/displ ... m?___SID=U
Download/unzip the file and copy it to required folder
add below to your config.txt
in case of landscape:
This has been tested with waveshare SKU:24382
The displays has a resolution of 240x280pixels. There are two init command files included, one in portrait, the other one in landscape orientation
https://www.waveshare.com/product/displ ... m?___SID=U
- wavesku24382.zip
- Init command file - 'x_r90' is for portrait orientation
- (630 Bytes) Downloaded 126 times
Code: Select all
sudo cp wavesku24382.bin /lib/firmwareCode: Select all
# 240x280pixels Waveshare SKU243820 1.68in display
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=wavesku243820円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol,y-offset=20
dtparam=width=240,height=280,width-mm=31,height-mm=39
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=23Code: Select all
# 280x240pixels Waveshare SKU243820 1.68in display - rotated!
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=wavesku24382_r900円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol,x-offset=20
dtparam=width=280,height=240,width-mm=39,height-mm=31
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=23- 4.jpg
- when using 'wavesku24382.bin'
- 4.jpg (185.77 KiB) Viewed 14494 times
- nice.jpg
- when using 'wavesku24382_r90.bin'. Make sure to change config.txt accordingly!
- nice.jpg (114.81 KiB) Viewed 14494 times
Last edited by aBUGSworstnightmare on Mon Dec 09, 2024 12:46 pm, edited 1 time in total.
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use lcd-wiki 4.0inch
ST7796S TCON
This has been tested with lcd-wiki 4.0inch SPI Module ST7796
The display has a resolution of 480x320pixels
http://www.lcdwiki.com/4.0inch_SPI_Module_ST7796
Download/unzip the file and copy it to required folder
add below to your config.txt
This has been tested with lcd-wiki 4.0inch SPI Module ST7796
The display has a resolution of 480x320pixels
http://www.lcdwiki.com/4.0inch_SPI_Module_ST7796
- 4in.bin.zip
- Init command file
- (311 Bytes) Downloaded 227 times
Code: Select all
sudo cp 4in.bin /lib/firmwareCode: Select all
# 480x320pixels 4in SPI display
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=4in0円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol
dtparam=width=480,height=320,width-mm=84,height-mm=56
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=23- IMG_20231207_090321.jpg
- IMG_20231207_090321.jpg (151.96 KiB) Viewed 14488 times
Last edited by aBUGSworstnightmare on Mon Dec 09, 2024 12:47 pm, edited 2 times in total.
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use waveshare SKU:19650
ST7789 TCON
This has been tested with waveshare SKU:19650 but should be applicable to other waveshare products using the same display (i.e. SKU:14972, SKU:15867, SKU:25586)
The displays has 240x240pixels resolution
https://www.waveshare.com/pico-lcd-1.3.htm
Download/unzip the file and copy it to required folder
add below to your config.txt
This has been tested with waveshare SKU:19650 but should be applicable to other waveshare products using the same display (i.e. SKU:14972, SKU:15867, SKU:25586)
The displays has 240x240pixels resolution
https://www.waveshare.com/pico-lcd-1.3.htm
- wavesku19650.bin.zip
- (315 Bytes) Downloaded 179 times
Code: Select all
sudo cp wavesku19650.bin /lib/firmwareCode: Select all
# waveshare 1.3in - 240x240pixel - SKU19650
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=wavesku196500円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol
dtparam=width=240,height=240,width-mm=23,height-mm=23
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=23- IMG_20230911_141652.jpg
- IMG_20230911_141652.jpg (114.43 KiB) Viewed 14486 times
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
a multi display setup using some of the screens shown above. I've used an I2C GPIO expander for having enough I/O for RESET and PWM backlight.
- 4xspi.jpg
- quad-head SPI desktop
- 4xspi.jpg (246.02 KiB) Viewed 14367 times
- jumperhell.jpg
- GPIO expander in use, controls RESET signals and PWM control of all backlights.
- jumperhell.jpg (244.78 KiB) Viewed 14367 times
Code: Select all
/*
* mipi-dbi-4display-overlay.dts
* (c) by aBUGSworstnightmare
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
compatible = "brcm,bcm2712";
fragment@0 {
target = <&spi0_cs_pins>;
frag0: __overlay__ {
brcm,pins = <8>;
};
};
fragment@1 {
target = <&spi0>;
frag1: __overlay__ {
cs-gpios = <&gpio 8 1>;
status = "okay";
};
};
fragment@2 {
target = <&spidev0>;
__overlay__ {
status = "disabled";
};
};
fragment@3 {
target = <&spidev1>;
__overlay__ {
status = "disabled";
};
};
fragment@4 {
target = <&spi0_pins>;
__dormant__ {
brcm,pins = <10 11>;
};
};
fragment@10 {
target = <&gpio>;
__overlay__ {
control_lcd0: control_lcd0 {
brcm,pins = <24 25>;
brcm,function = <1 1>; /* out out*/
};
};
};
fragment@12 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
panel_lcd0: panel@0 {
compatible = "4in", "panel-mipi-dbi-spi";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&control_lcd0>;
backlight = <&backlight_0>;
spi-max-frequency = <48000000>;
write-only;
spi-cpha;
spi-cpol;
reset-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
dc-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>;
width-mm = <84>;
height-mm = <56>;
timing0: panel-timing {
hactive = <480>;
vactive = <320>;
hback-porch = <0>;
vback-porch = <0>;
clock-frequency = <0>;
hfront-porch = <0>;
hsync-len = <0>;
vfront-porch = <0>;
vsync-len = <0>;
};
};
};
};
fragment@30 {
target = <&gpio>;
__overlay__ {
control_lcd3: control_lcd3 {
brcm,pins = <27>;
brcm,function = <1>; /* out out*/
};
};
};
fragment@31 {
target = <&spi3>;
frag31: __overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&gpio 4 1>;
status = "okay";
spidev3_0: spidev@0 {
compatible = "spidev";
reg = <0>; /* CE0 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <125000000>;
status = "okay";
};
};
};
fragment@32 {
target = <&spi3>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
panel_lcd3: panel@0 {
compatible = "wavesku24382", "panel-mipi-dbi-spi";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&control_lcd3>;
backlight = <&backlight_3>;
spi-max-frequency = <38000000>;
write-only;
spi-cpha;
spi-cpol;
reset-gpios = <&pca 2 GPIO_ACTIVE_HIGH>;
dc-gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
width-mm = <31>;
height-mm = <39>;
timing_3: panel-timing {
hactive = <240>;
vactive = <280>;
hback-porch = <0>;
vback-porch = <20>;
clock-frequency = <0>;
hfront-porch = <0>;
hsync-len = <0>;
vfront-porch = <0>;
vsync-len = <0>;
};
};
};
};
fragment@50{
target = <&gpio>;
__overlay__ {
control_lcd5: control_lcd5 {
brcm,pins = <22>;
brcm,function = <1>; /* out*/
};
};
};
fragment@59{
target = <&gpio>;
__overlay__ {
control_lcd2: control_lcd2 {
brcm,pins = <20>;
brcm,function = <1>; /* out*/
};
};
};
fragment@51 {
target = <&spi5>;
frag51: __overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&gpio 12 1>, <&gpio 26 1>;
status = "okay";
spidev5_0: spidev@0 {
compatible = "spidev";
reg = <0>; /* CE0 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <125000000>;
status = "okay";
};
spidev5_1: spidev@1 {
compatible = "spidev";
reg = <1>; /* CE1 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <125000000>;
status = "okay";
};
};
};
fragment@52 {
target = <&spi5>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
panel_lcd5: panel@0{
compatible = "wavesku18366", "panel-mipi-dbi-spi";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&control_lcd5>;
backlight = <&backlight_5>;
spi-max-frequency = <38000000>;
write-only;
spi-cpha;
spi-cpol;
reset-gpios = <&pca 3 GPIO_ACTIVE_HIGH>;
dc-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
width-mm = <57>;
height-mm = <43>;
timing_5: panel-timing {
hactive = <320>;
vactive = <240>;
hback-porch = <0>;
vback-porch = <0>;
clock-frequency = <0>;
hfront-porch = <0>;
hsync-len = <0>;
vfront-porch = <0>;
vsync-len = <0>;
};
};
panel_lcd2: panel@1{
compatible = "wavesku18366", "panel-mipi-dbi-spi";
reg = <1>;
pinctrl-names = "default";
pinctrl-0 = <&control_lcd2>;
backlight = <&backlight_2>;
spi-max-frequency = <38000000>;
write-only;
spi-cpha;
spi-cpol;
reset-gpios = <&pca 1 GPIO_ACTIVE_HIGH>;
dc-gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
width-mm = <57>;
height-mm = <43>;
timing_2: panel-timing {
hactive = <320>;
vactive = <240>;
hback-porch = <0>;
vback-porch = <0>;
clock-frequency = <0>;
hfront-porch = <0>;
hsync-len = <0>;
vfront-porch = <0>;
vsync-len = <0>;
};
};
};
};
fragment@100 {
target = <&i2c_arm>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <400000>;
status = "okay";
pca: pca@40 {
compatible = "nxp,pca9685-pwm";
#pwm-cells = <2>;
gpio-controller;
#gpio-cells = <2>;
reg = <0x40>;
status = "okay";
gpio-line-names = "RESET_0",
"RESET_2",
"RESET_3",
"RESET_5",
"STATE_0",
"STATE_1",
"STATE_2",
"STATE_3",
"PWM_BL0",
"EN_BL0",
"PWM_BL2",
"EN_BL2",
"PWM_BL3",
"EN_BL3",
"PWM_BL5",
"EN_BL5";
};
};
};
fragment@101 {
target-path = "/";
__overlay__ {
controls: controls@0 {
compatible = "gpio-leds";
status = "okay";
state0: state0@1 {
label = "state0";
linux,default-trigger = "none";
gpios = <&pca 4 0>;
};
state1: state1@1 {
label = "state1";
linux,default-trigger = "none";
gpios = <&pca 5 0>;
};
state2: state2@1 {
label = "state2";
linux,default-trigger = "none";
gpios = <&pca 6 0>;
};
state3: state3@1 {
label = "state3";
linux,default-trigger = "none";
gpios = <&pca 7 0>;
};
};
backlight_0: backlight_0@1 {
reg = <0>;
compatible = "pwm-backlight";
brightness-levels = <0 4095>;
num-interpolated-steps = <4096>;
default-brightness-level = <4096>;
pwms = <&pca 8 5000000>;
// enable signal controlled by PCA9586-#9
enable-gpios = <&pca 9 0>;
status = "okay";
};
backlight_2: backlight_2@1 {
reg = <1>;
compatible = "pwm-backlight";
brightness-levels = <0 4095>;
num-interpolated-steps = <4096>;
default-brightness-level = <4096>;
pwms = <&pca 10 5000000>;
// enable signal controlled by PCA9586-#11
enable-gpios = <&pca 11 0>;
status = "okay";
};
backlight_3: backlight_3@1 {
reg = <2>;
compatible = "pwm-backlight";
brightness-levels = <0 4095>;
num-interpolated-steps = <4096>;
default-brightness-level = <4096>;
pwms = <&pca 12 5000000>;
// enable signal controlled by PCA9586-#13
enable-gpios = <&pca 13 0>;
status = "okay";
};
backlight_5: backlight_5@1 {
reg = <3>;
compatible = "pwm-backlight";
brightness-levels = <0 4095>;
num-interpolated-steps = <4096>;
default-brightness-level = <4096>;
pwms = <&pca 14 5000000>;
// enable signal controlled by PCA9586-#15
enable-gpios = <&pca 15 0>;
status = "okay";
};
};
};
__overrides__ {
cs0_pin_3 = <&frag31>,"cs-gpios:4";
cs0_spidev_3 = <&spidev3_0>,"status";
cs0_pin_5 = <&frag51>,"cs-gpios:4";
cs0_spidev_5 = <&spidev5_0>,"status";
cs1_pin_5 = <&frag51>,"cs-gpios:4";
cs1_spidev_5 = <&spidev5_1>,"status";
state0_low = <&state0>,"default-state=off";
state0_high = <&state0>,"default-state=on";
state1_low = <&state1>,"default-state=off";
state1_high = <&state1>,"default-state=on";
state2_low = <&state2>,"default-state=off";
state2_high = <&state2>,"default-state=on";
state3_low = <&state3>,"default-state=off";
state3_high = <&state3>,"default-state=on";
};
};Code: Select all
dtoverlay=mipi-dbi-4display
dtparam=cs0_pin_5=12,cs0_spidev_5=off
dtparam=cs0_pin_3=4,cs0_spidev_3=off
dtparam=cs0_spidev_5=off
dtparam=cs0_spidev_3=off
dtparam=state0_high,state3_high- howaboutthisnickname
- Posts: 1
- Joined: Sun Dec 15, 2024 9:13 am
Re: Small TFT based on ILI9341 ST7789 - how to use
Thanks @aBUGSworstnightmare for awesome work. I have successfully run 3.2 display.
I have couple questions:
- How does the thing know it's on spi-0? How does it know, the CS pin is spi-cs-0 and not ...-1? Where is it configured?
- My mouse lags on fullHD display and works ok on spi if both are connected, how to fix this?
- How to get more control over SPI screens? I want a standalone device which has OS-specific UI only through HDMI for debug-purpuses, SPI screens should each display a particular application after it loads and display nothing if it crushes. So the end-user wouldn't see anything about OS. Is mipi-dbi-spi appropriate method for such task or do I have to control the displays manually "arduino-style"?
PS: The post about creating .bin file the author was referring to is here: viewtopic.php?t=358240&hilit=Ili9341#p2165638
I have couple questions:
- How does the thing know it's on spi-0? How does it know, the CS pin is spi-cs-0 and not ...-1? Where is it configured?
- My mouse lags on fullHD display and works ok on spi if both are connected, how to fix this?
- How to get more control over SPI screens? I want a standalone device which has OS-specific UI only through HDMI for debug-purpuses, SPI screens should each display a particular application after it loads and display nothing if it crushes. So the end-user wouldn't see anything about OS. Is mipi-dbi-spi appropriate method for such task or do I have to control the displays manually "arduino-style"?
PS: The post about creating .bin file the author was referring to is here: viewtopic.php?t=358240&hilit=Ili9341#p2165638
Last edited by howaboutthisnickname on Sun Dec 15, 2024 11:21 am, edited 1 time in total.
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
from the overlay https://github.com/raspberrypi/linux/bl ... verlay.dtshowaboutthisnickname wrote: ↑Sun Dec 15, 2024 9:28 amThanks @aBUGSworstnightmare for awesome work. I have successfully run 3.2 display.
I have couple questions:
- How does the thing know it's on spi-0? How does it know, the CS pin is spi-cs-0 and not ...-1? Where is it configured?
..
It defaults to SPI0-CS0 but one has overrides to make use of other SPI interfaces and respective chip selects. I prefer to use custom overlay in such cases though.
which OS and which windows manager? Not seen this on any device yet (but I need to say I'm using Pi4/Pi5 only).howaboutthisnickname wrote: ↑Sun Dec 15, 2024 9:28 am..
- My mouse lags on. fullHD display and works ok on spi if both are connected, how to fix this?
..
https://youtu.be/IXw_4sJY518 shows a SPI screen playing video. No issues with the 'big' 2540x1440pixel screen on HDMI
mipi-dbi-spi is a drm kernel driver. It can display anything that you write into the framebuffer of the respective display.howaboutthisnickname wrote: ↑Sun Dec 15, 2024 9:28 am..
- How to get more control over SPI screens? I want a standalone device which has OS-specific UI only through HDMI for debug-purpuses, SPI screens should each display a particular application after it loads and display nothing if it crushes. So the end-user wouldn't see anything about OS. Is mipi-dbi-spi appropriate method for such task or do I have to control the displays manually "arduino-style"?
..
Connect multiple SPI displays, boit to CLI and run below commands (shown with a single display only)
Code: Select all
pi@book13th:~ $ kmsprint
Connector 0 (32) HDMI-A-1 (disconnected)
Encoder 0 (31) TMDS
Connector 1 (41) HDMI-A-2 (disconnected)
Encoder 1 (40) TMDS
pi@book13th:~ $ cd /dev/dri
pi@book13th:/dev/dri $ dir
by-path card0 card1 card2 renderD128
pi@book13th:/dev/dri $ kmsprint --device=/dev/dri/card2
Connector 0 (31) SPI-1 (connected)
Encoder 0 (35) NONE
Crtc 0 (34) [email protected] 9.216 480/0/0/0/? 320/0/0/0/? 60 (60.00) P|D
Plane 0 (32) fb-id: 36 (crtcs: 0) 0,0 480x320 -> 0,0 480x320 (RG16 XR24)
FB 36 480x320 XR24
pi@book13th:/dev/dri $ kmstest --device=/dev/dri/card2
Connector 0/@31: SPI-1
Crtc 0/@34: [email protected] 9.216 480/0/0/0/? 320/0/0/0/? 60 (60.00) P|D
Plane 0/@32: 0,0-480x320
Fb 38 480x320-XR24
press enter to exit
Image
- tomek_yeet
- Posts: 9
- Joined: Fri Apr 14, 2023 6:51 pm
Re: Small TFT based on ILI9341 ST7789 - how to use lcd-wiki 4.0inch
Hi, I have exactly that display (MSP4021) and it doesn't work for me. I followed your instructions and connected display to spi0 according to config.txt. All I get is white screen. I use RPi5 with latest 64-bit Bookworm.aBUGSworstnightmare wrote: ↑Mon Dec 09, 2024 6:36 amST7796S TCON
This has been tested with lcd-wiki 4.0inch SPI Module ST7796
The display has a resolution of 480x320pixels
http://www.lcdwiki.com/4.0inch_SPI_Module_ST7796
- Attachments
-
- share_4830775122068864895-min.png
- share_4830775122068864895-min.png (192.33 KiB) Viewed 14040 times
-
- share_4921120162102638856-min.png
- share_4921120162102638856-min.png (122.46 KiB) Viewed 14040 times
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
Start without connecting the touch controller.
Have you checked your GPIO connection is correct? I.e. If you swapped DC and Reset you will see this (that's the 'normally white' which TN display show when they have no valid data).
Show a picture of your connections on the RPI. Don't connect GPIO9 as we will never read from the display.
Have you checked your GPIO connection is correct? I.e. If you swapped DC and Reset you will see this (that's the 'normally white' which TN display show when they have no valid data).
Show a picture of your connections on the RPI. Don't connect GPIO9 as we will never read from the display.
- tomek_yeet
- Posts: 9
- Joined: Fri Apr 14, 2023 6:51 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
I tried without touch and GPIO9, but I still have white screen, I also checked wiring few times. Reset is on GPIO25 and DC is on 24. This is my current wiring.
- 2025年01月11日_19-26.png
- 2025年01月11日_19-26.png (152.64 KiB) Viewed 14002 times
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
Imagetomek_yeet wrote: ↑Sat Jan 11, 2025 6:36 pmI tried without touch and GPIO9, but I still have white screen, I also checked wiring few times. Reset is on GPIO25 and DC is on 24. This is my current wiring. 2025年01月11日_19-26.png
that wiring looks odd. Refer to the pinout shown in the picture
CS-> GPIO8
MOSI -> GPIO10
SCK -> GPIO11
BL -> GPIO23
RESET -> GPIO24
DC -> GPIO25
3.3V to pin17 and GND to pin20
That's in line with the config.txt example shown above
- tomek_yeet
- Posts: 9
- Joined: Fri Apr 14, 2023 6:51 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
I swapped miso with mosi..... now it works, thanks! What about touch? How can I make it work?
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
touch controller is an ADS7846 (or derivative). You will have to load the related overlay. Connects to the same SPI, CS is GPIO7. Sorry, have no idea on the parameters as I've never user the touch of that display.tomek_yeet wrote: ↑Sat Jan 11, 2025 11:16 pmI swapped miso with mosi..... now it works, thanks! What about touch? How can I make it work?
Code: Select all
Name: ads7846
Info: ADS7846 Touch controller
Load: dtoverlay=ads7846,<param>=<val>
Params: cs SPI bus Chip Select (default 1)
speed SPI bus speed (default 2MHz, max 3.25MHz)
penirq GPIO used for PENIRQ. REQUIRED
penirq_pull Set GPIO pull (default 0=none, 2=pullup)
swapxy Swap x and y axis
xmin Minimum value on the X axis (default 0)
ymin Minimum value on the Y axis (default 0)
xmax Maximum value on the X axis (default 4095)
ymax Maximum value on the Y axis (default 4095)
pmin Minimum reported pressure value (default 0)
pmax Maximum reported pressure value (default 65535)
xohms Touchpanel sensitivity (X-plate resistance)
(default 400)
penirq is required and usually xohms (60-100) has to be set as well.
Apart from that, pmax (255) and swapxy are also common.
The rest of the calibration can be done with xinput-calibrator.
See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian
Device Tree binding document:
www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt
Re: Small TFT based on ILI9341 ST7789 - how to use
Hi all! Tell me, did anyone manage to run this display on a raspberry? I really don't understand how to do this through commands. Can someone help with advice?
http://www.lcdwiki.com/3.5inch_IPS_SPI_ ... ule_ST7796
http://www.lcdwiki.com/3.5inch_IPS_SPI_ ... ule_ST7796
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
Sorry, but which info do you need in addition?qlDeSTlp wrote: ↑Tue Jan 21, 2025 2:51 pmHi all! Tell me, did anyone manage to run this display on a raspberry? I really don't understand how to do this through commands. Can someone help with advice?
http://www.lcdwiki.com/3.5inch_IPS_SPI_ ... ule_ST7796
http://www.lcdwiki.com/res/MSP3525_MSP3 ... 6_Init.txt has the initialization command of your display (in 'void LCD_Init(void)')
viewtopic.php?t=358240&hilit=Ili9341#p2165638 has a step-by-step instruction how to use that init command sequence for creating a binary suitable to be used with mini-dbi-spi driver.
Then you will have to add/adjust the overlay settings and you should be done.
Re: Small TFT based on ILI9341 ST7789 - how to use
I have difficulties even with commands.. Connecting wires is easy! Setting up anything in ubuntu is a nightmare(
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
never tested this on ubuntu! Sorry, not able to help any further! Will also not write the bin file for you as that will have to be tested (sometimes the sequence of the commands matter) and I don't have the display for doing so.
Re: Small TFT based on ILI9341 ST7789 - how to use
Everything is fine! Thank you very much!
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
Bought a waveshare 1.14in screen for a project with a RP2040 Pico and thought it would be fun to bring that up on a Pi as well.
ST7796VW TCON
This has been tested with waveshare SKU19340 - 1.14inch LCD Display Module for Raspberry Pi Pico, 65K Colors.
The display has a resolution of ×ばつ135pixels -> pretty useless for a desktop environment but might be an option for some fun project.
https://www.waveshare.com/pico-lcd-1.14.htm
The display is used in landscape mode! As the backlight comes on as soon as power is applied I did not bother with adding a GPIO for BL control
ST7796VW TCON
This has been tested with waveshare SKU19340 - 1.14inch LCD Display Module for Raspberry Pi Pico, 65K Colors.
The display has a resolution of ×ばつ135pixels -> pretty useless for a desktop environment but might be an option for some fun project.
https://www.waveshare.com/pico-lcd-1.14.htm
The display is used in landscape mode! As the backlight comes on as soon as power is applied I did not bother with adding a GPIO for BL control
- wavesku19340.bin.zip
- (306 Bytes) Downloaded 86 times
- SKU19340_1.jpg
- SKU19340_1.jpg (366.66 KiB) Viewed 13586 times
- SKU19340_2.jpg
- SKU19340_2.jpg (315.31 KiB) Viewed 13586 times
Code: Select all
# waveshare 1.14in 240x135pixels - SKU 19340
dtoverlay=mipi-dbi-spi,speed=48000000
dtparam=compatible=wavesku193400円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol
dtparam=x-offset=40,y-offset=53
dtparam=width=240,height=135,width-mm=52,height-mm=25
dtparam=reset-gpio=24,dc-gpio=25- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
There are quite a few 240x240pixel displays around which can be used with the init command sequence posted here download/file.php?id=70754
One of these is the Joy-IT 1.3in SBC-LCD01 - https://joy-it.net/en/products/SBC-LCD01
That one is a little special though as it has no CS-signal! CS on this model is permanently enabled, hence it requires a special overlay to make use of it.
Below example considers there is no CS-signal, and as the module is write only the MISO signal also got omitted -> GPIO9 is available to be used for other purposes (backlight control in below example).
the overlay file
config.txt entry for enabling the module - as said, GPIO9 is used for backlight
One of these is the Joy-IT 1.3in SBC-LCD01 - https://joy-it.net/en/products/SBC-LCD01
That one is a little special though as it has no CS-signal! CS on this model is permanently enabled, hence it requires a special overlay to make use of it.
Below example considers there is no CS-signal, and as the module is write only the MISO signal also got omitted -> GPIO9 is available to be used for other purposes (backlight control in below example).
the overlay file
Code: Select all
/*
* mipi-dbi-spi0-no-miso-no-cs-overlay.dts
*
* aBUGSworstnightmare Feb 2025 - rev 0r1
*/
#include <dt-bindings/gpio/gpio.h>
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&spi0_cs_pins>;
frag0: __overlay__ {
brcm,pins;
};
};
fragment@1 {
target = <&spi0>;
__overlay__ {
cs-gpios;
status = "okay";
};
};
fragment@2 {
target = <&spidev1>;
__overlay__ {
status = "disabled";
};
};
fragment@3 {
target = <&spi0_pins>;
__overlay__ {
brcm,pins = <10 11>;
};
};
panel_fragment: fragment@10 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
panel: panel@0 {
compatible = "panel", "panel-mipi-dbi-spi";
reg = <0>;
spi-max-frequency = <32000000>;
width-mm = <0>;
height-mm = <0>;
timing: panel-timing {
hactive = <320>;
vactive = <240>;
hback-porch = <0>;
vback-porch = <0>;
clock-frequency = <0>;
hfront-porch = <0>;
hsync-len = <0>;
vfront-porch = <0>;
vsync-len = <0>;
};
};
};
};
fragment@11 {
target = <&panel>;
__dormant__ {
backlight = <&backlight_gpio>;
};
};
fragment@12 {
target-path = "/";
__dormant__ {
backlight_gpio: backlight_gpio {
compatible = "gpio-backlight";
gpios = <&gpio 255 GPIO_ACTIVE_HIGH>;
};
};
};
fragment@20 {
target = <&panel>;
__dormant__ {
backlight = <&backlight_pwm>;
};
};
fragment@21 {
target-path = "/";
__dormant__ {
backlight_pwm: backlight_pwm {
compatible = "pwm-backlight";
brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
default-brightness-level = <15>;
pwms = <&pwm 0 200000>;
};
};
};
fragment@22 {
target = <&pwm>;
__dormant__ {
pinctrl-names = "default";
pinctrl-0 = <&pwm_pins>;
assigned-clock-rates = <1000000>;
status = "okay";
};
};
fragment@23 {
target = <&gpio>;
__dormant__ {
pwm_pins: pwm_pins {
brcm,pins = <18>;
brcm,function = <2>; /* Alt5 */
};
};
};
fragment@24 {
target = <&chosen>;
__dormant__ {
bootargs = "snd_bcm2835.enable_headphones=0";
};
};
__overrides__ {
compatible = <&panel>, "compatible";
speed = <&panel>, "spi-max-frequency:0";
cpha = <&panel>, "spi-cpha?";
cpol = <&panel>, "spi-cpol?";
write-only = <&panel>, "write-only?";
width = <&timing>, "hactive:0";
height = <&timing>, "vactive:0";
x-offset = <&timing>, "hback-porch:0";
y-offset = <&timing>, "vback-porch:0";
clock-frequency = <&timing>, "clock-frequency:0";
width-mm = <&panel>, "width-mm:0";
height-mm = <&panel>, "height-mm:0";
/* optional gpios */
reset-gpio = <&panel>, "reset-gpios:0=", <&gpio>,
<&panel>, "reset-gpios:4",
<&panel>, "reset-gpios:8=0"; /* GPIO_ACTIVE_HIGH */
dc-gpio = <&panel>, "dc-gpios:0=", <&gpio>,
<&panel>, "dc-gpios:4",
<&panel>, "dc-gpios:8=0"; /* GPIO_ACTIVE_HIGH */
backlight-gpio = <0>, "+11+12",
<&backlight_gpio>, "gpios:4";
backlight-pwm = <0>, "+20+21+22+23+24";
backlight-pwm-chan = <&backlight_pwm>, "pwms:4";
backlight-pwm-gpio = <&pwm_pins>, "brcm,pins:0";
backlight-pwm-func = <&pwm_pins>, "brcm,function:0";
backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";
};
};
Code: Select all
# 1.3in or equivalent - 240x240pixel - i.e. SBC-LCD01
# on SPI-0 for displays with permanently enabled CS-signal
# GPIO9 free to use
dtoverlay=mipi-dbi-spi0-no-miso-no-cs,speed=32000000
dtparam=compatible=wavesku196500円panel-mipi-dbi-spi
dtparam=write-only,cpha,cpol
dtparam=width=240,height=240,width-mm=23,height-mm=23
dtparam=reset-gpio=24,dc-gpio=25,backlight-gpio=9
- IMG_20250223_104359.jpg
- IMG_20250223_104359.jpg (376.88 KiB) Viewed 13190 times
- IMG_20250223_104406.jpg
- IMG_20250223_104406.jpg (246.32 KiB) Viewed 13190 times
- Attachments
-
- mipi-dbi-spi0-no-miso-no-cs.dtbo.7z
- compiled overlay without CS signal
- (1.35 KiB) Downloaded 33 times
Last edited by aBUGSworstnightmare on Sun Jul 27, 2025 7:01 am, edited 1 time in total.
- Flamethrower
- Posts: 27
- Joined: Tue Jul 16, 2024 8:51 am
Re: Small TFT based on ILI9341 ST7789 - how to use lcd-wiki 4.0inch
Hello, I tried this on a Raspberry Pi Zero with the settings you mentioned but the screen is just plain white...aBUGSworstnightmare wrote: ↑Mon Dec 09, 2024 6:36 amST7796S TCON
This has been tested with lcd-wiki 4.0inch SPI Module ST7796
The display has a resolution of 480x320pixels
- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use lcd-wiki 4.0inch
you've copied the 4in.bin file?Flamethrower wrote: ↑Sun Mar 30, 2025 2:04 pmHello, I tried this on a Raspberry Pi Zero with the settings you mentioned but the screen is just plain white...aBUGSworstnightmare wrote: ↑Mon Dec 09, 2024 6:36 amST7796S TCON
This has been tested with lcd-wiki 4.0inch SPI Module ST7796
The display has a resolution of 480x320pixels
Which OS is that?
You've connected the display correct?
All my connections are as here viewtopic.php?p=2306480#p2285181
Don't connect the touchscreen signals yet!
- Flamethrower
- Posts: 27
- Joined: Tue Jul 16, 2024 8:51 am
Re: Small TFT based on ILI9341 ST7789 - how to use
Turns out I had to comment out the line
Now it works :D
Code: Select all
dtparam=write-only,cpha,cpol- aBUGSworstnightmare
- Posts: 13432
- Joined: Tue Jun 30, 2015 1:35 pm
Re: Small TFT based on ILI9341 ST7789 - how to use
yes, that line is optional, but surprised to hear it causes issues.Flamethrower wrote: ↑Sun Mar 30, 2025 4:40 pmTurns out I had to comment out the lineNow it works :DCode: Select all
dtparam=write-only,cpha,cpol
Will test tomorrow if time permits.
But yes, if you want to use the touch with the same SPI this will cause conflicts.
Maybe should comment it on all examp!es...
Return to "Interfacing (DSI, CSI, I2C, etc.)"
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion