Add LTDC display and GT911 touch drivers for STM32H7 boards#407
Open
nuraci wants to merge 4 commits intolvgl:masterfrom
Open
Add LTDC display and GT911 touch drivers for STM32H7 boards#407nuraci wants to merge 4 commits intolvgl:masterfrom
nuraci wants to merge 4 commits intolvgl:masterfrom
Conversation
There was a problem hiding this comment.
4 issues found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="driver/stm32/st_ltdc/modules/st_ltdc.c">
<violation number="1" location="driver/stm32/st_ltdc/modules/st_ltdc.c:264">
P2: Backlight selector fields are not fully initialized before use, so init/deinit may read indeterminate `bl_pin`/`bl_led` values and take the wrong backlight path.</violation>
<violation number="2" location="driver/stm32/st_ltdc/modules/st_ltdc.c:482">
P2: `deinit()` lacks an initialization-state guard and unconditionally calls LTDC HAL operations, allowing out-of-sequence calls to operate on an uninitialized `hltdc` handle.</violation>
<violation number="3" location="driver/stm32/st_ltdc/modules/st_ltdc.c:520">
P2: LTDC timing and geometry inputs are not range-validated, allowing unsigned underflow/wrap in register calculations.</violation>
</file>
<file name="driver/stm32/st_ltdc/display_conf.py">
<violation number="1" location="driver/stm32/st_ltdc/display_conf.py:13">
P2: Unsupported BOARD/VERSION/PANEL values can leave `board`/`panel` undefined, causing runtime import failure instead of a clear configuration error.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This was referenced Mar 30, 2026
- Zero-initialize ltdc_display_obj_t to prevent indeterminate bl_pin/bl_led fields from selecting the wrong backlight path - Guard deinit() against out-of-sequence calls on uninitialized handle - Validate LTDC timing parameters (width, height, hsync, vsync > 0) before computing register values to prevent unsigned underflow - Raise ValueError for unsupported BOARD/VERSION/PANEL in display_conf.py instead of leaving variables undefined
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="driver/stm32/st_ltdc/modules/st_ltdc.c">
<violation number="1" location="driver/stm32/st_ltdc/modules/st_ltdc.c:470">
P1: `deinit()` can become a no-op after LVGL display delete because it keys off a global that is cleared outside `deinit`, skipping LTDC/backlight teardown.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Author
|
The CI failure is unrelated to this PR — it's a pre-existing issue in the ESP32 port. This PR only touches STM32 board definitions and the LTDC driver. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a generic LTDC display driver and GT911 I2C touch driver for STM32H7,
along with board-specific BSP files for three boards (DEV190806042,
FK743M5-XIH6, STM32H7_CORE).
LTDC driver (
driver/stm32/st_ltdc/)st_ltdc.LTDCclass:configurable timing parameters, polarity flags, RGB565/RGB888/ARGB8888
color formats, double-buffered VSYNC-synced flush (DIRECT/FULL mode)
and DMA2D-accelerated partial updates (PARTIAL mode).
Framebuffer MPU region is configured as Write-Through so LTDC reads
are always coherent without manual cache maintenance.
AXI QoS priorities are tuned to prevent LTDC starvation.
touch_i2c.TPclassfor GT9xx touch controllers, supporting both hardware I2C and SoftI2C.
st_ltdc_utils.py(init helper),boards.py(pinconfigs per board),
panels.py(display timing presets),display_conf.py(auto-selects board/panel from build config),
display_driver.py(one-line boot).
Board-specific BSP (
driver/stm32/{BOARD}/bsp_ltdc.c)Each file implements
HAL_LTDC_MspInit()/HAL_LTDC_MspDeInit()withthe correct PLL3 pixel-clock setup and GPIO alternate-function mapping
for that board's LTDC wiring. The build system (
micropython.mk)automatically picks the right BSP based on the
BOARDvariable.Supported configurations
Test plan
Ctrl-D): display deinits cleanly and reinitslv.deinit()/lv.init()cycle without crashBoards docs and photos
https://github.com/Copper-And-Code/stm32h7-boards-docs
micropython sample code and tools
https://github.com/Copper-And-Code/lv_micropython_code_and_tools
Summary by cubic
Add a generic LTDC display driver and GT911 I2C touch driver for STM32H7 boards with LVGL integration. Adds BSPs for DEV190806042, FK743M5-XIH6, and STM32H7_CORE, plus safer init/deinit and config validation.
New Features
st_ltdc.LTDCdriver: configurable timings/polarity, RGB565/RGB888/ARGB8888, tear‑free double buffering with VSYNC‑synced flush, DMA2D‑accelerated partial updates.touch_i2c.TPfor GT9xx (GT911) via hardware I2C orSoftI2C; BSPs and auto board/panel selection viaboards.py/panels.py/display_conf.py;display_driver.pyfor one‑line init; LVGLlv_conf.h; example updated.Bug Fixes
deinit()when the handle was never initialized.ValueErrorfor unsupported BOARD/VERSION/PANEL indisplay_conf.py.Written for commit b6fce8e. Summary will update on new commits.