En DM00338361
En DM00338361
En DM00338361
Application note
Using the Chrom-ART Accelerator™ (DMA2D) to refresh an
LCD-TFT display on STM32L496xx/L4A6xx microcontrollers
Introduction
The purpose of this application note is to highlight how to refresh a LCD-TFT display via the
FSMC interface using the Chrom-ART Accelerator™ (DMA2D) on STM32L496xx/L4A6xx
microcontrollers.
The STM32L496xx/L4A6xx microcontrollers implement a Chrom-Art Accelerator™
(DMA2D) that is a specialized DMA dedicated to image manipulation.
It can perform the following operations:
• Filling a part or the whole of a destination image with a specific color
• Copying a part or the whole of a source image into a part or the whole of a destination
image with a pixel format conversion
• Blending a part and/or two complete source images with a different pixel format and
copying the result into a part or the whole of a destination image with a different color
format.
On the STM32L496xx/L4A6xx microcontrollers, the Flexible Static Memory Controller
(FSMC) is used to access the LCD-TFT display with a parallel interface.
This application note provides an explanation on:
• How to connect the LCD-TFT display on the FSMC interface
• How to configure the DMA2D for the LCD-TFT display refresh
To fully benefit from this application note, the user should be familiar with the STM32
Chrom-ART Accelerator™ (DMA2D) as described in the STM32L4x6 advanced ARM®-
based 32-bit MCUs reference manual (RM0351) available from the STMicroelectronics
website www.st.com.
Reference documents
• STM32L4x6 advanced ARM®-based 32-bit MCUs reference manual (RM0351)
• Discovery kit with STM32L496AG MCU user manual (UM2160)
• Embedded software for the STM32L4 Series (STM32CubeL4)
Contents
4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
List of tables
List of figures
670/[[$[[
)UDPHEXIIHULQ
'0$' 65$0 LQWHUQDO65$0
4XDG63,
)60&
LQWHUIDFH
4XDG63, /&'7)7
)ODVK GLVSOD\
*UDSKLFDOSULPLWLYHVLQH[WHUQDO 6WHS
4XDG63,)ODVKPHPRU\ 6WHS
06Y9
The Chrom-ART Accelerator™ (DMA2D) can update the whole image on the display (full
refresh) or only a part of it (partial refresh).
The configuration of the Chrom-ART Accelerator™ (DMA2D) (full or partial refresh) is done
by programming specific registers through the high level HAL library function as shown in
Section 3: Chrom-ART Accelerator™ (DMA2D) configuration in STM32CubeL4.
'LVSOD\
9''
$*1'
3RZHUEORFN
9'',
'*1'
+RVW
&6;
5(6;
7(
'&;
,QWHUIDFHEORFN :5; ,QWHUIDFHEORFN
5';
'>@'>@RU>'>@
06Y9
µ+LJKOHYHO¶DGGUHVV FRPPDQG#
GDWD#UDQJH
[[[[[
06Y9
Using the 2nd option “an address bit of the FSMC address bus” makes the software simpler
than using the 1st option with a dedicated GPIO, but it requires using the “high level”
address to control the ‘data or command select signal’.
• The user cannot use for example the FSMC address LSB bit (FSMC_A0) to control the
‘data or command select signal’
• The user must use a “high enough” FSMC address bit in order to keep for this bit the
same value during the whole image frame buffer transfer.
/&'7)7GLVSOD\
)60&B'>@ 'DWD>@
)60&B$>[@ 'DWDFRPPDQGVHOHFWLRQ
2WKHUFRQWUROVLJQDOV
06Y9
Table 4. Minimum usable FSMC address bit depending on image size (16 bit RGB565
access)
Min usable FSMC
Image size Nb of pixels Nb of accesses Max address
address bit
/* DMA2D Initialization */
hal_status = HAL_DMA2D_Init(&Dma2dHandle);
OnError_Handler(hal_status != HAL_OK);
hal_status = HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
OnError_Handler(hal_status != HAL_OK);
}
A full refresh is of course done in the same way but initializing the LCD 1st pixel at (0, 0) and
the image size to the LCD size.
LCD_ImagePreparation(0, 0, ST7789H2_LCD_PIXEL_WIDTH,
ST7789H2_LCD_PIXEL_HEIGHT);
And changing the number of pixels to be transferred in the DMA2D start command:
hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle,
(uint32_t)&RGB565_240x240, /* Source buffer in format RGB565 and size
240x240 */
(uint32_t)&(LCD_ADDR->REG), /* LCD data address */
1,
ST7789H2_LCD_PIXEL_HEIGHT * ST7789H2_LCD_PIXEL_WIDTH); /* number of pixel
to transfer */
OnError_Handler(hal_status != HAL_OK);
4 Conclusion
This application note gives a guideline to easily transfer images to an LCD-TFT display via
the FSMC interface using the Chrom-ART Accelerator™ (DMA2D) without using the CPU or
the DMA resources. A focus is given to the correct control of the 'Data/command control'
signal of the LCD-TFT display. Some code examples have also been provided to setup the
Chrom-ART Accelerator™ (DMA2D).
5 Revision history
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.