1.8TFT SD card and display (ST7735)

Hi guys, I am trying to initialize the sd card on board this 1.8 TFT using this but I'm pretty sure my wiring is incorrect. From what I've read, I'm supposed to connect the SD card's MOSI(14) , MISO(13) and SCK(12) to the same 11, 12 and 13 UNO pins that are already in use by the display. I tried this, but it didn't seem to change things, my SD initialization always fails. Using the display without trying to load a bitmap works fine.

I did not see any mention of CS wiring there? If you haven’t already, you need to choose a chip select pin and wire it to CS on the Sd card. It’s already in the sketch as pin 4. This selects the device and without it the Device ignores any communication.

Yes, you share devices on the SPI bus:

SD_MOSI, TFT_SDA = 11
SD_MISO = 12
SD_SCK, TFT_SCK = 13
SD_CS = 4
TFT_CS = 10
TFT_A0 = 8
TFT_RST = 9

All TFT controllers are 3.3V.
Connect the pins as described above to 3.3V logic e.g. a Uno clone with a 3.3V/5V slide switch.
The Adafruit example programs should work fine.

The TFT controller logic pins are not voltage tolerant.
You should use series resistors, voltage dividers or level shifter chips with 3.3V TFT controllers.

Since your Blue display looks as if it is designed for an 8051 LCD socket, it might have some form of level protection e.g. series resistors. It might work on a 5V Uno. The ST7735 will not emit smoke immediately. It will have a short life.

David.

davetcc:
I did not see any mention of CS wiring there? If you haven’t already, you need to choose a chip select pin and wire it to CS on the Sd card. It’s already in the sketch as pin 4. This selects the device and without it the Device ignores any communication.

Hi Dave, yes I have SD CS connected to pin 4 as shown in my original diagram. Any other ideas?

david_prentice:
Yes, you share devices on the SPI bus:

SD_MOSI, TFT_SDA = 11

SD_MISO = 12
SD_SCK, TFT_SCK = 13
SD_CS = 4
TFT_CS = 10
TFT_A0 = 8
TFT_RST = 9



All TFT controllers are 3.3V. 
Connect the pins as described above to 3.3V logic e.g. a Uno clone with a 3.3V/5V slide switch.
The Adafruit example programs should work fine.


The TFT controller logic pins are not voltage tolerant.
You should use series resistors, voltage dividers or level shifter chips with 3.3V TFT controllers.

Since your Blue display looks as if it is designed for an 8051 LCD socket, it *might* have some form of level protection e.g. series resistors. It *might* work on a 5V Uno. The ST7735 will not emit smoke immediately. It will have a short life.

David.

Hi David Prentice, as I said I had already tried to connect both the SD and TFT to the same hardware SPI pins without any result. However I took everything apart and tried again just in case. The LCD powers up and stays white with nothing showing. As soon as I remove the SD MISO and MOSI connections, the LCD displays properly. Any other ideas?

I have several ST7735S displays. They all work with SD and 3.3V logic e.g. from Seeeduino, Zero, Due, ....

Think about it. Adafruit make their own displays which obviously work 100% with their own library software.
Look at the Adafruit schematics. They provide 3.3V level shift.

Post a link to your actual display. A photo of the pcb would show whether the board is 5V tolerant.

David.

Hi @David_prentice I took your advice and I went ahead and procured a new display that supports 3.3/5V level shifting on the board (sainsmart 1.8). However, this SD initialization fails as well. The code below is where the failure comes from and is essentially the first step in using the SD card. I have confirmed that SD_CS is #defined to 4 and that the jump from uno pin 4 to SD CS on the display is correct.

Serial.print("Initializing SD card...");
  if (!SD.begin(SD_CS)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");

SD.begin is supposed to assert SD_CS but I noticed that if I do it manually, this check passes. However, the following step fails where it tries to read the file. I must be missing something more fundamental, right? This seems like a task that many people have done in the past very simply.

1 Like

I clicked on your link. Of course Sainsmart do not provide a photo of the green pcb.

However, I have a green pcb that "looks" very similar from the front. And it has resistor pack RN2 for the microSD and RN1 for the TFT.

I am sure that I have tried the microSD with the TFT. But I can't find the "adapter" that I would have made to convert the green pinout to the regular red pinout used by red 3.3V ILI9341, ILI9163, ST7735 boards.

So it looks like I will have to make a new adapter. I assume that the resistor packs will make it 5V tolerant. I doubt if they will work "reliably" for the SD because resistor packs on the SD don't work on Mcufriend Mega shields.

I will report back.

Note that Red 3.3V ILI9341, ST7735 displays work fine with SD and TFT. (and XPT2046)
Obviously with 3.3V logic. It is much easier to buy a 3.3V Arduino than to mess around with 5V level converters.

David.

i decided to try a different micro sd and to do that I had to pull the tft off the breadboard. It's now working and I can display the parrot.bmp. Either it was my microsd or reseating the tft to the bread board...