Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Cant get ST7735 display working with Teensy 4.1

Status
Not open for further replies.

Salchicha

New Member
I have an ST7735 (from A-ZDelivery) and a Teensy 4.1, whatever I do I just can get the screen to even come on at all, its connected up as follows:

LED > 36
SCK > 13
SDA > 11
A0 > 33
RESET > 7
CS > 2
GROUND > GROUND
VCC > 5V

C++:
#include <Adafruit_GFX.h>    // Include the Adafruit GFX Library
#include <Adafruit_ST7735.h> // Include the Adafruit ST7735 Library
#include <SPI.h>

#define mosi      11
#define TFT_CS    2
#define TFT_RST   7
#define TFT_DC    33
#define TFT_SCLK  13
#define BACKLIGHT_PIN 36

//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST, TFT_SCLK);
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
void setup() {

Serial.begin(9600);
Serial.print(F("init 1.8 tft screen"));
tft.initR(INITR_GREENTAB); // Init ST7735S chip, black tab
Serial.println(F("Initialized"));
tft.fillScreen(ST77XX_BLACK);
drawtext("Hello! from \n AZ-delivery", ST77XX_RED);
delay(1000);
fillScreenBlink(ST77XX_WHITE, ST77XX_RED);
delay(500);
Serial.println("done");
delay(1000);

}

void loop() {

 Serial.print("Running....");
Serial.print("\n");

tft.invertDisplay(true);
delay(500);
tft.invertDisplay(false);
delay(500);

}

void drawtext(char *text, uint16_t color) {

tft.setCursor(0, 50);
tft.setTextColor(color);
tft.setTextSize(2);
tft.setTextWrap(true);
tft.print(text);
}
void fillScreenBlink(uint16_t color1, uint16_t color2) {
tft.fillScreen(color1);
delay(1000);
tft.fillScreen(color2);
}
 
Try adding
C++:
Wire.begin();

to the start of the setup section (prior to any display init), to initialise the SPI port?
I think that's to initialize I2C. I think he needs
SPI.begin()
 
Tried both and still nothing.....is it supposed to show so some sort of life when connected to power even with no/incorrect code?

No, it's completely dead until it's initialised by the processor.

Assuming the code is correct and working, then the usual problems are wrong SPI connections, or wrong SPI settings.

If the backlight lighting up?.

This website here:


Suggests various alternatives for CS and D/C, none of which are pin 2 or pin 33 - are thos pins perhaps used by the Teensy?
 
I was looking at the TFT_SCK definition.. Although its not needed the mosi definition will be for Arduino not teensy. you may have to specify them differently Pin 13 is the builtin LED maybe move the SPI to SPI1
I seem to remember the Teensy JSON has a pin map to make it usable.
Try not defining any pin other than CS, DC and RST just in case its wobbling the library.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top