Seeds Studio Round Display & CircuitPython : using SD card + TFT

I try to use the TFT display and the SD card at the same time that are presnt on the Seeeds Studio “Round Display”.

So far, I managed to:

  1. use the TFT with SPI bus initialized using MOSI and SCK pins.
  2. use the SD card(*) with with SPI bus initialized using MISO, MOSI and SCK pins.

But I cannot use both at the same time.
Shall I try to multiplex their usage, I mean to spi.deinit() each time I need to use the SPI with a different set of pins or do something else?

(*I can detect the card, create a vfs object, format the card, but not mount it yet. As I have the same issue on my Laptop with the SD card I assume I will fix this just changing the card: it times out at some init stage.)

Other infos:

  • I use a XIAO ESP32C3 with Circuit Python 9.0.5 (and occcasionally an ESP32C6 with recent CircuitPython nightly builds from S3)
  • Even if not plugs are present for this on the Round Display, I use other I2C sensors plugged “my way” on the I2C pins of my boards. This works well.

Hi there,
So what pins do you use for the CS ?
Just deassert it and you should be able to use both?
Post up the code and all tha smart folks here will comment and help.
GL :slight_smile: PJ

Thanks, nice question as I realise I do not understand yet this step of the code:

TFT case, I use:
spi_bus = busio.SPI(clock= board.D8, MISO=board.D9)
displayio.FourWire(spi_bus, command=board.D3, chip_select=board.D1)

SD card case, I use:
spi_bus = busio.SPI(clock= board.D8, MISO=board.D9, MOSI=board.D10)
cs = digitalio.DigitalInOut(board.D2)
sdcard = adafruit_sdcard.SDCard(spi_bus, cs)

I mean, I don’t know if the pins can be shared or are of excluive usage regarding the spi bus. I don’t know yet how to use CS, but this sounds what I need maybe.

Thanks for your help!

Hi there,
Yes that is correct and SPI is a shared bus you can if you , use some pin control to differentiate between the two SPI devices. SD card is D2 and Display would be D1, also the begin() can be used to include the CS for whichever device your talking to.
Take a look at the "gif player/viewer code for the Xiao Round display example. That may clear up how it’s done.
The TFT_eSPI lib handles the display , you only need the SD part to look at.
GL :slight_smile: PJ