cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX / Hardware integration tutorials

LAlna.1
Associate II

Hi there

I have been experimenting and creating simple TouchGFX GUI applications on STM32 touch screen dev kit.

Is there a simple start guide to creating as simple touchGFX GUI and controlling an LED on the STM32F429i Disco board? I tried some online examples/Youtube but they never seem to work properly.

TouchGFX websites contains good tutorials but they don't include HAL integration and control (as far as I have seen)

To keep it simple, I use ST32CubeMX, TouchGFX designer, and ST_link Utility to flash the board.

Any simple code would be a great help

Thanks

19 REPLIES 19

What do you not manage to do exactly ?

Have you tried using the F429-DISCO Application Template in the Designer ? We create these Application Template so that people can start with something already working instead of doing their own code from scratch. Also, it's a great reference when trying to create your own custom project.

What exactly is not clear in the Website documentation regarding how to create a UI or even a project ?

If you want to turn on a LED, simply configure the corresponding pin in CubeMX, generate code and call the function HAL_GPIO_WritePin() when needed. I don't know on what event you want to turn on your led but it should not matter.

/Alexandre

MM..1
Chief III

0693W000003Qx0iQAC.pngOn point 4 i mean add and set parts on image.

On 6 you need add lines to main.c, because generated code not start TouchGFX, maybe newer MX do it , but my 5.6 generate empty defaultTask

without add task no touch start exist...

void StartDefaultTask(void const * argument)

{

 /* USER CODE BEGIN 5 */

MX_TouchGFX_Process(); //added line

 /* Infinite loop */

 for(;;)

 {

  osDelay(1);

 }

 /* USER CODE END 5 */ 

}

BSP --- Cube clean project dont create it , you need add (copy) files when you need any. For my project i only create new driver for my LCD.

POINT 7 : block rtos start comment it out and add some test as backlight on some pixels on display change ...

 /* Start scheduler */

// osKernelStart();

 /* We should never get here as control is now taken by the scheduler */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

//test here

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

Hi Alexandre,

My question regarding this topic is: If we start from TouchGFX, using the template, it possible to generate the code and also to import to CubeIDE, compile and debug without problems. But, the Project folder is completly different, it generate a .ioc file with the board name and my point here is: how can we run the ioc file (inside CubeIDE or CubeMX) to configure more peripherals, that could include USB or also others GPIOs? (only by hand?) If I try to run the .ioc file generated by TocuhGFX (again with the name of the board, not the project) it generates files inside the folder with another structure and it is not running. I have also try to change the .ioc file name and other references inside but it was not working... I'm currently using latest versions of software (CubeIDE 1.4.0 and Touch 4.14.0) Thanks for your help-!!!

If you want to use your own board and not one that is provided in TouchGFX Designer, you will have to create an ioc file from scratch. But you can based yourself on different Application Template to help you through the process. Indeed, you will have to write or copy/paste the code that is not generated.

In case you are using a board we support in Designer, you should be able to add peripherals, except if they are not available on the board.

You say that the structure is different. Could you elaborate that point ? What are the steps you do when the folder structure changes ?

Effectively it is not easy to change the ioc file name because of all the underlying dependencies. I'll try to see if I can write something related to changing the ioc file name.

/Alexandre

Regarding changing the ioc file name, here are the steps in order to have a working project afterwards. I'm using CubeMX and CubeIDE separately.

  • Step 1: Rename the file

  • Step 2: Edit the file

Change lines ProjectManager.ProjectFileName=new_file_name.ioc

ProjectManager.ProjectName=new_file_name

  • Step 3: Go to TouchGFX/ folder, edit .touchgfx.part file

"PostGenerateTargetCommand" : "touchgfx update_project --project-file=../new_file_name.ioc --platform=m7"

* You can also change "Name": "new_name"

  • Step 4: As you changed the ioc file, the different IDE folders are no longer working.

Here we are going to talk about CubeIDE

- Delete STM32CubeIDE/ folder (beware, you need to copy the .ld files somewhere before deletion)

- Open the ioc file with CubeMX, click on Generate Code. This should regenerate the STM32CubeIDE/ folder. 

- Put back the previously saved .ld files inside the newly created STM32CubeIDE/ folder.

- Open CubeIDE and double click on the .project file. This should import automatically the project into CubeIDE.

- Now you can build with no problem

- When deleting the folder, you lost the .launch file necessary to download and debug your board. Simply re-create a configuration file, selecting the correct external loader, and you should be up and running.

/Alexandre

Thank you Alexandre!!! Now I know it is feasible... But I have tried and it fails... All steps worked as expected. After that, before compilation, I had modify the paths inside CubeIDE because some files were not founded, it passed the files step but it is not be able to compile... The first error found it was:

Application/User/TouchGFX/target/STM32TouchController.o: In function `BSP_TS_Init(unsigned short, unsigned short)':

C:/Users/LenovoGA/STM32CubeIDE/workspace_1.4.0/Graphic03/TouchGFX/target/STM32TouchController.cpp:109: undefined reference to `stmpe811_ts_drv' .....and from there other similar errors.... I'm using a STM32F429 Discovery Board, and again, the idea is to add other peripheral that they were not generated by TouchGFX (simple additionals GPIO are not generated)

Regarding the structure, for intance in a classic project core is under the root, but in these project generated from TouchGFX core is under application/user inside CubeIDE (but ok, that is not a problem if you know it)

I can send the copy of the complete output in a file, but I dont see any place here...

Thanks again for your time!!!

Gustavo

This is probably because your driver source file and header file are not indicated in your CubeIDE project. You need to include the right path to the header file and add the source file to the project.

/Alexandre

GAuye
Associate III

MM..1 thanks for you answer and explanation, but I gave up... TouchGFX and CubeIDE (without touching the .ioc) is working fine, but if I want to start from CubeIDE (MX) I followed your explanation, and finally its says " c:\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.4.0.202007081208\tools\arm-none-eabi\bin\ld.exe: Graphic05.elf section `TouchGFX_Framebuffer' will not fit in region `RAM'

c:\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.4.0.202007081208\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 153336 bytes" (it is just a button)

I think the tools are not complete integrated yet, so I will not spend too much time with this... I have added some periphericas by hand and I will test it (using the project original from TouchGFX) Again, thanks for your help but something is not working well. I have also recieved some advices from ST Employee on how to change the names in .ioc files generated by TouchGFX (to have the possibility to touch the .ioc file) but it didnt work...

Next step: Do you have a good link or reference to understand how graphics control hardward and vice versa? Thanks for your help!!!

Hi Alexandre, no, it is not working, but I found out a "good enoght" solution.. I have started from TouchGFX, generated code, I have use .ioc in CubeMx, I have modified the file with new peripherics (GPIOs), generated code, and open all the Project in CubeIDE without modified any file name... Of course I have to live with the Project name by default (generated by TouchGFX) but at least I have full control of the Project... I think the whole ecosystem could be improved, I hope this will be done in coming upgrades... Thank you for your support...

GAuye
Associate III

Update: it is not working, but I found out a "good enoght" solution.. I have started from TouchGFX, generated code, I have use .ioc in CubeMx, I have modified the file with new peripherics (GPIOs), generated code, and open all the Project in CubeIDE without modified any file name... Of course I have to live with the Project name by default (generated by TouchGFX) but at least I have full control of the Project... I'm now going to work inside the program to better understand the best and easy way to have a real application running... (it seems not so easy...) Thanks for your help!!!