Touch (STMPE610 with ILI9341)

Hello,
In this thread, I got my little touch screen (Screen and touch combined in 1 unit) up and running, I have now integrated touch with it. using the following library:

Interestingly enough when running just the STMPE610 with serial output, I get fairly speedy results, BUT when I integrate it with my code for ILI9341 output everything comes to a crawl.

Everything works, but its just 4x slower (or more)

I have narrowed it down to one call into the touch library touch.touched(); I can comment that single line out (leaving all initialization code in) and it goes back to being nice and responsive, add it back in and ugh!

I have narrowed it down to a small loop that Illustrates the slowdown.
Here is my primary Loop.

void Loop(void)
{
touch.touched();
TestUI();
}

Any ideas as to why the screen output is slowed down because of a call to touch.touched?

thanks
Rod

My test UI routine does some work that takes 3-4 seconds - thats it.

I am reading this post right now as it might provide me some more details:

OK, After reading @MaxSharx and @peekay123 thread above, I deduced that I needed the “Code Shaker” and sprinkled some odds and ends lines of code around my touch.touched() method call. And it speed up.

But now, can someone please enlighten a non-EE kinda guy why this worked, and what alternatives I maybe should consider (Or is this perfectly acceptable?). I have read in different places that the IDI9341 is kinda older technology. Whould I look at a different screen and touch controller (The one I am using i found for almost nothing, and I am just experimenting, but eventually this will turn into something)

there is my code changes:

SPI.setDataMode(SPI_MODE1);
SPI.setClockDivider(SPI_CLOCK_DIV64);
touch.touched();
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV2);
TestUI();

Hi Rod,

after a quite long time I come back to my old project to find out that the problems are still the same. :smile: As @peekay123 already mentioned the two devices share the same bus but at different frequencies. Because of the interferences you can’t get stable operation. I’m going crazy with that. My touch display with that two controllers won’t work together with an Photon or P1 but makes no problems with a simple Arduino Uno.
Hardware SPI, software SPI, patching, or complete new libraries nothing helps.

Regards,
Marcus