cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G-Discovery: Create a basic graphical application using CubeMX

ST Community
ST Employee

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.

 

Setup review:

  • 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 this STM32F746-Disco_CubeMX_4.26.ioc project file.

706.jpg
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.

2. Open the project properties and check that you have the correct firmware installed

707.jpg

3. Switch to the "Configuration" tab and click on the "GRAPHICS" button to open the graphics configuration dialog box

708.jpg

4. In the "STemWin" tab click on "Execute" to launch the GUIDesigner tool

709.jpg

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.

5. Click on the "Button" to create some buttons and save,

710.jpg

You can ignore the warning by clicking "Ok"
711.jpg

6. Generate the entire project source code

712.jpg

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"

713.jpg

8. Open Atollic IDE and import the generated project by selecting the top folder (i.e. the one that contains the ".project" file)

714.jpg715.jpg

9. Launch the build

716.jpg

10. Launch a debug session, then click on the "run" button

11. You now have a functional graphical application running !

717.jpg

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).

To enhance this GUI please refer to the STemWin Application Note as well as the EmWin reference manual from Segger's website.
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.
718.jpg719.jpg

Comments
Cevdet
Associate III

It doen't work...and I can't see the images. I think it is because of the servers. It would be better If you make a video about this article.

Alex Fedoseev
Associate II

I can see only the fist image, the rest of the images are just little white questions inside blue squares.

would you please fix the links?

Kersten HEINS
Associate III

yes, thanks for your notification. We will try to fix or republish the article.

Cevdet
Associate III

when I use STMCubeMX v4.26.1 and STM32Cube_FW_F7_V1.12.0 it does not work.

With Cube v4.26 and STM32Cube_FW_F7_V1.11.0 it does work.

It's weird that it does not work with higher versions.

Mark Shoe
Senior

Confirm it does not work with CubeMX 4.26.1 and FW 1.12.0

Have been busy comparing the working with not working project. There are lines missing in the .oic file but was not able to get it working.

N. SANTINI
ST Employee

Hi all,

You are right, I already provided an updated ioc file for 4.26 a few weeks ago, unfortunately it has been lost during the community tool migration, Inwill post it again shortly.

Sorry for the inconvenience,

Best regards,

Nicolas SANTINI

STMicroelectronics

T.O.M.A.S. - Technically Oriented Microcontroller Application Services

N. SANTINI
ST Employee

Hi again,

After a quick test it worked for me using the provided ioc, opened with CubeMX 4.26 agreed on migrating to FW 1.12. What do you mean by "not working" ?

Anyway this is not satisfactory for me since this is not working using the latest CubeMX 4.27 for a very simple reason : Atollic output is disabled !...

I fell very sorry about this situation, please give me some precisions on what is not working on your side to see if I can help while I try to find a solution for CubeMX 4.27.

Best regards,

Nicolas SANTINI

STMicroelectronics

T.O.M.A.S. - Technically Oriented Microcontroller Application Services

Version history
Last update:
‎2024-06-17 07:00 AM
Updated by: