Can anyone confirm they have used both touch and SD card in an app running on the CYD ? Im finding that the SD card mysteriously cant open files after touch is started. I read a suggestion to use different HSPI and VSPI but I dont see how to tell tft which SPI to use, nor how that would change any hardwired connections.
Hello Alex,
We’ll be adding that content to our LVGL eBook in the next update (likely in less than 2 months). At the moment I don’t have any examples or guides for Touch + Display + SD Card, but they will be provided in the next eBook update.
Regards,
Sara
OK, I look forward to that update.
In the meantime I had the idea of switching off the touchscreen just before any SD card activty, enabling the SD to do the read/write, then switching the SD off and re-start the touch to continue the app.
I’ll let you know how that goes by updating your BME example.
Best !
I dont want to diminish the value of your coming book, because I am an enthusiastic reader of your books and postings.
I found the raised question several times on the internet. The solution is very easy and can be done right now:
* Use SPI1 HW-SPI for Display
* Use SPI2 HW-SPI for Touchscreen
* Use SoftSPI for SDcard
Start your code her
from machine import SPI, Pin, SoftSPI
# Set up sd
sd_spi = SoftSPI(sck=Pin(SD_SCK_PIN), mosi=Pin(SD_MOSI_PIN), miso=Pin(SD_MISO_PIN))
sd = sdcardRNT.SDCard(sd_spi, Pin(SD_CS_PIN))
# Set up display
display_spi = SPI(1, baudrate=60000000, sck=Pin(DISP_SCK_PIN), mosi=Pin(DISP_MOSI_PIN))
display = Display(display_spi, dc=Pin(DISP_DC_PIN), cs=Pin(DISP_CS_PIN),
rst=Pin(DISP_CS_PIN), width=320, height=240, rotation=90)
#Set up touchscreen
ts_spi = SPI(2, sck=Pin(TS_SCK_PIN), mosi=Pin(TS_MOSI_PIN), miso=Pin(TS_MISO_PIN))
touchscreen = Touch(ts_spi, cs=Pin(TS_CS_PIN), int_pin=Pin(TS_INT_PIN), int_handler=touchscreen_press)