cancel
Showing results for 
Search instead for 
Did you mean: 

Interfacing with hardware in TouchGFX Applications

Martin KJELDSEN
Chief III

Due to popular demand, here's the information we have on interfacing with peripherals on an STM32F769-DISCO board in a TouchGFX Application.

I have two resources for this:

  1. Video: I did a webinar last year on this topic where we create an application using v4.9.3 of the TouchGFX designer and interact with push buttons through a GUI + turn on an LED using a TouchGFX Button: https://www.youtube.com/watch?v=jQO7zhX0e0Q
  2. Article: https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication/. Here are the direct links for the demos i did in TouchGFX 4.9.3 (should be upgradeable) using GPIO and EXTI approach: EXTI, GPIO.

Disclaimer: The examples in the article are not maintained throughout new versions of TouchGFX.

Feel free to comment if you have any issues. Thank you!

Best regards,

Martin

23 REPLIES 23
PJain
Associate II

Hi @Martin KJELDSEN​ ,

Thanks for the quick reply. I am using STM32469I-DISCO board and trying to replicate the results from the video. Referencing from the project file you pointed out, I was able to resolve most of the errors (I had to make a change in the makefile as well). I think I am almost there, the last piece of code I am stuck at is the following error:

C:\Users\pjain\Desktop\MyApplication1/target/main.cpp:107: undefined reference to `led_task'

collect2.exe: error: ld returned 1 exit status

When I disable the xTaskCreate for led_task in main.cpp, the code is compiled and uploaded to the MCU (without any hw integration). I am not sure why am I getting this error. I have defined void led_task(void* params) in ledtask.h and also included the ledtask.h in main.cpp

PFA my project for your reference. Please let me know if you have any solution/workaround to this error.

Thanks,

Prateek

RCair
Associate

Olá,

no arquivo (target/main,cpp) deveria estar

extern "C"

{

#include "ledtask.c"

#include "btntask.c"

}

não tenho certeza!

The task definition is in a seperate file. Are you sure you're compiling this file? It's in the target/ folder and is called "ledtask.c"

/Martin

Not sure i follow you, cmelo. Could you say that in english?

/Martin

Thanks for pointing that I out, I forgot to include ledtask.c in Makefile!

Also, I had to add $(application_path)/target in the include path as well on line 171 of Makefile (I don't know if it's the right thing to do it but without it, ledtask.h is not being recognized in Model.cpp file).

Now, I am able to compile my code :) but the display is not working properly (PFA the image). If I disable the led_task, the display works fine (without hw integration). I even tried disabling the code inside the led_task but the issue is persistent. I don't know if it's something to do with the Makefile. PFA my project for reference.0690X000008iqJ4QAI.jpg

You may have forgotten to program the external flash :)

/Martin

You're missing ledtask.c in your Makefile. You should take a look/diff with the Makefile from the original project (which is STM32F769 based).

/Martin

I am sorry Martin, I don't know how but the Makefile is not reflecting the changes I made earlier. Probably when I was zipping the folder, Makefile was open :expressionless_face: . Nevertheless, PFA the updated project.

Regarding the external flash programming, I am using the following command to flash the board:

make -f target/gcc/Makefile -j8 flash

I also tried the command shown below but there is no change (I also tried cleaning the project but no luck). Do I need to implement a different command other than this?

make -f target/gcc/Makefile -j8 intflash

Could you try adding some Boxes that don't require external flash, just to test this theory. Make them draggable. Just to see that you have a working application.

I made a new application with just a draggable box and it works. Also, as I mentioned earlier, when I remove the led task from main.cpp file, the application works fine (In this case the gui button is not able to control the led on board as the led task has not been created).