STM32 MCUs in GUI context
STM32 TouchGFX Workshop 2020
Agenda
1 GFX-Enablers for Rendering
2 GFX-Enablers for Display
3 STM32 Graphic ecosystem
4 TouchGFX ecosystem integration
2
3
GFX-Enablers for Rendering
Graphic sub-system overview
Input bitmaps Frame buffer Display Panel
14:21
Temperature
21°C
Humidity
-5°C
62%
ARMED
FLASH Memory RAM Memory
Update/built Partial or full
of the frame buffer Display Refresh 62% 4
Frame buffer filling complexity
• Frame drawing is a very CPU demanding operation
• Process each pixel several times per second (SVGA 800x600 : 480 000)
• Drawing involves
• Numerical computing operation (add, multiply) not logical operation
• Repetitive operations (process each pixel value)
• Many memory accesses (load/store operations)
→ Very suitable for a dedicated IP (2D engine) instead of the
general purpose Cortex™
5
STM32 Chrom-ART™ Accelerator
• More efficient than Cortex
4% CPU load with chrom-ART™, up to 84% without
• Direct DMA access to memory
• Dedicated to pixel processing
• Compare to a GPU-based approach
• Much smaller and cheaper silicon
• No extra RAM needed
• Covers 90% of “top of the line”
graphical HMI use cases Fluid motion and transparency effects
with 80% less CPU Ressources
6
Chrom-ART Features
• DMA2D
• Mem-to-mem DMA transfer with programmable rectangle area
• Alpha-Blender
• per-object alpha
• per-pixel alpha
a
• Pixel Format convertor
• Input/output: ARGB8888 / RGB888 / RGB565 / ARGB1555 / ARGB4444
• Input-only: A4 /A8 alpha bitmap for glyphs, L8 for 256 colors CLUT
• YCbCr support for higher motion JPEG frame rate
7
HW JPEG Accelerator
• HW JPEG accelerator
• Fully hardware JPEG compression and decompression
• Supporting Motion JPEG videos (MJPEG)
• Saving CPU load for MJPEG processing
• Enhancing branding and user experience Frame
Rate 20 fps*
• Branding animations at startup
• End-product embedded tutorials 8 fps*
x2.50
faster
STM32 F769I STM32 F769I
at 200 MHz at 200 MHz
SW JPEG HW JPEG
* : frames per second
8
Chrom-GRC™
• Chrom-GRC™
• Graphical Resources Cutter for non square displays, fully configurable
• Works transparently as an Memory Management Unit with any memory of the system
• ➔ Saving up to 20% of RAM needs
For 400x400 round display
@16bpp: 250kBytes (vs.312kBytes)
@24bpp: 372kBytes (vs.469kBytes)
Saved Memory
9
Rendering process split
• Chrom-ART is designed for most rendering operations
• Data copy with/without blending
• Fill rectangle with/without transparency
• Pixel format conversion
• HW Jpeg decoder for real world images
• Other operations handled by Cortex
• Smart rendering algorithm processing :
• Optimized algorithm based on Cortex M instructions and FPU
• Primitives drawings (line, circle, polygons, etc.)
• Geometric transformations (rotations, scaling)
• Advanced color effects
10
Graphic sub-system overview
Input bitmaps Frame buffer Display Panel
14:21
Temperature
21°C
Humidity
-5°C
62%
ARMED
FLASH Memory RAM Memory
Update/built Partial or full
of the frame buffer Display Refresh
11
GFX-Enablers for Display
Display Key Elements
MCU DISPLAY
Display Timing
Display Controller Controller
Controller Source Driver Pixel values
Frame
Buffer
Frame (GRAM)
Buffer
Gate Driver
(GRAM)
TFT/OLED Name
RGB444
R
4-bit
G
4-bit
B
4-bit
Size
12bpp
Continuously refreshed
from the GRAM @ 60Hz RGB565 5-bit 6-bit 5-bit 16bpp
RGB666 6-bit 6-bit 6-bit 18bpp
RGB888 8-bit 8-bit 8-bit 24bpp
Backlight
Controller
Only for TFT
13
LTDC Key Features
• 24-bits RGB parallel pixel output up to XGA (1024 x 768)
• Programmable interface for :
• Display size and position (e.g. for partial screen refresh)
• Timings and polarity to address a wide range of displays
• Input pixel formats (ARGB8888, RGB888, RGB565, ARGB1555, ARGB444 + LUT formats)
• AHB Master interface to access int./ext. memories
• Integrated dithering module (2 bits per color channel)
• (e.g. for 24-bits data display on 18-bit limited color palette display)
14
MIPI-DSI host
• The DSI host provides a communication interface with LTDC
external DSI displays
DSI
• Fully configurable
DSI Host
• Supports Command mode & Video mode DSI
APB
• Up to 500Mbps per lane (2 lanes on STM32 MCUs) Wrapper
D-PHY
• Allows low pin count display interfacing (4 or 6)
• Very fast refresh time (1Gbps with 2 lanes)
DSI Display
• Highly integrated solution (internal D-PHY) D-PHY
• Simple integration on existing project (using LTDC) DSI Device
TFT
GRAM
Ctrl.
15
STM32 supports all main display interfaces
• Intel 8080 and Motorola 6800 LCD interfaces for small resolution
STM32 Display
F
Chrom Frame M
-ART buffer 1 C Frame
buffer 2
• TFT controller for medium resolutions (up to XGA) and new generation MIP low power displays
STM32 STM32
Frame L External SDRAM L
T F
Chrom buffer 1 Display Chrom T
D M Display
-ART Frame Frame -ART D
Frame C C
buffer 1 buffer 2 C
buffer 2
16
STM32 supports all main display interfaces
• MIPI-DSI interface for medium resolutions, high pixel density GUI, mainly consumer today
STM32
L Display
Frame STM32
D F D
Chrom buffer 1 T Frame
S Display Chrom M S
-ART D -ART buffer 1 Frame
Frame I C I
C buffer 2
buffer 2
STM32
External SDRAM L
F D
Chrom T
M -ART
S Display
Frame Frame D
C I
buffer 1 buffer 2 C
17
STM32 supports all main display interfaces
• Design for Graphic applications STM32H7B3I provides a large internal RAM
STM32H7Ax/B3
Frame L
OctoSPI
External buffer 1 T Display
Chrom
Flash -ART D
(if needed) Frame C
buffer 2
18
Questions break time
20
STM32 ecosystem
STM32 Ecosystem
Hardware Development Software Development
Embedded Software Information and sharing
Tools Tools
Configuration Tools
Drivers Web site
Evaluation boards Development &
RTOS Product selectors
Debug and Debugging Tools
Stacks and Communities & Social
Programming Probes Program & Monitoring
Application Bricks Media
Tools
Open Partners ST-
source designed
22
HW Development Tools
Evaluation STM32 Nucleo
STM32 Nucleo Discovery kits Third-party boards
boards expansion
Flexible Key feature Full feature Functionality From full evaluation to open
prototyping prototyping evaluation add-on hardware
www.st.com/stm32nucleo www.st.com/stm32discovery www.st.com/stm32evaltools www.st.com/x-nucleo
All Families 23
SW Development Tools
STM32CubeProgrammer
STM32CubeMX IDEs
STM32CubeMonitor
Configure & Generate Code Compile and Debug Program & Monitor
24
TouchGFX ecosystem integration
Developing with TouchGFX
Enabling TouchGFX involves
• UI Application development
• Creating the User Interface including setup of the graphical elements, handling user
events, communicating with the non-UI part of the system.
TouchGFX Designer main purpose
• TouchGFX AL development
• Build the software layer that connects the TouchGFX application with the hardware.
• BSP is provided by ST but only for DevKits peripherals (e.g. external SDRAM, Display)
TouchGFX Designer also provides it but only for ST development kits
CubeMX with TouchGFX plugin guide the customer in this task
26
TouchGFX in STM32 Ecosystem
• TouchGFX comes now a plugin of CubeMX
• Better interaction with the Designer tool
• Independent version management
• MCU Independent
• The CubeMX plugin will help customers in
defining the TouchGFX AL for their custom
platform
• Enabling required IPs (e.g. CRC, LTDC)
• Configure these IPs
• Configure the TouchGFX framework
(e.g. buffer management, display definition)
27
Developing with TouchGFX
• Two use cases, two starting points
• UC-A. Prototyping / Proof-of-Concept on STM32 Display Kits
• UC-B. Product development on STM32 MCU based custom board
+
28
Developing with TouchGFX
• UC-A : Prototyping on STM32 Display Kits
• Use TouchGFX Designer to start your project
• Select premade Application Templates (AT) for the specific CubeMX
Application Project
STM32 Display Kit Templates (.ioc)
• Develop UI, build, flash from TouchGFX Designer,
• Modify your hardware setup using CubeMX
opening the AT associated .IOC CubeMX project file
• Change the IDE among CubeIDE, IAR or Keil gcc
toolchain
• Modify/Build/Flash application using selected toolchain
Not yet available for all ATs, version 3.x.x only
IDE
IAR,
CubeIDE,
Keil
29
Developing with TouchGFX
• UC-B : Custom STM32 based board
• Use CubeMX to select MCU and setup hardware IPs
• Enable the TouchGFX Generator to configure and
generate the TouchGFX start up code.
• Develop UI using TouchGFX Designer (.part file)
• Select preferred IDE (CubeIDE, IAR or Keil) IDE
IAR,
• Configure board bring up and add board specific setup CubeIDE,
Add Board Keil
code that is not managed by CubeMX. Specific
• Write/build/flash using selected IDE Code
30
Enable Plugin in CubeMX
31
Configure Plugin in CubeMX
32
Generated code
• HAL (read-only)
• Mandatory set of classes
• Contains virtual members needed by the Library
• TouchGFXGeneratedHAL (read-only)
• GeneratedHAL is an HAL customization based on
TouchGFX Generator settings (e.g frame buffer size)
33
User intervention
• TouchGFXHAL (user-defined)
• Inherits from TouchGFXGeneratedHAL
• Generated once by CubeMX (skeleton)
• Need to be adapted to custom board (datasheet)
• e.g. a driver for transferring pixels from a
framebuffer over SPI, PWM for LCD backlight.
• Can even override/ignore the TouchGFXGeneratedHAL
code
34
TouchGFX Port for Specific Hardware
SPI calls ChromArt
for display refresh API calls
Or LTDC Interrupt
35
TouchGFX - Software Layers
User Application
Text
Images, Fonts
Code
Layout
TouchGFX Config
TouchGFX Core
Widgets
Rendering
Event handling
Timing
FreeRTOS ST Devkit ST Devkit
OS TouchGFX HAL Drivers
Other OS Wrapper Generated HAL
Custom board
User Drivers
No OS HAL
36
ST Development Kit
User Application
Text
Images, Fonts
Code
Layout
TouchGFX Config
TouchGFX Core
Widgets
Rendering
Event handling
Timing
OS TouchGFX
ST Devkit ST Devkit
FreeRTOS Wrapper Generated HAL HAL Drivers
37
Custom Design
User Application
Text
Images, Fonts
Code
Layout
TouchGFX Config
TouchGFX Core
Widgets
Rendering
Event handling
Timing
OS TouchGFX
Custom board
Other OS Wrapper Generated HAL User Drivers
HAL
38
Summary
• Start from TouchGFX Designer for ST devkits prototyping
• Use the STM32 Ecosystem for custom boards
• CubeMX configuration tool
• X-CUBE-TOUCHGFX expansion pack
• More complete information on the TouchGFX Framework on:
https://support.touchgfx.com/docs/Introduction/welcome
39
Doc – Basic concepts
40
Doc – TouchGFX Plugin
41
Doc – Abstraction Layer
42
Doc – Board bring-up
43
Doc – Rendering flow example
44
Extended Graphics ECO System
• TouchGFX Implementer Services
• Coupon support
• Porting
• Application Development
• Onsite Development
• Training
• Hardware Development
• Full Turnkey Solutions
• Electronic Manufacturing
• User experience
• Graphical Art-work
• .
Learn more at https://www.touchgfx.com/implementers/ 45
Thank you
Questions ?
© STMicroelectronics - All rights reserved.
The STMicroelectronics corporate logo is a registered trademark of the STMicroelectronics
group of companies. All other names are the property of their respective owners.