Touch not working

Recurrent H/W and software problems
Post Reply
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Touch not working

Post by BeanieBots »

I have 3 displays all with XPT2046 touch controller.
The 2.8" ILI9341 all works fine.
The 3.5" ILI9481 display works, no touch.
The 4.0" IL9488 display works, no touch.
They all have the same pinout, so swapping is easy.

I have tried with ESP32 firmware 1.47 and 1.51.6 with the same results.
Any advice?
lyizb
Posts: 97
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 40 times
Been thanked: 24 times

Re: Touch not working

Post by lyizb »

I don't know if this is related, but most (if not all) ILI9488s have a corrupted MISO which confounds the use of other SPI devices on the same pin. One solution is to wire MPU MISO to touch DO, then connect touch DO to LCD MISO with a 680R resistor.

Another option is a Schottky diode from LCD_DO to MISO (anode to LCD_SDO) after cutting the track from LCD_DO to MISO. Then add a 10k resistor from LCD_CS to MISO.
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Re: Touch not working

Post by BeanieBots »

Thanks lyizb, I'll hold fire making any circuit changes for now.
I have a vague recollection of reading something along those lines a while back so I think you could be on to something.
I'll try and get a 'scope on it to look for dodgey logic levels. Then maybe have a hack.

Would there be any point in trying to use the ILI9341 driver with the ILI9488 display just to see if the touch then works?
User avatar
cicciocb
Site Admin
Posts: 1996
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 428 times
Been thanked: 1336 times
Contact:

Re: Touch not working

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sun Dec 03, 2023 5:18 pm Thanks lyizb, I'll hold fire making any circuit changes for now.
I have a vague recollection of reading something along those lines a while back so I think you could be on to something.
I'll try and get a 'scope on it to look for dodgey logic levels. Then maybe have a hack.

Would there be any point in trying to use the ILI9341 driver with the ILI9488 display just to see if the touch then works?
There is an undocumented (and "temporary") possibility to modify the sensitivity of the touch controller.

int TOUCH_THRESHOLD = 350;
int TOUCH_AVERAGE = 50;
int FIRST_TOUCH_DELAY = 30;

These are the default values that can be changed with

debug 10 threshold
debug 11 average
debug 12 delay

(attention! no commas between the arguments!)

try to reduce the value of threshold and see if this has an effect for you

example :
debug 10 200
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Re: Touch not working

Post by BeanieBots »

Thanks both. I've got family staying at the moment so it would be rude to spend any time on this right now.
I'll be able to devote time at the weekend.
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Re: Touch not working

Post by BeanieBots »

Managed to spend some time on this.
Tried the simple first. Unfortunately, using debug to change values did not help.
Connected just the touch cables and it responded OK.
Put a 'scope on LCD MISO and it was clear that there is a logic level fight going on!
Tried the 680R suggested by lyizb et voila. All is good :mrgreen:
So hopefully anyone else with these screens will find this thread.
Will probably end up with the diode/pullup version as I think that is better than having a scrap between them via 680R.

cicciocb, have you considered making those values configurable via a command? They might be useful even just as a preference for users.
lyizb
Posts: 97
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 40 times
Been thanked: 24 times

Re: Touch not working

Post by lyizb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Dec 08, 2023 10:39 pmWill probably end up with the diode/pullup version as I think that is better than having a scrap between them via 680R.
Glad it worked for you.

I haven't done it yet, but that seems the superior solution to me--fix the LCD rather than having to fix each and every PCB--though I have a number of PCBs with that 680R hack.
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Re: Touch not working

Post by BeanieBots »

By accident rather design I found that things appear to work OK by simply not connecting the LCD MISO to anything.
Not sure why/if reading the LCD would be required by Annex but reading up about Bodmer's librarys it seems he uses a read in order to produce anti-aliased graphics and maybe something to do with sprites, so we'll wait and see. More research required :roll:
For now, thanks for the solution. At least I'm up and running.
User avatar
cicciocb
Site Admin
Posts: 1996
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 428 times
Been thanked: 1336 times
Contact:

Re: Touch not working

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Dec 11, 2023 11:39 am By accident rather design I found that things appear to work OK by simply not connecting the LCD MISO to anything.
Not sure why/if reading the LCD would be required by Annex but reading up about Bodmer's librarys it seems he uses a read in order to produce anti-aliased graphics and maybe something to do with sprites, so we'll wait and see. More research required :roll:
For now, thanks for the solution. At least I'm up and running.
The MISO from the TFT is not required, except if you want take a dump of the image from the display.
SO you can simply remove it
User avatar
cicciocb
Site Admin
Posts: 1996
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 428 times
Been thanked: 1336 times
Contact:

Re: Touch not working

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Dec 08, 2023 10:39 pm cicciocb, have you considered making those values configurable via a command? They might be useful even just as a preference for users.
Probably not required, I just used them during the debug of the touchscreen.
Post Reply