How to start a basic graphical application for the STM32F746G-Discovery board using the STM32CubeMX tool ?
Currently the graphical examples are only provided as "Demonstration" or "Hello World" in the Cube Firmware packages. But these examples do not rely on a STM32CubeMX project file (i.e. *.ioc file) which requires the user to manually configure new peripherals directly in the source code instead of using the STM32CubeMX interface.
On the other side, the STM32CubeMX tool allows to create a default ioc file for a specific Discovery board with a valid graphic configuration. But this default pinout also enables multiples of peripherals such as Ethernet, USB, CAN bus, etc. that may not be relevant to all users.
This FAQ is provided (see attachments) with an ioc file for the STM32F746G-Discovery board with all the graphic part correctly configured (i.e. DMA2D, LTDC pins, etc.) and nothing more !
In the following we will review the few steps needed to generate a basic graphical application from this STM32CubeMX project.
- ioc project for STM32CubeMX v.4.26 (attached to this FAQ, at the very bottom of the article)
- the chosen IDE is True Studio
- the Cube Firmware is the STM32Cube_FW_F7_V1.11.0
- the graphic library is STemWin (latest version is included in the Cube Firmware)
1. Open STM32CubeMX (v.4.26 at least) and load the STM32F746-Disco_CubeMX_4.26.ioc project file
You can notice on the left side of the screenshot that the required graphic peripherals are enabled (DMA2D, LTDC, SDRAM, STemWin).
Note also that the CRC peripheral is required, it is mandatory when using the STemWin library.
3. Switch to the "Configuration" tab and click on the "GRAPHICS" button to open the graphics configuration dialog box
Note that this tool is mainly used to create the skeleton of the GUI (i.e. define and set location of the main widgets and main refresh loop implementation).
To actually implement the GUI interactions or advanced/custom widgets the user will directly edit the source code.
You can ignore the warning by clicking "Ok"
7. Do not click on "Open", it may open System Workbench instead of Atollic depending on which one is installed on your computer, click "Close"
8. Open Atollic IDE and import the generated project by selecting the top folder (i.e. the one that contains the ".project" file)
9. Launch the build
10. Launch a debug session, then click on the "run" button
11. You now have a functional graphical application running !
The graphic stack initialization is now handled and the stack is running without typing any piece of additional code !
You are now free to go back to the STM32CubeMX interface to enable and configure other peripherals and generate again the source code (from step 6).
Note that any manually edited C code placed between /* USER CODE BEGIN ... */ and /* USER CODE END ... */ will be kept as is when re-generating the code from STM32CubeMX.
To apply the same principle to the WindowDLG.c file (containing the GUI skeleton) put user code between //USER START and //USER END.