Xpt2046 draws lines across and down screen

see video…
1357
It continues to bottom of screen and stops

if…
from xpt2046 import xpt2046
and
touch = xpt2046(transpose=False, cs=12)
are commented out no problem

import lvgl as lv
import lvesp32
from ili9341 import ili9341
from xpt2046 import xpt2046
lv.init()
disp = ili9341(miso=19, mosi=23, clk=18, cs=14, dc=27, rst=33,  backlight=32, backlight_on=1, rot=ili9341.LANDSCAPE, width=320, height=240)
touch = xpt2046(transpose=False, cs=12)

scr = lv.scr_act()
lbl = lv.label(scr)
lbl.set_text("Text")
lbl.align(scr, lv.ALIGN.CENTER, 0, 0)
lv.scr_load(scr)

I have the exact same issue with the xpt2046 on the shared spi bus. How can we solve it?

@amirgon Do you have any insights here?

Back then when I wrote these drivers I tested them together and they worked well. I didn’t see this problem.
I would need to try to reproducing it on my side to debug this. Currently I’m a bit busy, I hope I could find some time for this eventually.
Without debugging it’s hard to say what the problem is. I can only guess this could be something related to the shared SPI.

  • First thing I suggest trying out is testing this with different SPI hosts, to see if it’s related to shared SPI bus.
    ili9341 and xpt2046 can each be configured with different SPI host (spihost=esp.HSPI_HOST, spihost=esp.VSPI_HOST).
  • Maybe it’s related to the transposed width/height, worth checking if this happens without modifying this setting.
  • Maybe it’s related to the selection of pins (miso, mosi, clk, cs, dc, rst), perhaps these pins were configure for other purposes. Try changing to different pins.

Please try this out, if you can, and let me know the results.

1 Like

in ili9341.py file, changing power=14 to power=-1 fixed issue

def __init__(self,miso=19, mosi=23, clk=18, cs=14, dc=27, rst=33, power=-1, backlight=32, 

        backlight_on=1, power_on=1, spihost=esp.HSPI_HOST, mhz=40, factor=4, hybrid=True, 

        width=320, height=240, colormode=COLOR_MODE_BGR, rot=LANDSCAPE, invert=False, double_buffer=True

    ):
1 Like

Thanks for this update!

“power” should be the pin number of the power pin (or power switch) to ili9341.
If ili9341 is hard wired to power, it should be set to -1.

Looking at your code, I can see you were using pin 14 for both cs and power, which, of course, cannot work correctly.

That fixed it for me on a Wemos D32pro + D1 Mini TFT Shield (2.4")