Add LTDC display and GT911 touch drivers for STM32H7 boards#407
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.
- 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>
|
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. |
|
Status update for anyone landing on this PR from a search: I'm pausing this PR while I migrate the driver work to lvgl-micropython/lvgl_micropython (the spin-off binding by @kdschlosser), which has active maintenance, a regular release cadence, and a unified driver architecture ( What moves where:
The migration is motivated by infrastructure rather than any disagreement with the design here: the STM32 CI workflow on the parent repo is currently disabled, the runner-update PR ( I'm leaving this PR open in case the situation changes. Happy to rebase and reactivate it if review capacity becomes available. cc @kisvegabor @PGNetHun — @nuraci |
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.