Skip to content

Different board compatibility. #1

Description

@benek984

Hello,

Nice project I really like it. As soon as I found it I decided to give it a go. Unfortunately, I did not have exact esp32 board with display as you have so I decided to use what I have.
Board I have is https://amzn.eu/d/09oqYNFQ

It took me a while to get it working on my board so I wanted to share differences:

CYD2USB Rev.3 (ESP32-2432S028) Hardware Settings

Hardware reference for adapting the CrowPanel Admin Pocket Toolkit to the CYD2USB Rev.3 board.

Board

  • Name: ESP32-2432S028 Rev.3 (CYD2USB)
  • MCU: ESP32-WROOM-32
  • Display: 2.8" 320x240 ST7789 TFT
  • Touch: XPT2046 resistive touch controller
  • USB: Two connectors (USB-C + Micro-USB), CH340 USB-to-serial

Display (HSPI)

Signal GPIO
MISO 12
MOSI 13
SCLK 14
CS 15
DC 2
RST -1 (tied to ESP32 RST)
Backlight 21 (active HIGH)

Note: tft.invertDisplay(true) is required for ST7789 on Rev.3.

Touch (separate VSPI bus)

Key difference from CrowPanel: The XPT2046 touch controller is on a separate SPI bus (VSPI), not shared with the display.

Signal GPIO
SCLK 25
MISO 39
MOSI 32
CS 33
IRQ 36

TFT_eSPI Build Flags

-D USER_SETUP_LOADED=1
-D ST7789_DRIVER=1
-D TFT_WIDTH=240
-D TFT_HEIGHT=320
-D TFT_MISO=12
-D TFT_MOSI=13
-D TFT_SCLK=14
-D TFT_CS=15
-D TFT_DC=2
-D TFT_RST=-1
-D TFT_BL=21
-D USE_HSPI_PORT
-D TFT_BACKLIGHT_ON=HIGH
-D LOAD_GLCD=1
-D LOAD_FONT2=1
-D LOAD_FONT4=1
-D SPI_FREQUENCY=55000000
-D SPI_READ_FREQUENCY=20000000
-D SPI_TOUCH_FREQUENCY=2500000

Touch Library

TFT_eSPI's built-in getTouch() does not work on this board because it reads touch via HSPI, but the XPT2046 is wired to VSPI.

Solution: Use a separate SPIClass(VSPI) for touch:

#define TOUCH_CS   33
#define TOUCH_IRQ  36
SPIClass touchSPI(VSPI);

// In setup():
touchSPI.begin(25, 39, 32, TOUCH_CS);  // SCLK, MISO, MOSI, SS
pinMode(TOUCH_CS, OUTPUT);
digitalWrite(TOUCH_CS, HIGH);
pinMode(TOUCH_IRQ, INPUT);

Raw XPT2046 SPI commands (via touchSPI.transfer()):

  • Z1 detection: Command 0xB1, read Z2 with 0xC1, read X dummy with 0x91
  • X position: Command 0x91
  • Y position: Command 0xD1
  • Power down: Command 0xD0 followed by 0x00

Touch Calibration

After adapting, the axes are swapped and one is inverted compared to the CrowPanel. Typical mapping:

// Raw XPT2046 → screen coordinates (CYD2USB Rev.3)
int16_t screenX = map(rawY, TOUCH_Y_MIN, TOUCH_Y_MAX, 0, 320);
int16_t screenY = map(rawX, TOUCH_X_MIN, TOUCH_X_MAX, 0, 240);

Default calibration ranges (may vary per unit):

#define TOUCH_X_MIN  200
#define TOUCH_X_MAX  3800
#define TOUCH_Y_MIN  200
#define TOUCH_Y_MAX  3800

Additional GPIO

GPIO Usage
4 LED data pin (active LOW)
12 Reserved for WS2812B LEDs

Differences from CrowPanel 2.8"

Feature CrowPanel CYD2USB Rev.3
Display driver ILI9341 ST7789
Display MISO GPIO 4 GPIO 12
Backlight pin GPIO 27 GPIO 21
Touch SPI bus HSPI (shared with display) VSPI (separate bus)
Touch MISO GPIO 4 GPIO 39
Touch SCLK GPIO 14 GPIO 25
Touch MOSI GPIO 13 GPIO 32
Touch IRQ - GPIO 36
invertDisplay false true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions