• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Touch and SD card usable at same time on CYD ?

Q&A Forum › Category: ESP32 › Touch and SD card usable at same time on CYD ?
0 Vote Up Vote Down
Alex Chalmers asked 3 months ago

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.

Question Tags: SD and touch on CYD ?
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 months ago

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

0 Vote Up Vote Down
Alex Chalmers answered 3 months ago

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 !

0 Vote Up Vote Down
Sara Santos Staff answered 3 months ago

Ok.
Then, let us know.
regards,
Sara

0 Vote Up Vote Down
Peter Poesel answered 2 months ago

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)
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 months ago

Hi.
Thanks for sharing that solution for micropython.
We haven’t experimented that with MicroPython yet.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.