Skip to content

Commit d0aa263

Browse files
squinioukartben
authored andcommitted
boards: stm32h573i_dk: add display support
Add display support for the st7789v LCD controller. Automatically enable the LCD backlight at boot to use the display sample as is, because the LCD backlight is normally off. Signed-off-by: Samuel Quiniou <[email protected]>
1 parent e4650bc commit d0aa263

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

boards/st/stm32h573i_dk/Kconfig.defconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,16 @@ config SDMMC_STM32_CLOCK_CHECK
2121

2222
endif # DISK_DRIVER_SDMMC
2323

24+
if DISPLAY
25+
26+
choice ST7789V_PIXEL_FORMAT
27+
default ST7789V_BGR565
28+
endchoice
29+
30+
# Required to enable LCD backlight
31+
config REGULATOR
32+
default y
33+
34+
endif # DISPLAY
35+
2436
endif # BOARD_STM32H573I_DK

boards/st/stm32h573i_dk/doc/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ Serial Port
180180
STM32H573I-DK Discovery board has 3 U(S)ARTs. The Zephyr console output is
181181
assigned to USART1. Default settings are 115200 8N1.
182182

183+
TFT LCD screen
184+
--------------
185+
186+
The TFT LCD screen is supported for the STM32H573I-DK Discovery board.
187+
It can be tested using :zephyr:code-sample:`display` sample:
188+
189+
.. zephyr-app-commands::
190+
:zephyr-app: samples/drivers/display
191+
:board: stm32h573i_dk
192+
:goals: build
183193

184194
Programming and Debugging
185195
*************************

boards/st/stm32h573i_dk/stm32h573i_dk.dts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <zephyr/dt-bindings/input/input-event-codes.h>
1212
#include <zephyr/dt-bindings/memory-attr/memory-attr.h>
1313
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
14+
#include <zephyr/dt-bindings/memory-controller/stm32-fmc-nor-psram.h>
15+
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
1416
/ {
1517
model = "STMicroelectronics STM32H573I DISCOVERY KIT board";
1618
compatible = "st,stm32h573i-dk";
@@ -22,6 +24,7 @@
2224
zephyr,flash = &flash0;
2325
zephyr,code-partition = &slot0_partition;
2426
zephyr,canbus = &fdcan1;
27+
zephyr,display = &st7789v;
2528
};
2629

2730
leds {
@@ -53,6 +56,13 @@
5356
};
5457
};
5558

59+
lcd_bl_ctrl {
60+
compatible = "regulator-fixed";
61+
regulator-name = "LCD Backlight Driver";
62+
enable-gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
63+
regulator-boot-on;
64+
};
65+
5666
aliases {
5767
led0 = &blue_led_0;
5868
sw0 = &user_button;
@@ -72,6 +82,77 @@
7282
};
7383
};
7484

85+
&fmc {
86+
pinctrl-0 = <&fmc_a0_pf0 &fmc_ne1_pc7 &fmc_nwe_pd5 &fmc_noe_pd4
87+
&fmc_d0_pd14 &fmc_d1_pd15 &fmc_d2_pd0 &fmc_d3_pd1
88+
&fmc_d4_pe7 &fmc_d5_pe8 &fmc_d6_pe9 &fmc_d7_pe10
89+
&fmc_d8_pe11 &fmc_d9_pe12 &fmc_d10_pe13 &fmc_d11_pe14
90+
&fmc_d12_pe15 &fmc_d13_pd8 &fmc_d14_pd9 &fmc_d15_pd10>;
91+
pinctrl-names = "default";
92+
status = "okay";
93+
94+
sram {
95+
compatible = "st,stm32-fmc-nor-psram";
96+
97+
#address-cells = <1>;
98+
#size-cells = <0>;
99+
100+
bank@0 {
101+
reg = <0x0>;
102+
st,control = <STM32_FMC_DATA_ADDRESS_MUX_DISABLE
103+
STM32_FMC_MEMORY_TYPE_SRAM
104+
STM32_FMC_NORSRAM_MEM_BUS_WIDTH_16
105+
STM32_FMC_BURST_ACCESS_MODE_DISABLE
106+
STM32_FMC_WAIT_SIGNAL_POLARITY_LOW
107+
STM32_FMC_WAIT_TIMING_BEFORE_WS
108+
STM32_FMC_WRITE_OPERATION_ENABLE
109+
STM32_FMC_WAIT_SIGNAL_DISABLE
110+
STM32_FMC_EXTENDED_MODE_DISABLE
111+
STM32_FMC_ASYNCHRONOUS_WAIT_DISABLE
112+
STM32_FMC_WRITE_BURST_DISABLE
113+
STM32_FMC_CONTINUOUS_CLOCK_SYNC_ONLY
114+
STM32_FMC_WRITE_FIFO_DISABLE
115+
STM32_FMC_PAGE_SIZE_NONE>;
116+
st,timing = <1 1 32 0 2 2 STM32_FMC_ACCESS_MODE_A>;
117+
118+
fmc-mipi-dbi {
119+
compatible = "st,stm32-fmc-mipi-dbi";
120+
reset-gpios = <&gpioh 13 GPIO_ACTIVE_LOW>;
121+
power-gpios = <&gpioc 6 GPIO_ACTIVE_LOW>;
122+
register-select-pin = <0>;
123+
#address-cells = <1>;
124+
#size-cells = <0>;
125+
126+
st7789v: lcd-panel@0 {
127+
compatible = "sitronix,st7789v";
128+
reg = <0>;
129+
mipi-mode = "MIPI_DBI_MODE_8080_BUS_16_BIT";
130+
/* A write cycle should be 68ns */
131+
mipi-max-frequency = <14705882>;
132+
width = <240>;
133+
height = <240>;
134+
x-offset = <0>;
135+
y-offset = <0>;
136+
vcom = <0x1F>;
137+
gctrl = <0x35>;
138+
vdvs = <0x20>;
139+
mdac = <0x00>;
140+
gamma = <0x01>;
141+
colmod = <0x05>;
142+
lcm = <0x2c>;
143+
porch-param = [0c 0c 00 33 33];
144+
cmd2en-param = [5a 69 02 00];
145+
pwctrl1-param = [a4 a1];
146+
pvgam-param = [D0 08 11 08 0C 15 39 33 50 36 13 14 29 2D];
147+
nvgam-param = [D0 08 10 08 06 06 39 44 51 0B 16 14 2F 31];
148+
ram-param = [00 F0];
149+
rgb-param = [40 02 14];
150+
};
151+
};
152+
};
153+
};
154+
};
155+
75156
&clk_hsi48 {
76157
status = "okay";
77158
};

0 commit comments

Comments
 (0)