mstrens / grbl_controller_esp32

grbl controller for esp32
177 stars 81 forks source link

2.8inch_ESP32-2432S028R display support #55

Closed Dudley1001 closed 1 year ago

Dudley1001 commented 1 year ago

I purchased this 2.8inch_ESP32-2432S028R display as it had esp32 wroom, ILI9341 TFT driver and XPT2046 touch screen driver as well as sdcard reader on one board. The screen is 2.8" 240x320. When I received it I found the io pin routing are different as the tft, touch and sdcard are all hard wired to different mosi, moso ,sck pins. I was able to get the tft and sdcard working but not the touch. I set the config.h to TFT_CARD_VERSION 2 as this allowed for vspi and hspi to be used. The user_setup. h and config were also changed to the pin assignments for the board. Everything compiled properly and the screen works but I get stuck on the calibration screen. I put a calibrate.txt on the sdcard and that is detected but no touch. I tried the touch test sketch but no input response when viewed in serial monitor. I am fairly new to esp32 programming but it seems that only 2 spi channels are available and this looks like it should require 3. I thought about cutting traces and rewiring but if a software solution was available I think this would make a great screen for this project. I hope to use it with my mpcnc running on a PandaZhu esp32 board running grbl.

From the User Guide / Sample Code / Schematic :

define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172

define TFT_WIDTH 240

define TFT_HEIGHT 320

define TFT_BL 21 // LED back-light control pin

define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)

define TFT_MOSI 13 // In some display driver board, it might be written as "SDA" and so on.

define TFT_SCLK 14

define TFT_CS 15 // Chip select control pin

define TFT_DC 2 // Data Command control pin

define TFT_RST 12 // Reset pin (could connect to Arduino RESET pin)

define TFT_BL 21 // LED back-light

define SPI_FREQUENCY 55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz)

// Optional reduced SPI frequency for reading TFT

define SPI_READ_FREQUENCY 20000000

Touch Screen:

define XPT2046_IRQ 36

define XPT2046_MOSI 32

define XPT2046_MISO 39

define XPT2046_CLK 25

define XPT2046_CS 33

// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:

define SPI_TOUCH_FREQUENCY 2500000

SD CARD READER: IO 5 - CS IO 23 - MOSI IO 18 - CLK IO 19 - MISO

Dudley1001 commented 1 year ago

Getting started 2.8 Inch.pdf ESP32-2432S028-LCM ESP32-2432S028-MCU

Dudley1001 commented 1 year ago

should add, I am using the latest Grbl_controller_esp32_master, esp32 extension 1.04, SDFAT 2.06

Dudley1001 commented 1 year ago

I cut the traces to the touch xpt2046 mosi, miso and clk and tied them to the mosi, miso and clk for the sd card and enabled HSPI and that got the tft, touch and sd working.