Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-2432S022 2.2" tft with ST7789 parallel driver not working with TFT_eSPI library #3281

Open
dart1280 opened this issue Apr 15, 2024 · 5 comments

Comments

@dart1280
Copy link

Have you got any further with a parallel interface TFT? https://www.aliexpress.com/item/1005006284154750.html and https://www.aliexpress.com/item/1005006622769773.html

1/ display just displays the backlight - no other activity from any sketch

2/Arduino IDE

3/ TFT_eSPI library version 2.5.43

4/ ESP32 by Espressif version 2.0.15

5/ ESP32 dev

6/ TFT Driver tried both ST7789 and ST7789_2

7/ Parallel interface

8/ Read_User_Setup result

19:19:55.307 -> TFT_eSPI ver = 2.5.43
19:19:55.307 -> Processor = ESP32
19:19:55.307 -> Frequency = 240MHz
19:19:55.307 -> Transactions = Yes
19:19:55.307 -> Interface = Parallel
19:19:55.307 -> Display driver = 778B
19:19:55.307 -> Display width = 240
19:19:55.341 -> Display height = 320
19:19:55.341 ->
19:19:55.341 -> TFT_CS = GPIO 17
19:19:55.341 -> TFT_DC = GPIO 16
19:19:55.341 -> TFT_WR = GPIO 4
19:19:55.341 -> TFT_RD = GPIO 2
19:19:55.341 ->
19:19:55.341 -> TFT_D0 = GPIO 15
19:19:55.341 -> TFT_D1 = GPIO 13
19:19:55.341 -> TFT_D2 = GPIO 12
19:19:55.341 -> TFT_D3 = GPIO 14
19:19:55.341 -> TFT_D4 = GPIO 27
19:19:55.341 -> TFT_D5 = GPIO 25
19:19:55.341 -> TFT_D6 = GPIO 33
19:19:55.341 -> TFT_D7 = GPIO 32
19:19:55.341 ->
19:19:55.341 -> TFT_BL = GPIO 0
19:19:55.341 -> TFT_BACKLIGHT_ON = HIGH
19:19:55.341 ->
19:19:55.341 -> Font GLCD loaded
19:19:55.341 -> Font 2 loaded
19:19:55.341 -> Font 4 loaded
19:19:55.341 -> Font 6 loaded
19:19:55.381 -> Font 7 loaded
19:19:55.381 -> Font 8 loaded
19:19:55.381 -> Smooth font enabled

Setup4_ESP322432S022.zip

TFT_Meters.zip

Specifications from supplier -
ESP32-2432S022 Specifications-EN.zip

Display works fine using the supplied parameters with LVGL Library.

@lsdlsd88
Copy link

pretty sure the issue is GPIO over 31 for data..

#940

@dart1280
Copy link
Author

Hi Isdlsd88,
Thanks for your reply. If it is an issue with selecting data pins over 31 then I wonder how it is that this display works fine when using the LGFX library with the same data pin designations -

LGFX_Sprite canvas;

class LGFX : public lgfx::LGFX_Device {

  lgfx::Panel_ST7789 _panel_instance;  // ST7789UI
  lgfx::Bus_Parallel8 _bus_instance;   // MCU8080 8B

public:
  LGFX(void) {
    {
      auto cfg = _bus_instance.config();
      cfg.freq_write = 25000000;
      cfg.pin_wr = 4;
      cfg.pin_rd = 2;
      cfg.pin_rs = 16;
      cfg.pin_d0 = 15;
      cfg.pin_d1 = 13;
      cfg.pin_d2 = 12;
      cfg.pin_d3 = 14;
      cfg.pin_d4 = 27;
      cfg.pin_d5 = 25;
      cfg.pin_d6 = 33;
      cfg.pin_d7 = 32;

      _bus_instance.config(cfg);
      _panel_instance.setBus(&_bus_instance);
    }

Is it possible that this over 31 issue is not the cause of the TFT_eSPI library not working with this configuration?

I do not have access to changing the pin designations as the display and uP are soldered on a pcb from the shop. True, they do 'push' the LGFX library in their manual supplied with the display but I think the TFT_eSPI library is nicer..... If It Works!

Anyhow... thanks.

@lsdlsd88
Copy link

lsdlsd88 commented Apr 19, 2024

yeah im afraid is due to how this library manages writes on data pins. it says right in the user setup that you cant use them over 31.

// Must use pins in the range 0-31 for the data bus
// so a single register write sets/clears all bits

it would be nice if a patch can be added optionally for supporting these boards!

EDIT: its a hack but it works.. ran a couple of jumper wires between GPIOs 5-33 and 26-32. these were used for SD_CS and Audio. depending on your application this may or may not be acceptable :)

`Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0

TFT_eSPI library test!
Benchmark Time (microseconds)
Screen fill 100701
Text 6961
Lines 40358
Horiz/Vert Lines 9608
Rectangles (outline) 6117
Rectangles (filled) 238274
Circles (filled) 29257
Circles (outline) 13764
Triangles (outline) 10039
Triangles (filled) 80796
Rounded rects (outline) 9476
Rounded rects (filled) 242099
Done!
`

jumpers
screen

@dart1280
Copy link
Author

dart1280 commented Apr 20, 2024

Ah..I see. OK many thanks.

It looks on your photo that you have patched gpio33 to gpio4, not 5, but seeing as 4 is already used on this board for TFT_WR it must just be a trick of the light! edit: ah yes, I see you have soldered to the TF card pin for gpio 5. Presumably the solder on GPIO4 is from a previous hack?

Maybe a better choice of pins would be GPIO21 and GPIO 22 as the screen doesn't have a capacitive touch screen so you would still be able to use the TF card and audio?

I also think perhaps if I decide to do it I would swap them around to avoid the jumpers crossing - 33 to 26 and 32 to 5.

I'm not 100% sure it would be worthwhile pursuing this too much more because the 2.2" variant seems a lot less popular than the 2.8" one that uses an IL9341 driver and doesn't suffer from this problem.

For anybody also following along I think this is the fix.

ESP32_Wroom-32

Then change

 TFT_CS = GPIO 17
 TFT_DC = GPIO 16
 TFT_WR = GPIO 4
 TFT_RD = GPIO 2

 TFT_D0 = GPIO 15
 TFT_D1 = GPIO 13
 TFT_D2 = GPIO 12
 TFT_D3 = GPIO 14
 TFT_D4 = GPIO 27
 TFT_D5 = GPIO 25
 TFT_D6 = GPIO 26
 TFT_D7 = GPIO 5

Thanks again for your time.

Mike

@lsdlsd88
Copy link

yeah sorry for the confusion the red wire on gpio4 was just to take advantage of that touch pin to wake up from deep sleep.

yeah you can steal pins from the tft touch too. swapping them instead of bridging would involve cutting the small track that originally goes to the tft. doable but tricky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants