I am building a project where some data are read from SD card, and after being processed are written on a TFT screen.
The SD card is mounted on a simple module, and the screen is a 1.8" Adafruit display with the ST7735R driver. They both use the SPI interface.
When i run the program that read data from SD and after processing write them on the Serial Monitor, there are no problems. But when i add to the code, the initialization of the TFT, I can't read anything from the Serial Monitor.
All these instruction are inside the Void Setup(), in a while(file.available()) cycle. Even if I try to text something on the screen nothing appears.
But if i put the same instruction outside the while cycle, both the TFT and the Serial Monitor works.
I am sure that the file is always available.
Does the SD module have level shifting on it? Where did you get thenSD module? Can you post photosnof it (front and back)?
Many of the SD modules available have the MISO line running through a level shifter (like a 4051 chip). Because of that the MISO line is not released properly. As a result those SD modules cannot share the SPI bus. The answer is is to get a module that has the MISO signal that bypasses the level shifter like the Adafruit SD module.
What if I define new pins for MOSI and CLK in the initialization of the TFT?
Something like: TFT(cs, dc, mosi, sclk, rst); (copied from arduino resources), so I can separate the two SPI (?).
Aadafruit #1947 Is a TFT, cap touch screen with sd card on back, pugs directly into an arduino.
Here's an example.. Example of screen. I use a teensy 3.2 to run these mainly because it has 64K Ram instead of the 2K on the Arduino. Once you start doing GUIs, even little ones, RAM gets important.
Although the SD card is on the touch screen, you still have to "talk" to it separately. But, at least if you use this, Adafruit's example code runs both. So you can leverage off of that.