This article shows you how to generate and configure a TouchGFX project for the STM32F429I-DISCO board using CubeMX and the TouchGFX Designer through the following steps:
- Create the initial project
- Graphics framework and display interface configuration
- Clock configuration
- TouchGFX application bootstrapping
- Touch Controller configuration
Creating the initial project
Create a new project by using the board selector by selecting "Access to Board Selector".
In the Board Selector menu, create a project based on the STM32F429I-DISCO board by following the step below.
- Select type of board
- Select STM32F4 MCU family
- Select STM32F429I-DISCO board
- Select "Start Project"
After selecting "Start Project" a pop-up asking to Initialize all peripherals to default mode appears. Select yes to initialize all peripherals to their default mode.
With the project initialized the project should be saved and the initial code should be generated. This is done by mowing to the Project Manager tab and do the following:
- Set the name for the project
- Use the Generate Code button to save the project and generate the initial code
Graphics and Display Interface
Configure the Graphics middleware (TouchGFX) and display interface platform settings as outlined in the below screenshot.
Allow clock configurator to resolve an issue with one of the clock settings.
Generate the project
After giving the project a name, generate the project. By default CubeMX will generate an EWARM V8 project using latest version of Cube Drivers.
Bootstrapping the TouchGFX application
Now that the CubeMX configuration is completed, press the "Execute" button to launch the project in the TouchGFX Designer.
Upon loading the project the designer will bootstrap your application with required framework files. Code generation (Screen definitions, among other things) happens automatically but you can press the "Generate Code" button as you wish.
To verify the configuration add a "Draggable" element to the canvas. Save your project and close the designer.
Open the EWARM project (EWARM/Project.eww) with IAR 8 and compile the project (F7). Notice the generated code for screen1 as defined through the Designer. Pressing "Download and Debug" will program attached STM32F429I-DISCO board and reset the board to ultimately display your application. The next section shows you how to support for the touchcontroller.
- Uncommenting the touch controller code (See screenshot above).
- Adding the relevant touch controller code files to your project manually. On Windows the Cube Driver pack used by CubeMX can be located at C:\Users\<user>\STM32Cube\Repository\STM32Cube_FW_F4_Vx.y.z\Drivers\BSP\STM32F429I-Discovery. Copy the entire folder to your project at STM32F429I-DISCO\Drivers\BSP (you may need more drivers).