ESP32 Development Board 1.9in

Hi.

Is anyone using this device?

https://www.aliexpress.com/item/1005008660741121.html?spm=a2g0o.order_list.order_list_main.5.c6461802kikBoE

I'm running this program, on the serial monitor I have Hello World, but the screen is black.

#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
//////////
#define TFT_MOSI 23  // Data out
#define TFT_SCLK 18  // Clock out

#define TFT_CS   15// // Chip select pin
#define TFT_DC    2 // Data/Command pin
#define TFT_RST   4  // pin# 2
#define BL   32

////////
/*
  //////////////////
  #define TFT_MOSI 23  // Data out
  #define TFT_SCLK 18  // Clock out
  #define TFT_CS   15//
  #define TFT_DC    21 //
  #define TFT_RST   4  // pin# 2
  //////////////////
*/
/*
  #define TFT_MOSI 23  // Data out
  #define TFT_SCLK 18  // Clock out
  #define TFT_CS   22//
  #define TFT_DC    21 //
  #define TFT_RST   -1  // pin# 2
*/
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
//Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  Serial.begin(115200);
  ///////////
  tft.init(170, 320);
  tft.setRotation(3);
  //////////

  // Clear the screen
  //tft.fillScreen(ST77XX_BLACK);//++++++++++++++++++++++++++++++++
  tft.fillScreen(ST77XX_BLUE);
  tft.setTextWrap(false); // Disable text wrapping
  tft.setTextSize(4);     // Set text size
  // tft.setTextColor(ST77XX_WHITE); // Set text color  +++++++++++++++++++
  tft.setTextColor(ST77XX_YELLOW); // Set text color

  pinMode(36, INPUT_PULLUP);
  pinMode(39, INPUT_PULLUP);

}

void loop() {
  tft.setCursor(10, 50); // Set cursor position (x, y)
  tft.print("Hello World!");
  //Serial.println("Hello world!");
  Serial.print("  39 =  "); Serial.print( analogRead(39));
  Serial.print("  36 =  "); Serial.print(analogRead(36));
  Serial.println();
  Serial.println("    Hello world!");
  //delay(1000);
}

It looks like a nice part only missing needed documentation. They provide some on the web but as we all know screen shots are generally useless as this will show. Contact the vendor for a good set of documents and if you them post for others.

Sorry I have no experience with this part.

What I do when working with a new processor is try to simply cycle each of the pins, and if successful continue on with the other hardware.

Your code looks OK but I do not have a clue if it is valid for this processor. Good Luck.

can you see if the backlight is on?
you define BL as GPIO32
from this it look like it is GPIO3
image
to say the least the documentation has lots of nice photos but lacks technical details

however, checking the test of a 1.3" ST7789 240*240 TFT on an ESP32 running
File>Examples>Adafruit_ST7735_and_ST7789_Library>graphicstest
I have a note
ESP32 - cannot get it to work - tried various SPI frequencies

in the end got it working with the TFT_eSPI library

it is off

= blue LED3 on, before was off.

try gpio2?

= already in use = #define TFT_DC 2 // Data/Command pin

Your LCD device is completely different from mine, so I have no proof, but...

When configuring the Adafruit_ST7789 library, I found that the default spi mode wouldn't work unless the following was set for my LCD.

// The default SPI mode (SPI_MODE0) does not work,
// but SPI_MODE2 or SPI_MODE3 works like a charm.
tft.init(w, h, SPI_MODE3);

Although, here may be the best solution...

can't find that

no respond

So you need:

tft.init(170, 320, SPI_MODE3);

instead of:

tft.init(170, 320);

is that so?

/*!
    @brief  Initialization code common to all ST7789 displays
    @param  width  Display width
    @param  height Display height
    @param  mode   SPI data mode; one of SPI_MODE0, SPI_MODE1, SPI_MODE2
                   or SPI_MODE3 (do NOT pass the numbers 0,1,2 or 3 -- use
                   the defines only, the values are NOT the same!)
*/
/**************************************************************************/
tft.init(170, 320, SPI_MODE3);
/*
void Adafruit_ST7789::init(uint16_t width, uint16_t height, uint8_t mode) {
  // Save SPI data mode. commonInit() calls begin() (in Adafruit_ST77xx.cpp),
  // which in turn calls initSPI() (in Adafruit_SPITFT.cpp), passing it the
  // value of spiMode. It's done this way because begin() really should not
  // be modified at this point to accept an SPI mode -- it's a virtual
  // function required in every Adafruit_SPITFT subclass and would require
  // updating EVERY such library...whereas, at the moment, we know that
  // certain ST7789 displays are the only thing that may need a non-default
  // SPI mode, hence this roundabout approach...
  spiMode = mode;
  // (Might get added similarly to other display types as needed on a
  // case-by-case basis.)

  commonInit(NULL);
  if (width == 240 && height == 240) {
    // 1.3", 1.54" displays (right justified)
    _rowstart = (320 - height);
    _rowstart2 = 0;
    _colstart = _colstart2 = (240 - width);
  } else if (width == 135 && height == 240) {
    // 1.14" display (centered, with odd size)
    _rowstart = _rowstart2 = (int)((320 - height) / 2);
    // This is the only device currently supported device that has different
    // values for _colstart & _colstart2. You must ensure that the extra
    // pixel lands in _colstart and not in _colstart2
    _colstart = (int)((240 - width + 1) / 2);
    _colstart2 = (int)((240 - width) / 2);
  } else {
    // 1.47", 1.69, 1.9", 2.0" displays (centered)
    _rowstart = _rowstart2 = (int)((320 - height) / 2);
    _colstart = _colstart2 = (int)((240 - width) / 2);
  }

  windowWidth = width;
  windowHeight = height;

  displayInit(generic_st7789);
  setRotation(0);
}
*/

I have the same or similar mcu this works for me all I had to add was
pinMode(BL, INPUT_PULLUP); digitalWrite(BL, HIGH); in setup that turns the back light on it was off before

#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
//////////
#define TFT_MOSI 23 // Data out
#define TFT_SCLK 18 // Clock out

#define TFT_CS 15// // Chip select pin
#define TFT_DC 2 // Data/Command pin
#define TFT_RST 4 // pin# 2
#define BL 32

////////
/*
//////////////////
#define TFT_MOSI 23 // Data out
#define TFT_SCLK 18 // Clock out
#define TFT_CS 15//
#define TFT_DC 21 //
#define TFT_RST 4 // pin# 2
//////////////////
/
/

#define TFT_MOSI 23 // Data out
#define TFT_SCLK 18 // Clock out
#define TFT_CS 22//
#define TFT_DC 21 //
#define TFT_RST -1 // pin# 2
*/
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
//Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

void setup() {
Serial.begin(115200);
///////////
tft.init(170, 320);
tft.setRotation(3);
//////////

// Clear the screen
//tft.fillScreen(ST77XX_BLACK);//++++++++++++++++++++++++++++++++
tft.fillScreen(ST77XX_BLUE);
tft.setTextWrap(false); // Disable text wrapping
tft.setTextSize(4); // Set text size
// tft.setTextColor(ST77XX_WHITE); // Set text color +++++++++++++++++++
tft.setTextColor(ST77XX_YELLOW); // Set text color

pinMode(BL, INPUT_PULLUP);
digitalWrite(BL, HIGH);

}

void loop() {
tft.setCursor(10, 50); // Set cursor position (x, y)
tft.print("Hello World!");
//Serial.println("Hello world!");
Serial.print(" 39 = "); Serial.print( analogRead(39));
Serial.print(" 36 = "); Serial.print(analogRead(36));
Serial.println();
Serial.println(" Hello world!");
//delay(1000);
}