16. LCD-TFT controller (LTDC)

This section applies only to STM32F429xx/439xx devices.

16.1 Introduction

The LCD-TFT (Liquid Crystal Display - Thin Film Transistor) display controller provides a parallel digital RGB (Red, Green, Blue) and signals for horizontal, vertical synchronisation, Pixel Clock and Data Enable as output to interface directly to a variety of LCD and TFT panels.

16.2 LTDC main features

16.3 LTDC functional description

16.3.1 LTDC block diagram

The block diagram of the LTDC is shown in Figure 81: LTDC block diagram.

Figure 81. LTDC block diagram showing the internal structure with AHB clock domain, APB2 clock domain, Pixel clock domain, Layer1 FIFO, PFC, Blending unit, Dithering unit, Timing generator, Configuration and status registers, AHB interface, and connection to LCD-TFT panel with signals LCD_HSYNC, LCD_VSYNC, LCD_DE, LCD_CLK, LCD_R[7:0], LCD_G[7:0], and LCD_B[7:0].

Figure 81. LTDC block diagram

Figure 81. LTDC block diagram showing the internal structure with AHB clock domain, APB2 clock domain, Pixel clock domain, Layer1 FIFO, PFC, Blending unit, Dithering unit, Timing generator, Configuration and status registers, AHB interface, and connection to LCD-TFT panel with signals LCD_HSYNC, LCD_VSYNC, LCD_DE, LCD_CLK, LCD_R[7:0], LCD_G[7:0], and LCD_B[7:0].

Layer FIFO: One FIFO 64x32 bit per layer.

PFC: Pixel Format Convertor performing the pixel format conversion from the selected input pixel format of a layer to words.

AHB interface: For data transfer from memories to the FIFO.

Blending, Dithering unit and Timings Generator: Refer to Section 16.4.1 and Section 16.4.2.

16.3.2 LTDC reset and clocks

The LCD-TFT controller peripheral uses 3 clock domains:

Table 88 summarizes the clock domain for each register.

Table 88. LTDC registers versus clock domain
LTDC registersClock domain
LTDC_LxCRHCLK
LTDC_LxCFBAR
LTDC_LxCFBLR
LTDC_LxCFBLNR
LTDC_SRCRPCLK2
LTDC_IER
LTDC_ISR
LTDC_ICR
LTDC_SSCRPixel Clock (LCD_CLK)
LTDC_BPCR
LTDC_AWCR
LTDC_TWCR
LTDC_GCR
LTDC_BCCR
LTDC_LIPCR
LTDC_CPSR
LTDC_CDSR
LTDC_LxWHPCR
LTDC_LxWVPCR
LTDC_LxCKCR
LTDC_LxPFCR
LTDC_LxCACR
LTDC_LxDCCR
LTDC_LxBFCR
LTDC_LxCLUTWR

Care must be taken when accessing the LTDC registers since the APB2 bus is stalling when the following operations are ongoing:

For registers on PCLK2 clock domain, APB2 bus is stalling during the register write access for 6 xPCKL2 period and 7xPCKL2 period for read access.

The LCD controller can be reset by setting the corresponding bit in the RCC_APB2RSTR register. It resets the three clock domains.

16.3.3 LCD-TFT pins and signal interface

The Table below summarizes the LTDC signal interface:

Table 89. LCD-TFT pins and signal interface

LCD-TFT signalsI/ODescription
LCD_CLKOClock Output
LCD_HSYNCOHorizontal Synchronization
LCD_VSYNCOVertical Synchronization
LCD_DEONot Data Enable
LCD_R[7:0]OData: 8-bit Red data
LCD_G[7:0]OData: 8-bit Green data
LCD_B[7:0]OData: 8-bit Blue data

The LCD-TFT controller pins must be configured by the user application. The unused pins can be used for other purposes.

For LTDC outputs up to 24-bit (RGB888), if less than 8bpp are used to output for example RGB565 or RGB666 to interface on 16b-bit or 18-bit displays, the RGB display data lines must be connected to the MSB of the LCD-TFT controller RGB data lines. As an example, in the case of an LCD-TFT controller interfacing with a RGB565 16-bit display, the LCD display R[4:0], G[5:0] and B[4:0] data lines pins must be connected to LCD-TFT controller LCD_R[7:3], LCD_G[7:2] and LCD_B[7:3].

16.4 LTDC programmable parameters

The LCD-TFT controller provides flexible configurable parameters. It can be enabled or disabled through the LTDC_GCR register.

16.4.1 LTDC Global configuration parameters

Synchronous Timings:

Figure 82 presents the configurable timing parameters generated by the Synchronous Timings Generator block presented in the block diagram Figure 81. It generates the Horizontal and Vertical Synchronization timings panel signals, the Pixel Clock and the Data Enable signals.

Figure 82. LCD-TFT Synchronous timings

Timing diagram for LCD-TFT Synchronous timings showing horizontal and vertical synchronization, back porch, active display area, and front porch.

The diagram illustrates the timing parameters for an LCD-TFT display. It shows a horizontal timeline at the top and a vertical timeline on the left. The horizontal timeline includes HSYNC width, HBP (Horizontal Back Porch), Active width, and HFP (Horizontal Front Porch). The vertical timeline includes VSYNC width, VBP (Vertical Back Porch), Active height, and VFP (Vertical Front Porch). The total width and total height are indicated by dashed lines. The active display area is a shaded rectangle containing 'Data1, Line1' at the top left and 'Data(n), Line(n)' at the bottom right. The reference code 'MSv19674V1' is located in the bottom right corner of the diagram area.

Timing diagram for LCD-TFT Synchronous timings showing horizontal and vertical synchronization, back porch, active display area, and front porch.

Note: The HBP and HFP are respectively the Horizontal back porch and front porch period.
The VBP and the VFP are respectively the Vertical back porch and front porch period.

The LCD-TFT programmable synchronous timings are:

Note: When the LTDC is enabled, the timings generated start with X/Y=0/0 position as the first horizontal synchronization pixel in the vertical synchronization area and following the back porch, active data display area and the front porch.

When the LTDC is disabled, the timing generator block is reset to X = Total Width-1, Y = Total Height-1 and held the last pixel before the vertical synchronization phase and the FIFO are flushed. Therefore only blanking data is output continuously.

Example of Synchronous timings configuration

TFT-LCD timings (should be extracted from Panel datasheet):

The programmed values in the LTDC timings registers are:

Programmable polarity

The Horizontal and Vertical Synchronization, Data Enable and Pixel Clock output signals polarity can be programmed to active high or active low through the LTDC_GCR register.

Background Color

A constant background color (RGB888) can be programmed through the LTDC_BCCR register. It is used for blending with the bottom layer.

Dithering

The Dithering pseudo-random technique using an LFSR is used to add a small random value (threshold) to each pixel color channel (R, G or B) value, thus rounding up the MSB in some cases when displaying a 24-bit data on 18-bit display. Thus the Dithering technique is used to round data which is different from one frame to the other.

The Dither pseudo-random technique is the same as comparing LSBs against a threshold value and adding a 1 to the MSB part only, if the LSB part is ≥ the threshold. The LSBs are typically dropped once dithering was applied.

The width of the added pseudo-random value is 2 bits for each color channel; 2 bits for Red, 2 bits for Green and 2 bits for Blue.

Once the LCD-TFT controller is enabled, the LFSR starts running with the first active pixel and it is kept running even during blanking periods and when dithering is switched off. If the LTDC is disabled, the LFSR is reset.

The Dithering can be switched On and Off on the fly through the LTDC_GCR register.

Reload Shadow registers

Some configuration registers are shadowed. The shadow registers values can be reloaded immediately to the active registers when writing to these registers or at the beginning of the vertical blanking period following the configuration in the LTDC_SRCR register. If the immediate reload configuration is selected, the reload should be only activated when all new registers have been written.

The shadow registers should not be modified again before the reload has been done. Reading from the shadow registers returns the actual active value. The new written value can only be read after the reload has taken place.

A register reload interrupt can be generated if enabled in the LTDC_IER register.

The shadowed registers are all the Layer 1 and Layer 2 registers except the LTDC_LxCLUTWR register.

Interrupt generation event

Refer to Section 16.5: LTDC interrupts for interrupt configuration.

16.4.2 Layer programmable parameters

Up to two layers can be enabled, disabled and configured separately. The layer display order is fixed and it is bottom up. If two layers are enabled, the Layer2 is the top displayed window.

Windowing

Every layer can be positioned and resized and it must be inside the Active Display area.

The window position and size are configured through the top-left and bottom-right X/Y positions and the Internal timing generator which includes the synchronous, back porch size and the active data area. Refer to LTDC_LxWHPCR and LTDC_WVPCR registers.

The programmable layer position and size defines the first/last visible pixel of a line and the first/last visible line in the window. It allows to display either the full image frame or only a part of the image frame. Refer to Figure 83

Figure 83. Layer window programmable parameters:

Diagram illustrating Layer window programmable parameters. A central yellow rectangle labeled 'Window' is positioned within a larger gray area labeled 'Active data area'. Four dimension lines with arrows indicate the window's position and size: 'WVSTPOS bits in LTDC_LxWVPCR' (top), 'WHSTPOS bits in LTDC_LxWHPCR' (left), 'WVSPPOS bits in LTDC_LxWVPCR' (right), and 'WHSPPOS bits in LTDC_LxWHPCR' (bottom). The reference 'MSv19676V3' is in the bottom right corner.
Diagram illustrating Layer window programmable parameters. A central yellow rectangle labeled 'Window' is positioned within a larger gray area labeled 'Active data area'. Four dimension lines with arrows indicate the window's position and size: 'WVSTPOS bits in LTDC_LxWVPCR' (top), 'WHSTPOS bits in LTDC_LxWHPCR' (left), 'WVSPPOS bits in LTDC_LxWVPCR' (right), and 'WHSPPOS bits in LTDC_LxWHPCR' (bottom). The reference 'MSv19676V3' is in the bottom right corner.

Pixel input Format

The programmable pixel format is used for the data stored in the frame buffer of a layer.

Up to 8 input pixel formats can be configured for every layer through the LTDC_LxPFCR register

The pixel data is read from the frame buffer and then transformed to the internal 8888 (ARGB) format as follows:

The figure below describes the pixel data mapping depending on the selected format.

Table 90. Pixel Data mapping versus Color Format

ARGB8888
@+3
Ax[7:0]
@+2
Rx[7:0]
@+1
Gx[7:0]
@
Bx[7:0]
@+7
Ax+1[7:0]
@+6
Rx+1[7:0]
@+5
Gx+1[7:0]
@+4
Bx+1[7:0]
RGB888
@+3
Bx+1[7:0]
@+2
Rx[7:0]
@+1
Gx[7:0]
@
Bx[7:0]
@+7
Gx+2[7:0]
@+6
Bx+2[7:0]
@+5
Rx+1[7:0]
@+4
Gx+1[7:0]
RGB565
@+3
Rx+1[4:0] Gx+1[5:3]
@+2
Gx+1[2:0] Bx+1[4:0]
@+1
Rx[4:0] Gx[5:3]
@
Gx[2:0] Bx[4:0]

Table 90. Pixel Data mapping versus Color Format (continued)

ARGB8888
@+7
Rx+3[4:0] Gx+3[5:3]
@+6
Gx+3[2:0] Bx+3[4:0]
@+5
Rx+2[4:0] Gx+2[5:3]
@+4
Gx+2[2:0] Bx+2[4:0]
ARGB1555
@+3
Ax+1[0]Rx+1[4:0]
Gx+1[4:3]
@+2
Gx+1[2:0] Bx+1[4:0]
@+1
Ax[0] Rx[4:0] Gx[4:3]
@
Gx[2:0] Bx[4:0]
@+7
Ax+3[0]Rx+3[4:0]
Gx+3[4:3]
@+6
Gx+3[2:0] Bx+3[4:0]
@+5
Ax+2[0]Rx+2[4:0]Gx+2[4:3]
@+4
Gx+2[2:0] Bx+2[4:0]
ARGB4444
@+3
Ax+1[3:0]Rx+1[3:0]
@+2
Gx+1[3:0] Bx+1[3:0]
@+1
Ax[3:0] Rx[3:0]
@
Gx[3:0] Bx[3:0]
@+7
Ax+3[3:0]Rx+3[3:0]
@+6
Gx+3[3:0] Bx+3[3:0]
@+5
Ax+2[3:0]Rx+2[3:0]
@+4
Gx+2[3:0] Bx+2[3:0]
L8
@+3
Lx+3[7:0]
@+2
Lx+2[7:0]
@+1
Lx+1[7:0]
@
Lx[7:0]
@+7
Lx+7[7:0]
@+6
Lx+6[7:0]
@+5
Lx+5[7:0]
@+4
Lx+4[7:0]
AL44
@+3
Ax+3[3:0] Lx+3[3:0]
@+2
Ax+2[3:0] Lx+2[3:0]
@+1
Ax+1[3:0] Lx+1[3:0]
@
Ax[3:0] Lx[3:0]
@+7
Ax+7[3:0] Lx+7[3:0]
@+6
Ax+6[3:0] Lx+6[3:0]
@+5
Ax+5[3:0] Lx+5[3:0]
@+4
Ax+4[3:0] Lx+4[3:0]
AL88
@+3
Ax+1[7:0]
@+2
Lx+1[7:0]
@+1
Ax[7:0]
@
Lx[7:0]
@+7
Ax+3[7:0]
@+6
Lx+3[7:0]
@+5
Ax+2[7:0]
@+4
Lx+2[7:0]

Color Look-Up Table (CLUT)

The CLUT can be enabled at run-time for every layer through the LTDC_LxCR register and it is only useful in case of indexed color when using the L8, AL44 and AL88 input pixel format.

First, the CLUT has to be loaded with the R, G and B values that replace the original R, G, B values of that pixel (indexed color). Each color (RGB value) has its own address which is the position within the CLUT.

The R, G and B values and their own respective address are programmed through the LTDC_LxCLUTWR register.

Color Frame Buffer Address

Every Layer has a start address for the color frame buffer configured through the LTDC_LxCFBAR register.

When a layer is enabled, the data is fetched from the Color Frame Buffer.

Color Frame Buffer Length

Every layer has a total line length setting for the color frame buffer in bytes and a number of lines in the frame buffer configurable in the LTDC_LxCFBLR and LTDC_LxCFBLNR register respectively.

The line length and the number of lines settings are used to stop the prefetching of data to the layer FIFO at the end of the frame buffer.

Color Frame Buffer Pitch

Every layer has a configurable pitch for the color frame buffer, which is the distance between the start of one line and the beginning of the next line in bytes. It is configured through the LTDC_LxCFBLR register.

Layer Blending

The blending is always active and the two layers can be blended following the blending factors configured through the LTDC_LxBFCR register.

The blending order is fixed and it is bottom up. If two layers are enabled, first the Layer1 is blended with the Background color, then the Layer2 is blended with the result of blended color of Layer1 and the background. Refer to Figure 84.

Figure 84. Blending two layers with background

Diagram showing the blending process of two layers with a background. It consists of three stages: 1. Initial state with three separate planes: Layer 2 (top, light blue), Layer 1 (middle, light blue), and BG (bottom, purple). 2. Intermediate state where Layer 1 and BG are combined into a single plane labeled 'Layer 1 + BG' (light blue), while Layer 2 remains separate. 3. Final state where Layer 2 and the combined 'Layer 1 + BG' are blended into a single plane labeled 'Layer 2 + Layer 1 + BG' (light blue). Brackets indicate the grouping of layers at each stage. The reference code 'MS19677V1' is located in the bottom right corner of the diagram area.
Diagram showing the blending process of two layers with a background. It consists of three stages: 1. Initial state with three separate planes: Layer 2 (top, light blue), Layer 1 (middle, light blue), and BG (bottom, purple). 2. Intermediate state where Layer 1 and BG are combined into a single plane labeled 'Layer 1 + BG' (light blue), while Layer 2 remains separate. 3. Final state where Layer 2 and the combined 'Layer 1 + BG' are blended into a single plane labeled 'Layer 2 + Layer 1 + BG' (light blue). Brackets indicate the grouping of layers at each stage. The reference code 'MS19677V1' is located in the bottom right corner of the diagram area.

Default color

Every layer can have a default color in the format ARGB which is used outside the defined layer window or when a layer is disabled.

The default color is configured through the LTDC_LxDCCR register.

The blending is always performed between the two layers even when a layer is disabled. To avoid displaying the default color when a layer is disabled, keep the blending factors of this layer in the LTDC_LxBFCR register to their reset value.

Color Keying

A color key (RGB) can be configured to be representative for a transparent pixel.

If the Color Keying is enabled, the current pixels (after format conversion and before blending) are compared to the color key. If they match for the programmed RGB value, all channels (ARGB) of that pixel are set to 0.

The Color Key value can be configured and used at run-time to replace the pixel RGB value.

The Color Keying is enabled through the LTDC_LxCKCR register.

16.5 LTDC interrupts

The LTDC provides four maskable interrupts logically ORed to two interrupt vectors.

The interrupt sources can be enabled or disabled separately through the LTDC_IER register. Setting the appropriate mask bit to 1 enables the corresponding interrupt.

The two interrupts are generated on the following events:

Those interrupts events are connected to the NVIC controller as described in the figure below.

Figure 85. Interrupt events

Logic diagram showing OR gates for LTDC global interrupt and LTDC global error interrupt.

The diagram illustrates the logic for generating LTDC interrupts. It consists of two OR gates. The first OR gate has two inputs: 'Line' and 'Register reload', and its output is 'LTDC global interrupt'. The second OR gate has two inputs: 'FIFO underrun' and 'Transfer error', and its output is 'LTDC global error interrupt'. The reference code 'MS19678V1' is located in the bottom right corner of the diagram area.

Logic diagram showing OR gates for LTDC global interrupt and LTDC global error interrupt.

Table 91. LTDC interrupt requests

Interrupt eventEvent flagEnable Control bit
LineLIFLIE
Register ReloadRRIFRRIEN
FIFO UnderrunFUDERRIFFUDERRIE
Transfer ErrorTERRIFTERRIE

16.6 LTDC programming procedure

Note: All layer's registers are shadowed. Once a register is written, it should not be modified again before the reload has been done. Thus, a new write to the same register overrides the previous configuration if not yet reloaded.

16.7 LTDC registers

16.7.1 LTDC Synchronization Size Configuration Register (LTDC_SSCR)

This register defines the number of Horizontal Synchronization pixels minus 1 and the number of Vertical Synchronization lines minus 1. Refer to Figure 82 and Section 16.4: LTDC programmable parameters for an example of configuration.

Address offset: 0x08

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedHSW[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedVSH[10:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value

Bits 27:16 HSW[11:0]: Horizontal Synchronization Width (in units of pixel clock period)
These bits define the number of Horizontal Synchronization pixel minus 1.

Bits 15:11 Reserved, must be kept at reset value

Bits 10:0 VSH[10:0]: Vertical Synchronization Height (in units of horizontal scan line)
These bits define the vertical Synchronization height minus 1. It represents the number of horizontal synchronization lines.

16.7.2 LTDC Back Porch Configuration Register (LTDC_BPCR)

This register defines the accumulated number of Horizontal Synchronization and back porch pixels minus 1 (HSYNC Width + HBP - 1) and the accumulated number of Vertical Synchronization and back porch lines minus 1 (VSYNC Height + VBP - 1). Refer to Figure 82 and Section 16.4: LTDC programmable parameters for an example of configuration.

Address offset: 0x0C

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedAHBP[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedAVBP[10:0]
rwrwrwrwrwrwrwrwrwrwrwrw

16.7.3 LTDC Active Width Configuration Register (LTDC_AWCR)

This register defines the accumulated number of Horizontal Synchronization, back porch and Active pixels minus 1 (HSYNC width + HBP + Active Width - 1) and the accumulated number of Vertical Synchronization, back porch lines and Active lines minus 1 (VSYNC Height+ BVBP + Active Height - 1). Refer to Figure 82 and Section 16.4: LTDC programmable parameters for an example of configuration.

Address offset: 0x10

Reset value: 0x0000 0000

Register bit layout diagram for LTDC_AWCR showing bit positions 31 to 0. Bits 31-16 are Reserved. Bits 15-12 are Reserved. Bits 11-0 are AAW[11:0] (Accumulated Active Width). Bits 10-0 are AAH[10:0] (Accumulated Active Height).
31302928272625242322212019181716
ReservedAAW[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedAAH[10:0]
rwrwrwrwrwrwrwrwrwrwrwrw
Register bit layout diagram for LTDC_AWCR showing bit positions 31 to 0. Bits 31-16 are Reserved. Bits 15-12 are Reserved. Bits 11-0 are AAW[11:0] (Accumulated Active Width). Bits 10-0 are AAH[10:0] (Accumulated Active Height).
ST logo
ST logo

16.7.4 LTDC Total Width Configuration Register (LTDC_TWCR)

This register defines the accumulated number of Horizontal Synchronization, back porch, Active and front porch pixels minus 1 (HSYNC Width + HBP + Active Width + HFP - 1) and the accumulated number of Vertical Synchronization, back porch lines, Active and Front lines minus 1 (VSYNC Height+ BVBP + Active Height + VFP - 1). Refer to Figure 82 and Section 16.4: LTDC programmable parameters for an example of configuration.

Address offset: 0x14

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedTOTALW[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1614131211109876543210
ReservedTOTALH[10:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value

Bits 27:16 TOTALW[11:0]: Total Width (in units of pixel clock period)

These bits defines the accumulated Total Width which includes the Horizontal Synchronization, Horizontal back porch, Active Width and Horizontal front porch pixels minus 1.

Bits 15:11 Reserved, must be kept at reset value

Bits 10:0 TOTALH[10:0]: Total Height (in units of horizontal scan line)

These bits defines the accumulated Height which includes the Vertical Synchronization, Vertical back porch, the Active Height and Vertical front porch Height lines minus 1.

16.7.5 LTDC Global Control Register (LTDC_GCR)

This register defines the global configuration of the LCD-TFT controller.

Address offset: 0x18

Reset value: 0x0000 2220

31302928272625242322212019181716
HSPOLVSPOLDEPOLPCPOLReservedDEN
rwrwrwrwrw
1514131211109876543210
Reserve
d
DRW[2:0]Reser
ved
DGW[2:0]Reser
ved
DBW[2:0]ReservedLTDCE
rrrrrrrrrrw

16.7.6 LTDC Shadow Reload Configuration Register (LTDC_SRCR)

This register allows to reload either immediately or during the vertical blanking period, the shadow registers values to the active registers. The shadow registers are all Layer1 and Layer2 registers except the LTDC_L1CLUTWR and the LTDC_L2CLUTWR.

Address offset: 0x24

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedVBRIMR
rwrw

Bits 31:2 Reserved, must be kept at reset value

Bit 1 VBR: Vertical Blanking Reload

This bit is set by software and cleared only by hardware after reload. (it cannot be cleared through register write once it is set)

0: No effect

1: The shadow registers are reloaded during the vertical blanking period (at the beginning of the first line after the Active Display Area)

Bit 0 IMR: Immediate Reload

This bit is set by software and cleared only by hardware after reload.

0: No effect

1: The shadow registers are reloaded immediately

Note: The shadow registers read back the active values. Until the reload has been done, the 'old' value is read.

16.7.7 LTDC Background Color Configuration Register (LTDC_BCCR)

This register defines the background color (RGB888).

Address offset: 0x2C

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedBCRED[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
BCGREEN[7:0]BCBLUE[7:0]
rwrwrwrwrwrwrwrw

16.7.8 LTDC Interrupt Enable Register (LTDC_IER)

This register determines which status flags generate an interrupt request by setting the corresponding bit to 1.

Address offset: 0x34

Reset value: 0x0000 0000

Register layout diagram for LTDC_IER showing bit positions 31 to 0. Bits 31-4 are Reserved. Bits 3-0 are RRIE, TERRIE, FUIE, and LIE, all marked as rw (read/write).
31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedRRIETERRIEFUIELIE
rwrwrwrw
Register layout diagram for LTDC_IER showing bit positions 31 to 0. Bits 31-4 are Reserved. Bits 3-0 are RRIE, TERRIE, FUIE, and LIE, all marked as rw (read/write).
ST logo
ST logo

16.7.9 LTDC Interrupt Status Register (LTDC_ISR)

This register returns the interrupt status flag

Address offset: 0x38

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedRRIFTERRIFFUIFLIF
rrrr

Bits 31:24 Reserved, must be kept at reset value

Bit 3 RRIF: Register Reload Interrupt Flag

0: No Register Reload interrupt generated

1: Register Reload interrupt generated when a vertical blanking reload occurs (and the first line after the active area is reached)

Bit 2 TERRIF: Transfer Error interrupt flag

0: No Transfer Error interrupt generated

1: Transfer Error interrupt generated when a Bus error occurs

Bit 1 FUIF: FIFO Underrun Interrupt flag

0: NO FIFO Underrun interrupt generated.

1: A FIFO underrun interrupt is generated, if one of the layer FIFOs is empty and pixel data is read from the FIFO

Bit 0 LIF: Line Interrupt flag

0: No Line interrupt generated

1: A Line interrupt is generated, when a programmed line is reached

16.7.10 LTDC Interrupt Clear Register (LTDC_ICR)

Address offset: 0x3C

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedCRRIFCTERRIFCFUIFCLIF
wwww

Bits 31:24 Reserved, must be kept at reset value

16.7.11 LTDC Line Interrupt Position Configuration Register (LTDC_LIPCR)

This register defines the position of the line interrupt. The line value to be programmed depends on the timings parameters. Refer to Figure 82.

Address offset: 0x40

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedLIPOS[10:0]
rwrwrwrwrwrwrwrwrwrwrw

Bits 31:11 Reserved, must be kept at reset value

Bits 10:0 LIPOS[10:0]: Line Interrupt Position
These bits configure the line interrupt position

16.7.12 LTDC Current Position Status Register (LTDC_CPSR)

Address offset: 0x44

Reset value: 0x0000 0000

31302928272625242322212019181716
CXPOS[15:0]
rrrrrrrrrrrrrrrr
1514131211109876543210
CYPOS[15:0]
rrrrrrrrrrrrrrrr

Bits 31:16: CXPOS[15:0]: Current X Position
These bits return the current X position

Bits 15:0 CYPOS[15:0]: Current Y Position
These bits return the current Y position

16.7.13 LTDC Current Display Status Register (LTDC_CDSR)

This register returns the status of the current display phase which is controlled by the HSYNC, VSYNC, and Horizontal/Vertical DE signals.

Example: if the current display phase is the vertical synchronization, the VSYNCS bit is set (active high). If the current display phase is the horizontal synchronization, the HSYNCS bit is active high.

Address offset: 0x48

Reset value: 0x0000 000F

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedHSYNC
S
VSYNC
S
HDESVDES
rrrr

Bits 31:24 Reserved, must be kept at reset value

Bit 3 HSYNCS: Horizontal Synchronization display Status
0: Active low
1: Active high

Bit 2 VSYNCS: Vertical Synchronization display Status
0: Active low
1: Active high

Bit 1 HDES: Horizontal Data Enable display Status
0: Active low
1: Active high

Bit 0 VDES: Vertical Data Enable display Status
0: Active low
1: Active high

Note: The returned status does not depend on the configured polarity in the LTDC_GCR register, instead it returns the current active display phase.

16.7.14 LTDC Layerx Control Register (LTDC_LxCR) (where x=1..2)

Address offset: 0x84 + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedCLUTENReservedCOLKENLEN
rwrwrw

Bits 31:5 Reserved, must be kept at reset value

Bit 4 CLUTEN: Color Look-Up Table Enable

This bit is set and cleared by software.

0: Color Look-Up Table disable

1: Color Look-Up Table enable

The CLUT is only meaningful for L8, AL44 and AL88 pixel format. Refer to Color Look-Up Table (CLUT) on page 488

Bit 3 Reserved, must be kept at reset value

Bit 2 Reserved, must be kept at reset value

Bit 1 COLKEN: Color Keying Enable

This bit is set and cleared by software.

0: Color Keying disable

1: Color Keying enable

Bit 0 LEN: Layer Enable

This bit is set and cleared by software.

0: Layer disable

1: Layer enable

ST logo
ST logo

16.7.15 LTDC Layerx Window Horizontal Position Configuration Register (LTDC_LxWHPCR) (where x=1..2)

This register defines the Horizontal Position (first and last pixel) of the layer 1 or 2 window.

The first visible pixel of a line is the programmed value of AHBP[10:0] bits + 1 in the LTDC_BPCR register.

The last visible pixel of a line is the programmed value of AAW[10:0] bits in the LTDC_AWCR register.

Address offset: 0x88 + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedWHSPPOS[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedWHSTPOS[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value

Bits 27:16 WHSPPOS[11:0]: Window Horizontal Stop Position

These bits configure the last visible pixel of a line of the layer window.

The following condition must be respected:

\(WHSPPOS[11:0] \geq AHBP[10:0] \text{ bits} + 1\) (programmed in LTDC_BPCR register)

Bits 15:12 Reserved, must be kept at reset value

Bits 11:0 WHSTPOS[11:0]: Window Horizontal Start Position

These bits configure the first visible pixel of a line of the layer window.

The following condition must be respected:

\(WHSTPOS[11:0] \text{ must be } \leq AAW[10:0] \text{ bits}\) (programmed in the LTDC_AWCR register).

Example:

The LTDC_BPCR register is configured to 0x000E0005(AHBP[11:0] is 0xE) and the LTDC_AWCR register is configured to 0x028E01E5(AAW[11:0] is 0x28E). To configure the horizontal position of a window size of 630x460, with horizontal start offset of 5 pixels in the Active data area.

  1. 1. Layer window first pixel: WHSTPOS[11:0] should be programmed to 0x14 (0xE+1+0x5)
  2. 2. Layer window last pixel: WHSPPOS[11:0] should be programmed to 0x28A

16.7.16 LTDC Layerx Window Vertical Position Configuration Register (LTDC_LxWVPCR) (where x=1..2)

This register defines the vertical position (first and last line) of the layer1 or 2 window.

The first visible line of a frame is the programmed value of AVBP[10:0] bits + 1 in the register LTDC_BPCR register.

The last visible line of a frame is the programmed value of AAH[10:0] bits in the LTDC_AWCR register.

Address offset: 0x8C + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedWVSPPOS[10:0]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedWVSTPOS[10:0]
rwrwrwrwrwrwrwrwrwrwrw

Bits 31:27 Reserved, must be kept at reset value

Bits 26:16 WVSPPOS[10:0]: Window Vertical Stop Position

These bits configures the last visible line of the layer window.

The following condition must be respected:

WHSPPOS[11:0] must be ≥ AVBP[10:0] bits + 1 (programmed in LTDC_BPCR register)

Bits 15:11 Reserved, must be kept at reset value

Bits 10:0 WVSTPOS[10:0]: Window Vertical Start Position

These bits configure the first visible line of the layer window.

The following condition must be respected:

WHSTPOS[11:0] must be ≤ AAH[10:0] bits (programmed in the LTDC_AWCR register)

Example:

The LTDC_BPCR register is configured to 0x000E0005 (AVBP[10:0] is 0x5) and the LTDC_AWCR register is configured to 0x028E01E5 (AAH[10:0] is 0x1E5). To configure the vertical position of a window size of 630x460, with vertical start offset of 8 lines in the Active data area:

  1. 1. Layer window first line: WVSTPOS[10:0] should be programmed to 0xE (0x5+1+0x8)
  2. 2. Layer window last line: WVSPPOS[10:0] should be programmed to 0x1DA

16.7.17 LTDC Layerx Color Keying Configuration Register (LTDC_LxCKCR)
(where x=1..2)

This register defines the color key value (RGB), which is used by the Color Keying.

Address offset: 0x90+0x80 × (Layerx-1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedCKRED[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
CKGREEN[7:0]CKBLUE[7:0]
rwrwrwrwrwrwrwrwrw

Bits 31:24 Reserved, must be kept at reset value

Bits 23:16 CKRED[7:0]: Color Key Red value

Bits 15:8 CKGREEN[7:0]: Color Key Green value

Bits 7:0 CKBLUE[7:0]: Color Key Blue value

16.7.18 LTDC Layerx Pixel Format Configuration Register (LTDC_LxPFCR)
(where x=1..2)

This register defines the pixel format which is used for the stored data in the frame buffer of a layer. The pixel data is read from the frame buffer and then transformed to the internal format 8888 (ARGB).

Address offset: 0x94+0x80 × (Layerx-1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedPF[2:0]
rwrwrw

Bits 31:3 Reserved, must be kept at reset value

Bits 2:0 PF[2:0]: Pixel Format

These bits configures the Pixel format

16.7.19 LTDC Layerx Constant Alpha Configuration Register (LTDC_LxCACR) (where x=1..2)

This register defines the constant alpha value (divided by 255 by Hardware), which is used in the alpha blending. Refer to LTDC_LxBFCR register.

Address offset: 0x98 + 0x80 x (Layerx - 1), Layerx = 1 or 2

Reset value: (Layerx - 1) 0x0000 00FF

Register layout diagram for LTDC_LxCACR. It shows a 32-bit register with bits 31:8 reserved and bits 7:0 labeled CONSTA[7:0] with 'rw' access for each bit.
31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedCONSTA[7:0]
rwrwrwrwrwrwrwrw
Register layout diagram for LTDC_LxCACR. It shows a 32-bit register with bits 31:8 reserved and bits 7:0 labeled CONSTA[7:0] with 'rw' access for each bit.

Bits 31:8 Reserved, must be kept at reset value

Bits 7:0 CONSTA[7:0]: Constant Alpha

These bits configure the Constant Alpha used for blending. The Constant Alpha is divided by 255 by hardware.

Example: if the programmed Constant Alpha is 0xFF, the Constant Alpha value is 255/255=1

16.7.20 LTDC Layerx Default Color Configuration Register (LTDC_LxDCCR) (where x=1..2)

This register defines the default color of a layer in the format ARGB. The default color is used outside the defined layer window or when a layer is disabled. The reset value of 0x00000000 defines a transparent black color.

Address offset: 0x9C + 0x80 x (Layerx - 1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
DCALPHA[7:0]DCRED[7:0]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
DCGREEN[7:0]DCBLUE[7:0]
rwrwrwrwrwrwrwrwrw

16.7.21 LTDC Layerx Blending Factors Configuration Register (LTDC_LxBFCR) (where x=1..2)

This register defines the blending factors F1 and F2.

The general blending formula is: BC = BF1 × C+BF2 × Cs

Address offset: 0xA0 + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0607

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedBF1[2:0]ReservedBF2[2:0]
rwrwrwrwrwrw

Bits 31:11 Reserved, must be kept at reset value

Bits 10:8 BF1[2:0]: Blending Factor 1
These bits select the blending factor F1
000: Reserved
001: Reserved
010: Reserved
011: Reserved
100: Constant Alpha
101: Reserved
110: Pixel Alpha x Constant Alpha
111:Reserved

Bits 7:3 Reserved, must be kept at reset value

Bits 2:0 BF2[2:0]: Blending Factor 2
These bits select the blending factor F2
000: Reserved
001: Reserved
010: Reserved
011: Reserved
100: Reserved
101: 1 - Constant Alpha
110: Reserved
111: 1 - (Pixel Alpha x Constant Alpha)

ST logo
ST logo

Note: The Constant Alpha value, is the programmed value in the LxCACR register divided by 255 by hardware.

Example: Only layer1 is enabled, BF1 configured to Constant Alpha

BF2 configured to 1 - Constant Alpha

Constant Alpha: The Constant Alpha programmed in the LxCACR register is 240 (0xF0). Thus, the Constant Alpha value is 240/255 = 0.94

C: Current Layer Color is 128

Cs: Background color is 48

Layer1 is blended with the background color.

BC = Constant Alpha x C + (1 - Constant Alpha) x Cs = 0.94 x 128 + (1- 0.94) x 48 = 123.

16.7.22 LTDC Layerx Color Frame Buffer Address Register (LTDC_LxCFBAR) (where x=1..2)

This register defines the color frame buffer start address which has to point to the address where the pixel data of the top left pixel of a layer is stored in the frame buffer.

Address offset: 0xAC + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
CFBADD[31:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
CFBADD[31:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 CFBADD[31:0]: Color Frame Buffer Start Address

These bits defines the color frame buffer start address.

16.7.23 LTDC Layerx Color Frame Buffer Length Register (LTDC_LxCFBLR) (where x=1..2)

This register defines the color frame buffer line length and pitch.

Address offset: 0xB0 + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
ReservedCFBP[12:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ReservedCFBLR[12:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset valuer

Bits 28:16 CFBP[12:0]: Color Frame Buffer Pitch in bytes

These bits define the pitch which is the increment from the start of one line of pixels to the start of the next line in bytes.

Bits 15:13 Reserved, must be kept at reset value

Bits 12:0 CFBLL[12:0]: Color Frame Buffer Line Length

These bits define the length of one line of pixels in bytes + 3.

The line length is computed as follows: Active high width x number of bytes per pixel + 3.

Example:

16.7.24 LTDC Layerx ColorFrame Buffer Line Number Register (LTDC_LxCFBLNR) (where x=1..2)

This register defines the number of lines in the color frame buffer.

Address offset: 0xB4 + 0x80 x (Layerx -1), Layerx = 1 or 2

Reset value: 0x0000 0000

Register layout diagram for LTDC_LxCFBLNR. Bits 31 to 16 are reserved. Bits 15 to 11 are reserved. Bits 10 to 0 are CFBLNBR[10:0], which are read-write (rw) fields.
31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedCFBLNBR[10:0]
rwrwrwrwrwrwrwrwrwrwrw
Register layout diagram for LTDC_LxCFBLNR. Bits 31 to 16 are reserved. Bits 15 to 11 are reserved. Bits 10 to 0 are CFBLNBR[10:0], which are read-write (rw) fields.

Bits 31:11 Reserved, must be kept at reset value

Bits 10:0 CFBLNBR[10:0]: Frame Buffer Line Number

These bits define the number of lines in the frame buffer which corresponds to the Active high width.

Note: The number of lines and line length settings define how much data is fetched per frame for every layer. If it is configured to less bytes than required, a FIFO underrun interrupt is generated if enabled.

The start address and pitch settings on the other hand define the correct start of every line in memory.

16.7.25 LTDC Layerx CLUT Write Register (LTDC_LxCLUTWR)
(where x=1..2)

This register defines the CLUT address and the RGB value.

Address offset: 0xC4+0x80 × (Layerx-1), Layerx = 1 or 2

Reset value: 0x0000 0000

31302928272625242322212019181716
CLUTADD[7:0]RED[7:0]
wwwwwwwwwwwwwwww
1514131211109876543210
GREEN[7:0]BLUE[7:0]
wwwwwwwwwwwwwwww

Bits 31:24 CLUTADD[7:0]: CLUT Address

These bits configure the CLUT address (color position within the CLUT) of each RGB value

Bits 23:16 RED[7:0]: Red value

These bits configure the red value

Bits 15:8 GREEN[7:0]: Green value

These bits configure the green value

Bits 7:0 BLUE[7:0]: Blue value

These bits configure the blue value

Note: The CLUT write register should only be configured during blanking period or if the layer is disabled. The CLUT can be enabled or disabled in the LTDC_LxCR register.
The CLUT is only meaningful for L8, AL44 and AL88 pixel format.

16.7.26 LTDC register map

The following table summarizes the LTDC registers. Refer to the register boundary addresses table for the LTDC register base address.

Table 92. LTDC register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0008LTDC_SSCRReservedHSW[9:0]ReservedVSH[10:0]
Reset value0000000000000000000000
0x000CLTDC_BPCRReservedAHBP[11:0]ReservedAVBP[10:0]
Reset value0000000000000000000000
0x0010LTDC_AWCRReservedAAV[11:0]ReservedAAH[10:0]
Reset value0900000000000000000000
0x0014LTDC_TWCRReservedTOTALW[11:0]ReservedTOTALH[10:0]
Reset value0000000000000000000000
0x0018LTDC_GCRHSPOLVSPOLDEPOLPCPOLReserveDENReservedDRW[2:0]ReservedDGW[2:0]ReservedDBW[2:0]ReservedLTDCEN
Reset value000000100100100
0x0024LTDC_SRCRReservedVBRIMR
Reset value00
0x002CLTDC_BCCRReservedBC[23:0]
Reset value000000000000000000000000
0x0034LTDC_IERReservedRRIETERRIE
Reset value00
0x0038LTDC_ISRReservedRRIFTERRIF
Reset value00
0x003CLTDC_ICRReservedCRRIECTERRIF
Reset value00
0x0040LTDC_LIPCRReservedLIPOS[10:0]
Reset value0000000000000
0x0044LTDC_CPSRCXPOS[15:0]CYPOS[15:0]
Reset value0000000000000000000000000000000
0x0048LTDC_CDSRReservedHSYNCSVSYNCS
Reset value11
0x0084LTDC_L1CRReservedCLUTENCOLKEN
Reset value00
0x0088LTDC_L1WHPCRReservedWHSPPOS[11:0]ReservedWHSTPOS[11:0]
Reset value0000000000000000000000
ST logo
ST logo

Table 92. LTDC register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x008CLTDC_L1WVPCRReservedWVSPPOS[10:0]ReservedWVSTPOS[10:0]
Reset value0000000000000000000000
0x0090LTDC_L1CKCRReservedCKRED[7:0]CKGREEN[7:0]CKBLUE[7:0]
Reset value000000000000000000000000
0x0094LTDC_L1PFCRReservedPF[2:0]
Reset value000
0x0098LTDC_L1CACRReservedCONSTA[7:0]
Reset value11111111
0x009CLTDC_L1DCCRDCALPHA[7:0]DCRED[7:0]DCGREEN[7:0]DCBLUE[7:0]
Reset value00000000000000000000000000000000
0x00A0LTDC_L1BFCRReservedBF1[2:0]ReservedBF2[2:0]
Reset value110111
0x00ACLTDC_L1CFBARCFBADD[31:0]
Reset value00000000000000000000000000000000
0x00B0LTDC_L1CFBLRReservedCFBP[12:0]ReservedCFBLL[12:0]
Reset value00000000000000000000000000
0x00B4LTDC_L1CFBLNRReservedCFBLNBR[10:0]
Reset value00000000000
0x00C4LTDC_L1CLUTWRCLUTADD[7:0]RED[7:0]GREEN[7:0]BLUE[7:0]
Reset value00000000000000000000000000000000
0x0104LTDC_L2CRReservedCLUTENReservedCOLKENLEN
Reset value000
0x0108LTDC_L2WHPCRReservedWHSPPOS[11:0]ReservedWHSTPOS[11:0]
Reset value000000000000000000000000
0x010CLTDC_L2WVPCRReservedWVSPPOS[10:0]ReservedWVSTPOS[10:0]
Reset value0000000000000000000000
0x0110LTDC_L2CKCRReservedCKRED[7:0]CKGREEN[7:0]CKBLUE[7:0]
Reset value000000000000000000000000
0x0114LTDC_L2PFCRReservedPF[2:0]
Reset value000
0x0118LTDC_L2CACRReservedCONSTA[7:0]
Reset value11111111
0x011CLTDC_L2DCCRDCALPHA[7:0]DCRED[7:0]DCGREEN[7:0]DCBLUE[7:0]
Reset value00000000000000000000000000000000
0x0120LTDC_L2BFCRReservedBF1[2:0]ReservedBF2[2:0]
Reset value110111
0x012CLTDC_L2CFBARCFBADD[31:0]
Reset value00000000000000000000000000000000
0x0130LTDC_L2CFBLRReservedCFBP[12:0]ReservedCFBLL[12:0]
Reset value00000000000000000000000000

Table 92. LTDC register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0134LTDC_L2CFBLNRReservedCFBLNBR[10:0]
Reset value0000000000
0x0144LTDC_L2CLUTWRCLUTADD[7:0]RED[7:0]GREEN[7:0]BLUE[7:0]
Reset value00000000000000000000000000000000
ST logo
ST logo