2025-02-13 01:59 PM
Hello! I am struggling to get TouchGFX fully working on my custom PCB using a STM32u5A9ZJT (LQFP144). Everything compiles correctly and uploads. I can see my Screen1 background and button on my screen so at least that is working. But when I touch my button it does not transition to the next screen (as it does in the TouchGFX simulator when I run this code). Using my debugger i can see that the touch is triggering the external interrupt, and the coordinates are correct in STM32TouchController::sampleTouch but the expected screen transition never occurs. When comparing the IOC files between my working demo project and custom project, I noticed I did not have DCACHE enabled, but when I enable DCACHE I get a HardFault right after registering a touch.
Setup background -- I began development with the Riverdi_50STM32u5a9. This was available as a board option on TouchGFX so I was able to create my project through TouchGFX first. However, the STM32u5 used in our custom PCB was not a board option within TouchGFX and was not pin compatible with any of the options that did exist. So I created my project starting first with CubeMX then added TouchGFX as an add-on package.
I copied over the missing functions from STM32TouchController.cpp/hpp that TouchGFX generates in my Riverdi demo project over to my custom project. The screen we are using is the same as in the demo board so I was able to copy over all the configuration settings of the frame buffer, ltdc, etc. in CubeMX.
Is there a noticeable gap in my implementation or setup? Has anyone experienced a fault when mapping a touch into a GUI update? I'm new to the STM and TouchGFX realm. I can't even follow how SampleTouch triggers the button handler... any insight would be appreciated!
STMCubeIDE version: 1.16.0
TouchGFX version: 4.24.1
Board: STM32u5A9ZJT (LQFP144)
2025-02-14 05:39 AM
Hello @PatriciaQ ,
Screen transition not performing could be another issue no related to touch. Could you just try to press on a button and see if that reacts? Normally, when you press on button you have 2 different assets depending of the state of your button:
You can alternatively try to add a box to your application and configure an interaction like bellow, just to see if the coordinate of your touch are correct and that the button actually can trigger something :
If that does work I recommend then to use a flexbutton with the size of your entire screen and do the same (change box color for instance). If that do something I would definitely suspect coordinate issue.
To check if your click event has the correct coordinates, you could try to add this code in your ScreenView.cpp
void ScreenView::handleClickEvent(const ClickEvent& event)
{
int x = event.getX();
int y = event.getY();
}
And then when debugging, try to compare these values with what you got from your sampleTouch.
2025-02-14 10:27 AM
Hi Osman,
Thank you for your quick reply and the suggestions. Good thinking on verifying the coordinates first before worrying about the screen transition.
Looks like I am actually always getting a HardFault upon touching the screen (not just when I enable DCACHE). If I run my debugger and set my breakpoint within sampleTouch the I2C Receive works and the X_Touch and Y_Touch coordinates are read successfully, but once I step past that function I see a "No source available for touchgfx::HAL::tick()" then it enters the HardFault loop.
This tick() looks to be called from the HAL.hpp backPorchExited() function
When I do not touch the screen, and set my breakpoint here this tick() function gets called periodically and runs without issue. Do you have any suggestions on what could be causing this? I've been looking around the forums and haven't found anything that has helped.
Is it possible that there is something wrong at the build stage since I am not starting the project in TouchGFX and the folder structure is slightly different? Or would that usually result in a build/compiler/linker error? I am attaching the build output in case it could be helpful.