RetroD
Member
I'm working on displaying the files from an SD card on the ILI9341 LCD I bought from Adafruit (https://learn.adafruit.com/adafruit-2-dot-8-color-tft-touchscreen-breakout-v2/overview ) It has a built in microSD card reader on the back.
The SD card and LCD work just fine independently of each other, but as soon as I add SD.begin() after tft.begin() the LCD doesn't update. I'm suspecting it has something to do with either one of the libraries not properly setting the CS pin high, or that the SD library configures the SPI bus differently than the TFT library.
My wiring configuration is:
My code is as follows:
Thank you for you help in advance.
The SD card and LCD work just fine independently of each other, but as soon as I add SD.begin() after tft.begin() the LCD doesn't update. I'm suspecting it has something to do with either one of the libraries not properly setting the CS pin high, or that the SD library configures the SPI bus differently than the TFT library.
My wiring configuration is:
Code:
TEENSY | TFT | SD
Pin 8 | x | CS
Pin 9 | DC | x
Pin 10 | CS | x
Pin 11 | MOSI \
Pin 12 | MISO >- Wired to both TFT and SD
Pin 13 | SCK /
My code is as follows:
Code:
#include <SD.h>
#include <SPI.h>
#include "ILI9341_t3.h"
#define TFT_DC 9
#define TFT_CS 10
#define SD_CS 8
File sdFile;
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
void setup() {
pinMode(SD_CS, INPUT_PULLUP);
delay(200);
pinMode(TFT_CS, INPUT_PULLUP);
delay(200);
Serial.begin(9600);
while(!Serial){}
if(!SD.begin(SD_CS)){
Serial.println("Card failed or isn't present");
return;
}
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextSize(1);
tft.setTextColor(ILI9341_WHITE);
tft.setCursor(0,0);
tft.println(F("This doesn't print!"));
}
void loop() {
}
Thank you for you help in advance.