cancel
Showing results for 
Search instead for 
Did you mean: 

Possible bug in touch respond code (TouchGFX 4.16.1)

hesam moshiri
Associate III

Hello,

I can run the GUI on the screen, however, for some unknown reason, the touch does not respond. I have tested the touch function separately in the while loop and it handles the x and y coordinates correctly with the same code and with checking the touch press (I mean what you see below inside sampleTouch, just without "return true", because return true will exit the while loop).

Where is your definition of (0, 0), upper-left corner, or lower-left corner? I have tested both. nothing happens :(

This is my implementation inside "STM32TouchController.cpp":

bool STM32TouchController::sampleTouch(int32_t &x, int32_t &y) {
 
	if (XPT2046_TouchPressed()) {
		XPT2046_TouchGetCoordinates((uint16_t*) &x, (uint16_t*) &y);
		return true;
	}
 
	return false;
 
}

1 ACCEPTED SOLUTION

Accepted Solutions
hesam moshiri
Associate III

My problem was solved. The problem was that the timer interrupt configuration was wrong and the interrupt was not occurring fast enough

View solution in original post

11 REPLIES 11
Romain DIELEMAN
ST Employee

Hi,

Are you working with a custom board or one of ST development boards ? Did you start your project from scratch or from TouchGFX Designer with an application template for a ST development kit?

The coordinates (0,0) correspond to the upper-left corner.

/Romain

hesam moshiri
Associate III

Hi,

I'm using a custom board, which both the LCD and its Touch have been tested using a different GUI library (non-TouchGFX library in another CubeIDE project). So the board and connections are fine (hardware is okay). I have used the partial buffer method which works fine and I can see the GUI on the LCD.

I use STM32CubeMX (6.2.1) to generate the code (including TouchGFX software pack 4.16.1) and I compile it using CubeIDE (1.6.1). So everything is provided by the CubeMX.

hesam moshiri
Associate III

Hi,

I have not heard anything back so far, could you replicate the problem using the explained code generation procedure?

I do not have a XPT2046 touch controller so I could not replicate it. I can only advise to check pin configuration and other peoples project using this touch controller to see how they configured it and their abstraction layers.

/Romain

Dear Romian,

I have no problem configuring the touch controller. as I said in my first post, I have already configured it and I get x and y coordinates when I test the function in a while loop. However, it seems there is something wrong with "bool STM32TouchController::sampleTouch(int32_t &x, int32_t &y)".

Not many people followed the same procedure which I explained here: "I use STM32CubeMX (6.2.1) to generate the code (including TouchGFX software pack 4.16.1) and I compile it using CubeIDE (1.6.1). So everything is provided by the CubeMX "

What I will do now is that I will just pass fixed coordinates to "bool STM32TouchController::sampleTouch(int32_t &x, int32_t &y)" and trigger it by a simple pushbutton press or similar. if it does not respond then most likely there is something wrong with the TouchGFX software pack for the CubeMX. if not and if it worked, I will investigate from my own side more, and it will be not the TouchGFX problem anymore.

Could you give more info on your settings ? What MCU are you using ?

The procedure you followed is the "standard" procedure when you create a project from STM32CubeMX. Could you share more detail on your other steps ? I just created for a demo a project from scratch from CubeMX on a STM32F746G-disco and did not face a similar issue when setting up the touch.

/Romain

Exact same issue here with DISCO-F469. I made a project from CubeMX, then made UI in TouchGFX Designer within project. UI shows, but touch does not respond.

I checked that sampleTouch() being called and return correct coordinates, however buttonCallbackHandler from Screen1ViewBase.cpp is not called.

Do you have any success with that? Does your code run freely or freeze? Have you tried different TouchGFX options like RTOS on/off, buffer single/double?

EDIT: that is reply to hesam moshiri, not sure where this message landed

This is my setting of TouchGFX, I don't use LTDC. The LCD owns a controller (ILI9341). So I send data using SPI. MCU is STM32F407ZG. I call VSync function in a timer interrupt like below, also, I call the MX_TouchGFX_Process(); inside the while (1) loop. anyway, I don't think these steps are related to touch. I will investigate more.

to Vlau:

Do you have any success with that? Does your code run freely or freeze? Have you tried different TouchGFX options like RTOS on/off, buffer single/double?

Good point, however, I don't think it freezes, I will check again.

extern void touchgfxSignalVSync(void);
 
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
	if (htim->Instance == TIM3) {
		touchgfxSignalVSync();
	}
}

0693W00000AO4oIQAT.jpg

hesam moshiri
Associate III

My problem was solved. The problem was that the timer interrupt configuration was wrong and the interrupt was not occurring fast enough