cancel
Showing results for 
Search instead for 
Did you mean: 

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y) is called only one time

MPast.1
Senior II

Hi everybody,

I have some problems with my project : the function STM32TouchController::sampleTouch(int32_t& x, int32_t& y) is called only the first pressure.

What is the reason? I'm using Touchgfx 20 with a 480x320 SPI display: graphic is designing correctly but I don't now the cause of touch system blocking.

Is there a problem with graphic design methd? Maybe something wrong can block touch functions?

Has someone some tips?

thanks

8 REPLIES 8
Yoann KLEIN
ST Employee

Hello @MPast.1​ ,

Is it possible for you to share your project please ?

Could be very helpful for debugging your issue.

Thanks,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
MPast.1
Senior II

Hi Yoann,

I'm sorry for my late answer but I was in vacation without internet connection.

Today I uploaded my test project on this link: https://www.transfernow.net/dl/20220822atfcyELp. (the link is available until 08/29/22)

The project contains everything: sources, pictures and TouchGfx project. The dimension arre 61 Mbytes.

I confirm that touch function is not more called after main screen drawing.

Can you help me to understand the reason?

The problem does not appear if I disable TEARING effect on display init procedure and if I call touchgfxSignalVSync periodically with a timer interrupt . (Can be it usefull ???)

There is an #define called USE_TEARING_IRQ for the Tearing Effect management: whe this is enable taering effect is managed by EXTernal interrupt, else by a periodic calling.

You can find the display drivers, Tearing Effect mangament and SPI&DMA communication inside the folder: Drivers/BSP/ili9488/ili9488.cpp.

The routine called bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y) is located at the original path.

Thanks in advance for your interesting.

Best regards.

MarcoP

MPast.1
Senior II

Hi Yoann,

did you find something?

Do you have news?

thanks

HAndr.1
Associate II

Hi, I haven't looked at your code because the link is expired, but I'm pretty sure why it doesn't work. Check if the coordinates from the touch controller have changed, if they have changed return the new ones and exit with true, if they have not changed do nothing and exit with false.

MPast.1
Senior II

Hi HAndr.1

the problem is that the routine mentioned above is no longer called.

If I put a breakpoint at the first line of STM32TouchController::sampleTouch(int32_t& x, int32_t& y) , firmware doesn't never halt. So the result true or false can't be returned.

MPast.1
Senior II

Hi all,

@Yoann KLEIN​  I discover the problem, but I need some hints to solved in the right way.

The cause is the tearing effect signal witch is mssing after draw an static screen.

My system is configurated to works with partial frame buffer stategy an SPI Display that use ILI9488 controller.

I discovered when the full screen is draw and when there are not any changes on it, the earing effect signal in not generated and, in this way, external interrupt is not called.

This means  touchgfxSignalVSync() is not called and in the end vsync_sem remain always at ZERO.

if vsync_sem is ZERO, sampleTouch(int32_t& x, int32_t& y) routine is not called.

So this is my question: How can I keep active touchscreen system when there are not change on screen (in other words when tearing signal is not generated due to a static Screen)?

I don't want to call touchgfxSignalVSync() with polling every X milliseconds: is it not elegant!

This can be reputed a BUG? How can be solved?

Do you have any suggestions?

Thanks

Hi @MPast.1​ ,

I have some questions to clarify the issue :

  • Is it a custom board ? e.g. did you write your own touch controller code?
  • Did you generate the project with CubeMX?
  • TouchGFX does not do anything to block your driver code. sampleTouch() is called once every tick and you're free to poll your touch controller there. Or is your application interrupt based?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
  • Yes is a custom board with STm32h743vit6 with an SPI display 480*320.
  • Touch screen driver is made with a state machine called in polling, in parallel to TouchgGFX rotuines. For read the data from the touch panel I added this code:
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
	TS_StateTypeDef state = {0};
 
    /**
     * By default sampleTouch returns false,
     * return true if a touch has been detected, otherwise false.
     *
     * Coordinates are passed to the caller by reference by x and y.
     *
     * This function is called by the TouchGFX framework.
     * By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
     *
     */
 
	if (FT6206.Status.flag.DeviceInit == 0)				// if touch is not ready
		return false;							// exit and wait
 
	BSP_TS_GetState(&state);
	if(state.touchDetected)						// if something is found
		{									// report coordinates	
		x = state.touchX;
		y = state.touchY;
	       return true;								// exit WITH touch
		}
 
    return false;			      					       // exit WITHOUT touch
}
  • I'm Using Stm32CubeIDE with integrated STM32CubeMX plugin (version      6.6.1.202207061420)

About your last question: i'm not sure at 100% you are right: maybe I'm wronging but I'm sure that if touchgfxSignalVSync() is not called touchgfx tick is not generated. There is no activity to do on the screen because everything is rendered and showed. No tearing effect interrupt is generated by the display.

otherwise if you have an dinamic screen, everything works because touchgfxSignalVSync() is called continuously.

@Yoann KLEIN​ = Do you wanna see the project?

Thank you.

MarcoP