Having trouble with ST7735S display

I recently got an SPI ST7735S display (https://www.amazon.co.uk/dp/B07QJVG8QX?psc=1&ref=ppx_yo2ov_dt_b_product_details) along with a seeed xiao esp32c3 board to try and mess about with displaying stuff on a screen. Looking at the board, it seems to have the labels for the I2C protocol (SCL and SDA pins) instead of the SPI ones. I have also seen comments on amazon mentioning its definitely an SPI board not I2C but that they still got it working.

I've got a basic setup as follows (seeed board --> display):

GND --> GND

3V3 --> VCC
(also tried 5V --> VCC)

MOSI --> SDA

SCK --> SCL

D0 --> CS

D1 --> RES

D2 --> DC

Heres the pin diagram for the seeed board:
Pin diagram for the seeed XIAO board

Heres my code example currently. The expected behavior is to turn the screen blue when starting. I am using the Arduino IDE to program with extra libraries installed (Getting Started with Seeed Studio XIAO ESP32C3 | Seeed Studio Wiki)

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>

#define TFT_CS     0
#define TFT_RST    1
#define TFT_DC     2

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  SPI.begin();
  tft.initR(INITR_BLACKTAB);
  tft.setRotation(1);
  
  // Fill the screen with blue color
  tft.fillScreen(ST77XX_BLUE);
}

void loop() {}

The code compiles and uploads with no errors. I have tried various example projects to no avail either. Am I missing something or are my pin connections wrong?

I don't know, because I don't know what board you select to compile for.
For each board there is a pins_arduino.h, which specifies the default HW SPI pins.
With ESP32 processors, you can select other pins for HW SPI, by parameter in the SPI.begin() method. This allows to remap the pins of the HW SPI HW part of the processor to different IO pins.

Im compiling for the XIAO_ESP32C3 board. The libraries I used and installed were the esp32 libs shown in this startup guide (Getting Started with Seeed Studio XIAO ESP32C3 | Seeed Studio Wiki)

static const uint8_t SS    = 20;
static const uint8_t MOSI  = 10;
static const uint8_t MISO  = 9;
static const uint8_t SCK   = 8;

https://github.com/espressif/arduino-esp32/blob/master/variants/XIAO_ESP32C3/pins_arduino.h

Those seem correct based off of what I was using. I also tried to use the pins manually with

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

and the MOSI AND SCLK manually defined to 10 and 8 but that didn't work either

You are defining these by GPIO#, not D#. GPIO2 maps to D1, and GPIO1 maps to D0, but GPIO0 maps to nothing as far as I can see. I believe what you want is

#define TFT_CS     D0
#define TFT_RST    D1
#define TFT_DC     D2

A stupid oversight on my part. Thank you. This solved my issue

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.