DEV Community

Cover image for Before You Commit to a TFT: Define a Display Acceptance Test on STM32
Danie Brooks
Danie Brooks

Posted on

Before You Commit to a TFT: Define a Display Acceptance Test on STM32

A display demo often ends when the first image appears. Product firmware has a longer job. It must redraw a menu while communications are active, show fresh measurements, and recover after the operator opens a more demanding screen.

Before choosing an STM32 display interface, define what successful operation looks like in the application. This gives hardware and firmware developers something concrete to review together. A useful starting point is a small test specification containing the screen size, pixel format, largest redraw, update deadline, and background activity that must run during the test.

Turn a UI requirement into a deadline

Consider a hypothetical instrument with a 320 × 240 screen. It has a settings page and a waveform view. The settings page changes occasionally. The waveform view must present a new plot every 50 ms.

A full RGB565 frame contains:

320 × 240 × 2 = 153,600 bytes
Enter fullscreen mode Exit fullscreen mode

If software sends a complete frame over conventional single-data-line SPI at an illustrative 32 MHz, the ideal payload time is:

153,600 × 8 / 32,000,000 = 0.0384 seconds
Enter fullscreen mode Exit fullscreen mode

That is 38.4 ms before window commands, transfer gaps, and pixel preparation. It leaves little room inside a 50 ms deadline. The module must also support the selected clock under the intended electrical conditions.

Suppose the GUI can update a 280 × 100 plot region instead. That payload is 56,000 bytes, taking an ideal 14 ms at the same clock. Partial updates now look more promising. Confirm how much the GUI actually invalidates when the trace moves. Scrolling, axis labels, and clearing the previous trace can make the transmitted rectangle larger than the new line itself.

Put the deadline next to the calculation in the design notes. Then measure the complete update on hardware.

Assign responsibility for keeping the image visible

The next decision concerns image storage. With a controller-based SPI module that contains graphics RAM, firmware can write a region and let the module retain it. Small working buffers may be sufficient, depending on the graphics library and drawing operations.

An 8080 parallel module can offer the same stored-image approach with a wider data bus. Verify its command protocol, then check whether the selected STM32's FMC or FSMC and package support the required bus signals and timing. Reserve the pins in the actual board configuration, including the signals needed by other peripherals.

With parallel RGB, the LCD-TFT display controller, or LTDC, continuously reads image data and generates panel timing. The framebuffer must remain available throughout scanout. Allocate it in memory LTDC can access, and include pitch padding and any additional buffers in the RAM budget.

MIPI DSI adds another set of compatibility checks. On supported STM32 devices, DSI video mode carries the LTDC pixel stream. Command modes serve a different update arrangement and require compatible panel behavior. Record the panel's required mode, pixel format, lane configuration, and initialization commands before treating the DSI connection as settled.

Measure three parts of an update

A single “frames per second” number can hide where the delay occurs. Separate the measurements enough to identify which operation needs attention.

Measurement Suggested boundary What it helps establish
Drawing time Start rendering to finished pixel buffer Whether drawing fits the update deadline
Transfer time First display command to final transmitted pixel Whether a command-based interface can deliver the update
Presentation wait Finished frame to scheduled buffer change How synchronization contributes to latency

A GPIO pulse around rendering is useful for a first measurement. For asynchronous transfers, finish the transfer measurement in the completion callback. Timing only the function that starts DMA measures submission overhead.

For an LTDC design, record buffer changes relative to vertical blanking. Rendering into a back buffer and switching at a safe frame boundary avoids exposing a partially drawn frame. Check the synchronization procedure for the selected MCU and graphics stack.

The figures in the SPI example are calculated lower bounds. A hardware trace supplies the evidence for accepting the implementation.

Use a workload that can expose contention

Run the waveform test while the application performs its normal communications and storage activity. Choose the busiest credible combination and record it so another developer can repeat the test.

For LTDC, monitor FIFO underrun indications as well as the visible image. Scanout shares memory resources with rendering and other bus users. A successful static screen provides limited evidence about that concurrent workload.

Keep observations specific. “Occasional corruption” is difficult to investigate. “Horizontal corruption appears during a storage write, with the LTDC underrun counter increasing” gives the next debugging session a starting point. Record the clock settings, framebuffer location, and enabled layers with that observation.

Keep the reference configuration identifiable

A development kit can shorten bring-up when its hardware and software configuration are documented. ST's UM3223 identifies the Rocktech RK050HR18-CTG on the MB1860 display board used by STM32U5G9J-DK2. That particular assembly uses a 5-inch, 800 × 480 panel connected through parallel RGB.

When adapting a reference, save the exact schematic revision and matching firmware configuration alongside the test results. Compare connector assignments, supplies, reset behavior, backlight control, and touch wiring with the custom board.

The final acceptance record should state which screen ran, which background tasks were active, the measured update time, and any display errors observed. A later panel substitution or firmware change can then be checked against the same workload.

Top comments (0)