diff --git a/boards/shields/st_lcd_dsi_mb1835/Kconfig.defconfig b/boards/shields/st_lcd_dsi_mb1835/Kconfig.defconfig new file mode 100644 index 0000000000000..ec63817f0d111 --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/Kconfig.defconfig @@ -0,0 +1,22 @@ +# Copyright (c) 2025 Charles Dias +# SPDX-License-Identifier: Apache-2.0 + +if SHIELD_ST_LCD_DSI_MB1835 + +orsource "boards/*.defconfig" + +if LVGL + +config LV_Z_BITS_PER_PIXEL + default 32 + +config LV_Z_FLUSH_THREAD + default y + +choice LV_COLOR_DEPTH + default LV_COLOR_DEPTH_32 +endchoice + +endif # LVGL + +endif # SHIELD_ST_LCD_DSI_MB1835 diff --git a/boards/shields/st_lcd_dsi_mb1835/Kconfig.shield b/boards/shields/st_lcd_dsi_mb1835/Kconfig.shield new file mode 100644 index 0000000000000..145536fa9b7e0 --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Charles Dias +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_ST_LCD_DSI_MB1835 + def_bool $(shields_list_contains,st_lcd_dsi_mb1835) diff --git a/boards/shields/st_lcd_dsi_mb1835/boards/stm32u5g9j_dk1.conf b/boards/shields/st_lcd_dsi_mb1835/boards/stm32u5g9j_dk1.conf new file mode 100644 index 0000000000000..69aff33a27e0a --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/boards/stm32u5g9j_dk1.conf @@ -0,0 +1,6 @@ +# Heap memory pool configuration +CONFIG_HEAP_MEM_POOL_SIZE=65536 + +# Display configuration +CONFIG_STM32_LTDC_ARGB8888=y +CONFIG_DISPLAY_HX8379C_INIT_PRIORITY=87 diff --git a/boards/shields/st_lcd_dsi_mb1835/doc/index.rst b/boards/shields/st_lcd_dsi_mb1835/doc/index.rst new file mode 100644 index 0000000000000..63b8d477fc9c0 --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/doc/index.rst @@ -0,0 +1,124 @@ +.. _st_lcd_dsi_mb1835: + +ST LCD DSI MB1835 +################# + +Overview +******** + +The MB1835 shield (revision B-01) provides a 2.47-inch round TFT-LCD with MIPI DSI interface +and capacitive touch screen, specifically designed for STM32U5G9J-DK1 Discovery kit. + +The shield features: + +- 2.47-inch round TFT-LCD with 480x480 pixel resolution +- 16.7M color depth (RGB888) +- J025F1CN0201W display module with Himax HX8379C LCD controller +- MIPI DSI |reg| 2-data lane interface +- Capacitive touch panel (CTP) +- LED backlight with GPIO control + +.. figure:: mb1835_front.webp + :alt: MB1835 Display shield front image + :align: center + + MB1835 Display Shield Front Image + +.. figure:: mb1835_back.webp + :alt: MB1835 Display shield back image + :align: center + + MB1835 Display Shield Back Image + +The MB1835 display board connects to the STM32U5G9J-DK1 through the CN1 connector: + ++------+--------------+------------+-------+--------------+-----------------+ +| CN1 | Description | Interface | CN1 | Description | Interface | +| odd | | | even | | | ++======+==============+============+=======+==============+=================+ +| 1 | GND | - | 2 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 3 | DSI_CK_P | DSI | 4 | TOUCH_INT | Interrupt out | ++------+--------------+------------+-------+--------------+-----------------+ +| 5 | DSI_CK_N | DSI | 6 | GND | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 7 | GND | - | 8 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 9 | DSI_D0_P | DSI | 10 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 11 | DSI_D0_N | DSI | 12 | GND | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 13 | GND | - | 14 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 15 | DSI_D1_P | DSI | 16 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 17 | DSI_D1_N | DSI | 18 | GND | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 19 | GND | - | 20 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 21 | BLVDD(+5V) | - | 22 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 23 | BLVDD(+5V) | - | 24 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 25 | - | - | 26 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 27 | BLGND | - | 28 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 29 | BLGND | - | 30 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 31 | - | - | 32 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 33 | - | - | 34 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 35 | - | - | 36 | 3.3V | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 37 | - | - | 38 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 39 | - | - | 40 | I2C_SDA | I2C | ++------+--------------+------------+-------+--------------+-----------------+ +| 41 | - | - | 42 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 43 | - | - | 44 | I2C_SCL | I2C | ++------+--------------+------------+-------+--------------+-----------------+ +| 45 | - | - | 46 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 47 | - | - | 48 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 49 | DSI_TE | DSI | 50 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 51 | - | - | 52 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 53 | BL_CTRL | GPIO | 54 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 55 | - | - | 56 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 57 | RESET | GPIO | 58 | - | - | ++------+--------------+------------+-------+--------------+-----------------+ +| 59 | - | - | 60 | 1.8V | - | ++------+--------------+------------+-------+--------------+-----------------+ + +Requirements +************ + +Your board needs to have a ``mipi_dsi`` device tree label to work with this shield. + +Usage +***** + +The shield can be used in any application by setting ``SHIELD`` to +``st_lcd_dsi_mb1835`` and adding the necessary device tree properties. + +Set ``--shield "st_lcd_dsi_mb1835"`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/display + :board: stm32u5g9j_dk1 + :shield: st_lcd_dsi_mb1835 + :goals: build + +References +********** + +- `STM32U5G9J-DK1 User Manual `_ + +- `MB1835 Schematic (Rev B-01) `_ diff --git a/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_back.webp b/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_back.webp new file mode 100644 index 0000000000000..f621b5cd09663 Binary files /dev/null and b/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_back.webp differ diff --git a/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_front.webp b/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_front.webp new file mode 100644 index 0000000000000..c40dc1f8f867b Binary files /dev/null and b/boards/shields/st_lcd_dsi_mb1835/doc/mb1835_front.webp differ diff --git a/boards/shields/st_lcd_dsi_mb1835/shield.yml b/boards/shields/st_lcd_dsi_mb1835/shield.yml new file mode 100644 index 0000000000000..e7a8789071975 --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/shield.yml @@ -0,0 +1,6 @@ +shields: + - name: st_lcd_dsi_mb1835 + full_name: ST LCD DSI MB1835 + vendor: st + supported_features: + - display diff --git a/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay b/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay new file mode 100644 index 0000000000000..df57cd40a1bfd --- /dev/null +++ b/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2025 Charles Dias + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + chosen { + zephyr,display = &zephyr_lcd_controller; + }; +}; + +&pll3 { + div-m = <4>; /* Input divider: 16MHz / 4 = 4MHz */ + mul-n = <125>; /* Multiplier: 4MHz * 125 = 500MHz VCO */ + div-p = <8>; /* P output: 500MHz / 8 = 62.5MHz (for DSI clock lane) */ + div-q = <2>; /* Q output: 500MHz / 2 = 250MHz */ + div-r = <24>; /* R output: 500MHz / 24 = 20.83MHz (for LTDC pixel clock) */ + clocks = <&clk_hse>; + status = "okay"; +}; + +&zephyr_mipi_dsi { + status = "okay"; + + pll-ndiv = <125>; /* PLLDSINDIV = 125 */ + pll-idf = <4>; /* DSI_PLL_IN_DIV4 */ + pll-odf = <2>; /* DSI_PLL_OUT_DIV2 */ + pll-vco-range = <0x1>; /* DSI_DPHY_VCO_FRANGE_800MHZ_1GHZ */ + pll-charge-pump = <0x0>;/* DSI_PLL_CHARGE_PUMP_2000HZ_4400HZ */ + pll-tuning = <0x0>; /* DSI_PLL_LOOP_FILTER_2000HZ_4400HZ */ + + phy-freq-range = <0x8>; /* DSI_DPHY_FRANGE_450MHZ_510MHZ */ + phy-low-power-offset = <0x0>; /* PHY_LP_OFFSSET_0_CLKP */ + + hs-active-high; + vs-active-high; + de-active-high; + largest-packet-size = <0>; + + host-timeouts = <1>, /* TimeoutCkdiv */ + <0>, /* HighSpeedTransmissionTimeout */ + <0>, /* LowPowerReceptionTimeout */ + <0>, /* HighSpeedReadTimeout */ + <0>, /* LowPowerReadTimeout */ + <0>, /* HighSpeedWriteTimeout */ + <0>, /* HighSpeedWritePrespMode */ + <0>, /* LowPowerWriteTimeout */ + <0>; /* BTATimeout */ + + phy-timings = <11>, /* ClockLaneHS2LPTime */ + <40>, /* ClockLaneLP2HSTime */ + <12>, /* DataLaneHS2LPTime */ + <23>, /* DataLaneLP2HSTime */ + <0>, /* DataLaneMaxReadTime */ + <7>; /* StopWaitTime */ + + hx8379c: hx8379c@0 { + status = "okay"; + compatible = "himax,hx8379c"; + reg = <0x0>; /* Virtual channel 0 */ + width = <480>; + height = <480>; + data-lanes = <2>; + pixel-format = ; + + reset-gpios = <&dsi_lcd_qsh_030 57 GPIO_ACTIVE_HIGH>; + + display-timings { + compatible = "zephyr,panel-timing"; + hsync-active = <1>; + vsync-active = <1>; + de-active = <0>; + pixelclk-active = <0>; + hsync-len = <2>; + hback-porch = <1>; + hfront-porch = <1>; + vsync-len = <1>; + vback-porch = <13>; + vfront-porch = <50>; + }; + }; +}; + +&zephyr_lcd_controller { + status = "okay"; + width = <480>; + height = <480>; + pixel-format = ; + + bl-ctrl-gpios = <&dsi_lcd_qsh_030 53 GPIO_ACTIVE_HIGH>; + + def-back-color-red = <0>; + def-back-color-green = <0>; + def-back-color-blue = <0>; + + /* J025F1CN0201W display module */ + display-timings { + compatible = "zephyr,panel-timing"; + hsync-active = <1>; + vsync-active = <1>; + de-active = <0>; + pixelclk-active = <0>; + hsync-len = <2>; + hback-porch = <1>; + hfront-porch = <1>; + vsync-len = <1>; + vback-porch = <13>; + vfront-porch = <50>; + }; +}; diff --git a/boards/st/stm32u5g9j_dk1/stm32u5g9j_dk1.dts b/boards/st/stm32u5g9j_dk1/stm32u5g9j_dk1.dts index 2f30bba33cdcc..7840a7c76296f 100644 --- a/boards/st/stm32u5g9j_dk1/stm32u5g9j_dk1.dts +++ b/boards/st/stm32u5g9j_dk1/stm32u5g9j_dk1.dts @@ -45,26 +45,6 @@ }; }; - dsi_lcd_qsh_030: connector_dsi_lcd { - compatible = "st,dsi-lcd-qsh-030"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <4 0 &gpioe 8 0>, /* TOUCH_INT */ - <22 0 &gpiod 8 0>, /* SPI chip SEL */ - <24 0 &gpiob 13 0>, /* SPI CLK */ - <26 0 &gpiod 4 0>, /* SPI MOSI */ - <28 0 &gpiod 11 0>, /* SPI DCX */ - <35 0 &gpioe 5 0>, /* SCLK/MCLK */ - <37 0 &gpioe 4 0>, /* LRCLK */ - <40 0 &gpioh 4 0>, /* I2C5_SDA */ - <43 0 &gpioi 7 0>, /* SWIRE */ - <44 0 &gpioh 5 0>, /* I2C5_SCL */ - <49 0 &gpiof 11 0>, /* DSI_TE */ - <53 0 &gpioi 6 0>, /* LCD_BL_CTRL */ - <57 0 &gpiod 5 0>; /* DSI_RESET */ - }; - aliases { led0 = &green_led_0; led1 = &red_led_0; @@ -75,6 +55,18 @@ volt-sensor0 = &vref1; volt-sensor1 = &vbat4; }; + + dsi_lcd_qsh_030: connector_dsi_lcd { + compatible = "st,dsi-lcd-qsh-030"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <4 0 &gpioe 8 0>, /* TOUCH_INT */ + <40 0 &gpioh 4 0>, /* I2C5_SDA */ + <44 0 &gpioh 5 0>, /* I2C5_SCL */ + <53 0 &gpioi 6 0>, /* DSI_BL_CTRL */ + <57 0 &gpiod 5 0>; /* DSI_RESET */ + }; }; &clk_hsi48 { @@ -318,3 +310,9 @@ zephyr_udc0: &usbotg_hs { &vbat4 { status = "okay"; }; + +/* alias used by display shields */ +zephyr_mipi_dsi: &mipi_dsi {}; + +/* alias used by LCD display shields */ +zephyr_lcd_controller: <dc {};