Straightforward development of displays and touchscreens – including in embedded systems
Graphical user interfaces are all around us. Displays and touchscreens are also increasingly being used in embedded systems. However, graphical interfaces also require resources, both on the system itself and in terms of design and development. TouchGFX, a graphics library from ST-Microelectronics, keeps the entry barrier for developing embedded systems with displays as low as possible.
During Boostcamp 2022, two CSA employees worked with TouchGFX with the aim of implementing a simple application on the STM32F769I-Disco evaluation board and discovering the possibilities of TouchGFX in the process. This was achieved in three steps. The first was to set up an example project with the STM32Cube IDE. The second was to expand it with specially developed functionalities and hardware interactions. The third and final step was to test the “OSWrapper” feature for replacing the underlying operating system.
Setting up the STM32F769I-Disco evaluation board with an STM32Cube IDE example project is quick and straightforward. TouchGFX comes with a handy tool for creating your own GUI: the TouchGFX Designer. It includes a graphical user interface that makes it easy to arrange buttons, texts and images. At the heart of the tool is the code generator, which is used to generate C++ code from the previously created GUI. A simulator can also be used to create an executable program for demonstration purposes. This makes it possible, for example, to test the design or navigation through a menu or present it to stakeholders without needing an embedded device with a display.
The generated code is integrated into an STM32Cube project, which compiles it and introduces it to the hardware. A FreeRTOS thread is generated, which can be customised based on your requirements, is generated by default. Hardware data is sent to the GUI via EventQueues. Similarly, input from the touchscreen can be processed in the thread and corresponding functions can be triggered on the hardware. In our case, we switched an LED on and off using a button on the touchscreen. The current state of the LED was read cyclically and shown on the display.
Of course, graphical interfaces and displays also place demands on the hardware. The larger the display, the more memory is required for the frame buffer. However, you can adapt the library to the respective application – for example, you can choose between dual buffer or single buffer. Depending on the complexity of the GUI, the generated thread also takes up a corresponding amount of computing capacity.
The inclusion of the OSWrapper, an abstraction layer around the operating system, allows TouchGFX to offer the option of changing the operating system. In the example project we used, we wanted to replace FreeRTOS with AzureRTOS, but this turned out to be more challenging than expected. Due to the many features already implemented by the example project, the operating system has many connections to other software modules that are independent from the graphics library. Switching to an already fully integrated RTOS afterwards is therefore not ideal and involves a great deal of effort. We recommend switching OS at the start of a new project or running it with no operating system at all (bare metal).
In short,
with the TouchGFX graphics library and its integration into the STM32Cube environment, ST makes it possible to equip an embedded device with an attractive user interface relatively quickly. When doing this, the device's requirements must be taken into account in advance and the corresponding microcontrollers and displays must be evaluated.
CSA Engineering AG has the necessary expertise to support you in your project.