cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H735G-DK based TouchGFX project with custom display/touchscreen driver

I have a STM32H73G-DK developement kit and I want to interface a custom 7" touchscreen/display with it using TouchGFX to create a basic menu structure.  I was able to get the display to show static images by following the guide in these youtube videos (from STMicro):

https://youtu.be/yiHjOH7zJP0

https://youtu.be/XnSg3UJfSFc

Following these videos I was able to get a static image to display perfectly however I also need to get the touchscreen functionality to work as well.  The development kit comes with a smaller display that uses the FT5336 touchscreen controller but my display uses the GT911.  One of the steps in the first video is the comment out the touch screen "sampleTouch" code in STM32TouchController.cpp and type in "return true;" as the only code to execute there.  This effectively disables the touchscreen functionality, and if you don't do it the whole project will fail and you get gibberish on the screen.  Since my screen uses the GT911 I searched for drivers for this and I found that STMicro actually wrote an entire driver for that chip and has it up on the Github here:

https://github.com/STMicroelectronics/stm32-gt911

I brought these files into my project in the same location as the corresponding driver files for the FT5336 and changed all mentions of FT5336 to GT911 in stm32h735g_discovery_ts.h and stm32h735g_discovery.c.  I also had to change some other define statements in the .c file due to them not lining up exactly with the naming convention that is more or less shared between the two driver sets.  Once I did this I also noticed in the .h file that there are define statements for width, height, and I2C address...I changed these to 800x480 with an I2C address of 0xBA to match the GT911 and the size of my touch panel.  I returned the sampleTouch "function" to it's original un-commented state and built/ran the program.  When I do this my screen now shows mostly gibberish with an old image that must not have been cleared from memory from a previous attempt at getting the display working.  when I stop my program the program counter is stuck in the MemManage_Handler.

I know from previous tests using TouchGFX with all the stock hardware from ST that projects using the touchscreen work just fine as long as you're using the stock display with the FT5336 controller.  Since both the FT5336 and GT911 drivers were written by ST with nearly identical function calls and define statements (except the values stored being changed) I thought this would be a relatively simple change.  What else do I need to change in my project to switch over from the FT5336 to GT911 controller?  Are there other Discovery Kits that happen to use the GT911 that I can look at their code and see what they did?

1 REPLY 1
ahsrabrifat
Senior II

 

The MemManage_Handler implies invalid memory access. In your sampleTouch implementation, verify:

 

 

if (GT911_TS_GetState(0, &TS_State) == TS_OK) {
if (TS_State.TouchDetected) {
// Ensure you access the correct coordinates safely
x = TS_State.TouchX[0];
y = TS_State.TouchY[0];
updateTouch(x, y); // or however you pass it to TouchGFX
return true;
}
}
return false;



Make sure TS_State is a global/static variable and not stack-based if you’re calling it repeatedly.