Skip to main content
hesam moshiri
Associate III
April 27, 2021
Solved

Possible bug in touch respond code (TouchGFX 4.16.1)

  • April 27, 2021
  • 11 replies
  • 2402 views

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;
 
}

This topic has been closed for replies.
Best answer by hesam moshiri

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

11 replies

Romain DIELEMAN
ST Employee
April 27, 2021

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
April 27, 2021

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
May 8, 2021

Hi,

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

Romain DIELEMAN
ST Employee
May 10, 2021

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

hesam moshiri
Associate III
May 10, 2021

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.

hesam moshiri
hesam moshiriAuthorBest answer
Associate III
May 23, 2021

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

Romain DIELEMAN
ST Employee
May 25, 2021

Good to hear you found the problem :thumbs_up:

hesam moshiri
Associate III
May 25, 2021

Yes, thank you for your testing and support.

I had a doubt about a bug from the beginning, that why I mentioned a "possible" bug in touchgx ...

;)