Skip to main content

Engine Architecture

Graphics is ultimately about getting something to show up on a physical display. Fast.

The term embedded graphics means many things.

First of, the word embedded means different things to different people. To some an embedded system means a very dependable old 8 bit microcontroller, with no operating system, and virtually no RAM, ROM or GPIO. To others it might mean a modern day smart phone with gigabytes of everything.

Secondly, the word graphics has many interpretations. To some it means drawing your own pixels in your favourite painting program. To others again it means the 3D rendering software running on your gaming console.

To TouchGFX embedded systems mean any system based on an STM32 microcontroller. And graphics means interactive applications running at 60 frames per second.

The four parts

In order to do graphics applications on such platforms, we consider four main components directly involved. Naturally many more components might be present in an embedded system, but these are less related to the display of graphics.

MCU, RAM, Flash and display

In short, TouchGFX, using the MCU, creates and updates an image in RAM, by assembling parts from flash. The assembled image is transferred to the display. This process is repeated as often as possible and needed.

MCU

The MCU is doing all the heavy lifting in this process. It reads images in flash and writes them to RAM. It calculates the resulting colors when merging a semi-transparent red text onto an image and saves these to RAM. It renders and stores all the pixels of a circle to RAM. And so on.

STM32 MCUs have specific capabilities that help in the realization of graphics. See MCU for details on different MCUs.

RAM

RAM is where the calculated image is stored. The RAM is being read and written by the MCU. And read again when the resulting image is transferred to the display.

In many cases the RAM is internal to the MCU. In cases where it is not feasible to have the resulting image in internal RAM, external RAM can be added to the setup.

Flash

Flash is where all static data is placed. Images, fonts and texts. The flash is read by the MCU and the contents written to or combined with the RAM.

Most often an external flash is added to the setup, as the internal flash is seldomly large enough to hold all graphics assets.

Ideally the flash is memory mapped, such that pixels can be read directly from the flash and written to RAM. Otherwise, the contents of the flash can be buffered in RAM and then read from there instead.

Display

The display is where the image is actually displayed to the eyes of a person.

The image stored in RAM is sent by the MCU to the display at regular intervals.

Performance

In order to achieve smooth animations on this setup and ultimately on the display, some care must be taken when doing embedded graphics.

General strategy

A few general points to always consider:

  • Do not spend time drawing things that do not change
  • Transfer as little as possible from flash to RAM
  • Transfer as little as possible from RAM to display
  • Find the right balance between quality of graphics and speed of animations
  • Utilize hardware capabilities

The TouchGFX Engine helps address all of these points, but care must be taken by the developer as well.

Setup specific strategy

The vast amount of possible embedded setups means that what can be realized on a specific setup is very different to what is possible on another setup.

A ballpark'ish overview of possible setups are

  • STM32 MCU
    • 50 to 500 MHz clock rate
    • A possible range of graphics related IP's: Chrom-ART, Chrom-GRC, JPEG codec, ...
  • RAM
    • 0 to 1 MB internal
    • 0 to 100 MB external
  • Flash
    • 0 to 1 MB internal
    • 0 to 1 GB external
  • Display
    • 1 to 24 bit colors
    • 100x100 to 1000x1000 pixels

It is evident that the UI applications that are realizable on one possible setup, might not be nowhere near realizable on another. Therefore great care must be taken to align the desired UI application with the actual setup.

TouchGFX is designed from the ground up for these setups, focusing on making the most of the STM32 MCU capabilities and minimizing the amount of RAM and flash needed.

Further reading
  • See STM32 32-bit Arm Cortex MCUs for available STM32 microcontrollers.
  • See Display for details on the possible display choices.
  • See MCU for details on the possible MCU choices.
  • See External Memories for details on the possible choices for memory.