ST7789 TFT Display stops working

good morning all

trying to add a little 240x240 st7789 oled display to my project

Ive been using a standard 16,2 LCD but i want to get a bit more info on the screen so moving to the oled

I've got it working up to a point right now I'm just duplicating code for the oled that the lcd displays and all was working well until I started trying to display text to the screen while it is checking for my SD card.

My SD card does not have a CS pin but it is sharing clk and MOSI with the SD card.

so the question is do i need to wait till I'm done reading the SD card to start displaying to the oled again?

here is the code snippet I am able to display to the oled until line 6 it will not display the lines past that on the oled however the lcd and everything else continues to work just fine

tft.println(" ");                                           // line 4
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Initializing...");
  lcd.setCursor(0,1);
  lcd.print("Outputs");
  tft.println("Outputs");                                     // line 5
 
  servo1.attach(8);                                                                           //assigns pin 8 to control servo 1
  servo1.write(0);                                                                            //its usually open so this closes it
  tft.println("Servo Initialized");                           // line 6

  delay(3000);
  
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Initializing");
  lcd.setCursor(1,1);
  lcd.print("SD card...");

  pinMode(SD_CS, OUTPUT);                                                                    //sets the SD cards CS pin to output
  
  delay(3000);
                                                                                            // next we see if the card is present and can be initialized:

                      
  
  if (!SD.begin(SD_CS))                                                                     //it did not see an SD card
    {
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Card Failure or");
      lcd.setCursor(1,1);
      lcd.print("not present");
      tft.println("SD CARD FAILED");                          // line 7 if failed
      delay(4000);
                                                                                            // don't do anything else you need to install a SD card
      while (1);
    }
  else                                                                                      // it did see the SD card
    {
      tft.println("SD card Intialized");                          // line 7 if passed
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("SD card found");
      lcd.setCursor(0,1);
      lcd.print("Checking config");
      tft.println("Checking for Config");                         // line 8
      delay(2000);
                                                                                            // try to open the config file
       if (SD.exists("acconfig.txt"))                                                       // the file is available
        {
          read_sd();                                                                        // runs the SD card read function
          delay(1500);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Temp set to");
          lcd.setCursor(0,1);
          lcd.print(ITT);
          lcd.setCursor(4,1);
          lcd.print("F");
          tft.println("Config Found");                                // line 9
          tft.println("loading");
          dotdotdot = 0;
            while (dotdotdot < 4)
              {
                tft.print(".");                                       // adds to line 9
                dotdotdot++;
              }
          tft.println("Config Loaded");                             // line 10
          delay(2000);
        } 
      else                                                                                        // the file is not available
        {
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("   No Config   ");
          lcd.setCursor(0,1);
          lcd.print(" Running Setup ");
          delay(1500);
          virgin();                       // runs the setup fucntion
          
        }

ST7789 is a TFT controller. AFIK, it can not control OLEDs.

Post a link to the actual ST7789 board that you have bought.
And paste or attach your complete sketch.

David.

David,

sorry I don't have anything to post in regards to that all i can tell you is its an IPS 240x240 ST7789 - i got it from one of those no name cheep electronics places and all i have is the pin out.

as i said it works. i know its plugged in correctly

also code works just fine on LCD as stated

just need to know if the issue Im having is possibly caused by the fact the sketch is trying to read or write to the sd card while also trying to write to the oled

i dont think this is going to help you answer that question but here is the sketch so far posted in to the next few reply post as its larger than the 9000 char limit

yeah never mind i just did a char count its over 32K Ive got to get to work dont have time to break that down to 9000 chars.

I know the info needed to answer this is in the first post and code snip

if you just wanna look at my var assignment

#include <Adafruit_ST7735.h>
#include <Adafruit_ST7789.h>                                                // Hardware-specific library for ST7789
#include <Adafruit_ST77xx.h>
#include <Adafruit_GFX.h>                                                   // Core graphics library for oled screen
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>

#include <gfxfont.h>                                             
#include <Servo.h>                                                          // Library for the Servos
#include <LiquidCrystal.h>                                                  // Library for the LCD screen
#include <SPI.h>                                                            // library for serial data communication almost all the hardware uses this
#include <SD.h>                                                             // library for the SD card
#include <ctype.h>                                                          // not real sure what this is for....

                                                                            //HADWARE RELATED VARIABLES

Servo servo1;                                                               //create servo object to control the first servo
Servo servo2;                                                               //create servo object to control the second servo
LiquidCrystal lcd(2,3,4,5,6,7);                                             //digital pin assignment for LCD
// the SD card interfaces over pins 50-53
                                                                            //these variables are assigning input and output pins names


const int DLS_Pin = 0;                                                      //anolog input pin for day light sensor asginment
const int IST_Pin = 1;                                                      //anolog input for inside temp sensor
const int OST_Pin = 2;                                                      //anolog input pin for outside temp sensor
const int SHT_Pin = 3;                                                      //anolog input pin for solor heater internal temp
int joy_pinx = 4;                                                           //anolog input for thumb stick x axis
int joy_piny = 5;                                                           //anolog input for thumb stick y axis
//just a note pin d8 is for the servo dont use it for something else
const int SD_CS = 53;                                                       //CS pin for SD card reader shield this will be an output    
#define TFT_CS    23                                                        // define chip select pin for oled wont need it doenst have one
#define TFT_DC    24                                                        // define data/command pin for oled
#define TFT_RST   25                                                        // define reset pin for oled

                                                                            //HARDWARE TO SOFTWARE VARIABLES HERE

                                                                            //variables for controls are blow here

int joy_pinsw = 22;                                                         //digital input for thumbstick press
                                                                            //temperature related variables
int ITT;                                                                    //internal target temp      

int IST;                                                                    //raw inside temp sensor data
int C_IST;                                                                  //inside temp in celcius
int F_IST;                                                                  //inside temp in fahrenheit

int OST;                                                                    //raw outside temp sensor data
int C_OST;                                                                  //outside temp in celcius
int F_OST;                                                                  //outside temp in fahrenheit

int SHT;                                                                    //raw solar heater temp sensor data
int C_SHT;                                                                  //solar heater temp in Celcius
int F_SHT;                                                                  //solar heater temp in fahrenheit

int DLS_value = analogRead(DLS_Pin);                                        //raw data from the day light sensor input

                                                                            //SOFTWARE Variables

                                                                            //special variables
File myFile;                                                                //not sure what this is but its for the SD card and has to be here
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);             // Initialize Adafruit ST7789 TFT library

int setup_flag;                                                             //setup flag so it knows to load from SD card or go through the setup
int self_test = 0;                                                          //flag for running boot up self test on hardware
int joysw_LBS = 10;                                                         //last button state placeholder for joystick
int DLS_Trigger;                                                            //day light sensor trigger used for if check statement
int AC_H = 3;                                                               //variable for if the ac or heater is on for the display
int menu_req;                                                               //menu request trigger
int save_flag;                                                              //flag to tell system it thinks it saved the config file
int dotdotdot;                                                              // varible used to make loading text add dots

                                                                            //arrays below here
                                                                            //this array is for the SD card data
                                                                            //this array is for the servos 

                                                                            //other varibles
int Fan_speed;
int Fan_min_speed = 0;
int Fan_max_speed = 150;
                                                                            //this is where the functions start

sorry I don't have anything to post in regards to that all i can tell you is its an IPS 240x240 ST7789 - i got it from one of those no name cheep electronics places and all i have is the pin out.

Surely you can search Ebay or AliExpress for the item. Post that link. (and say that it looks the same as the link photos)
Or you can post your own photo of the pcb.

here is the sketch so far posted in to the next few reply post as its larger than the 9000 char limit

Read the Forum Instructions. You attach a large file. The [Preview] button shows an "Attachments" option.

Seriously. Finding "the same item" on Ebay takes a few minutes. Pasting the link takes 2 seconds.
Attaching your whole INO file takes 5 seconds.

David.

David,

I do appreciate you trying to help however. my question was simple and straight forward.

can the SD card communication be causing a problem with the oled communication.

no need of my sketch or hardware specifics are required to answer this simple question.

your slightly shitty attitude is definitely not required.

I know exactly what i asked for.

If you can not answer that simple question please leave my thread alone

No problem. I will not respond to your thread.