Library 51- Chrom-ART Accelerator (DMA2D) graphic library on STM32F429-Discovery

ST’s Chrom-ARTTM Accelerator function or DMA2D is supported in this library. This is powerful tool in STM32F429/39 or STM32F427/29 devices. It is based on DMA transmission from graphic to memory in top possible speed. This can be used to draw moving objects, rectangles, circles very fast without a lot of work.

My DMA2D GRAPHIC library was designed in a way that can support any LCD. Because anything that DMA2D knows is writing “data” (color) in memory at some locations. You still need some way to transmit data from memory to LCD. So library was designed that you can custom set start memory address, LCD width, LCD height and LCD orientation. Then the magic to writing in memory can start.

In case of STM32F429-Discovery, external SD-RAM is connected to MCU. In this case, SD-RAM has some logical address, in our case is 0xD0000000. DMA2D just knows that there is starting address and that LCD is 240px width and 320px height. When you want rectangle on x = 10, y = 10 location, library will calculate memory location where to transmit data for you.

Also, you need separate driver to transmit your data from memory to LCD. In case of STM32F429-Discovery board, LTDC periperal is in use. Again, LTDC peripheral knows start address of LCD memory (0xD0000000) and it can start work.

These 2 settings (LCD width, LCD height, memory start address) are by default set for STM32F429-Discovery compatibility, but you can set it to your needs any time. More below.

Library

Features

  • LCD independent
  • LCD orientation supported
  • Easy to port to another application with just 3 settings
  • Writing to memory with DMA2D fastest speed
  • Supported on STM32F429-Discovery board
  • Draw rectangles, lines, circles, triangles, rounded rectangles with fastest speed
  • Unlimited layers if they are supported by your peripheral to transmit data to LCD
    • In case of STM32F429-Discovery, LTDC can use 2 layers
    • Memory offset is used for new address

Dependencies

  • CMSIS
    • STM32F4xx
    • STM32F4xx RCC
    • STM32F4xx DMA2D
  • TM
    • defines.h

If you want to use this powerfull DMA2D tool on your custom application to work with memory, you need to specify some defines.

Functions and enumerations

Example

In example, DMA2D graphic library was used with connection to ILI9341 LCD via LTDC transfer from memory to LCD. DMA2D is used to draw graphic to memory.

Project available on Github, download library below.

Icon
TM STM32F4 DMA2D GRAPHIC Library

tilz0R

Owner of this site. Also electronic enthusiasts, web developer, 3D printer fan, handball player and more. Big fan of STM32F4 devices. In anticipation of the new Discovery board for STM32F7 lines.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!
  • Agnieszka Job

    Hello

    When I want use this library (I don’t use your another libraries) i have one error :

    .Objectstest2.axf: Error: L6218E: Undefined symbol main (referred from __rtentry2.o).
    Not enough information to list image symbols.

    I have no idea how to solve this problem. I use STM32f429zi, works in Keil and crteate project with your instructions.

    • Looks like you dont have main function implemented 😀

      • Agnieszka Job

        but I have

        • Agnieszka Job

          I create new project and this error disappear, but I have 13 another errors 🙁

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_Cmd (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_DitherCmd (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_Init (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_LayerAlpha (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_LayerCmd (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_LayerInit (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol LTDC_ReloadConfig (referred from tm_stm32f4_ili9341_ltdc.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol SPI_Init (referred from tm_stm32f4_spi.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol SPI_StructInit (referred from tm_stm32f4_spi.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol FMC_GetFlagStatus (referred from tm_stm32f4_sdram.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol FMC_SDRAMCmdConfig (referred from tm_stm32f4_sdram.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol FMC_SDRAMInit (referred from tm_stm32f4_sdram.o).

          .Objectstest3.axf: Error: L6218E: Undefined symbol FMC_SetRefreshCount (referred from tm_stm32f4_sdram.o).

          Not enough information to list image symbols.

          Could you tell me how can I solve this ??

          • Include FMC and LTDC Standard peripheral drivers to project.

          • Agnieszka Job

            Thanks, thanks , thanks and one more time thanks 😀

  • Pingback: All STM32F4 libraries - STM32F4 Discovery()

  • Thanut Tosanguan

    Hello Tilen,

    For some reason, I only get switching between Layer 2 and a white screen (no layer 1 objects). However, when I comment out the layer 2 codes, I get to see layer 1. How can I see switching between the two layers here. I tried library 18 and it works but not this one.

    Thanks

    • Thanut Tosanguan

      Hello Tilen,

      I found that DIS.LayerOffset in TM_DMA2DGRAPHIC_Init(void) was not set so I set it added a line
      DIS.LayerOffset = 2*DMA2D_GRAPHIC_PIXELS;
      the same offset as in LTDC example in library 18 and it works.

      • Thanks. Looks like i made bug on update. Will fix that.

  • rapid84

    Hi,
    I want to drive 320*240 tft lcd with my own board by using stm32f429 without external ram, so i have to use mcu internal ram. What ram adress do i have to define ?
    (#define DMA2D_GRAPHIC_RAM_ADDR ????????)