ESP Display 5 Inch Settings

What are the correct setting (pins) to put into the tft_espi files and display type. There are no correct examples for the 5 or 7 inch which have different controllers

Comments

  • @bbrook Hello there,

    The driver library for 4.3-5.0-7.0-inch screens is not TFT_eSPI, but Arduino_GFX. Because these three screens are not SPI screens, but RGB screens.

    Here are the links to the libraries for the three screens:

    4.3-inch: https://drive.google.com/drive/folders/1EvlF0pDCMNra8kJZh4xRMjURbQ5PMZgo?usp=sharing

    5.0-inch: https://drive.google.com/drive/folders/13Dc2WL0dZWq6ObegB3QwAzsPL9LZnCm-?usp=sharing

    7.0-inch: https://drive.google.com/drive/folders/1ErqUf6u7qFaZTYgHWOLuTET5P0ZY3BIA?usp=sharing

  • I don't have the 5" screen yet, but I have one on the way. The display was recently added to the list of devices in the Arduino_GFX examples.

    These are the settings used:

    Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
        40 /* DE */, 41 /* VSYNC */, 39 /* HSYNC */, 0 /* PCLK */,
        45 /* R0 */, 48 /* R1 */, 47 /* R2 */, 21 /* R3 */, 14 /* R4 */,
        5 /* G0 */, 6 /* G1 */, 7 /* G2 */, 15 /* G3 */, 16 /* G4 */, 4 /* G5 */,
        8 /* B0 */, 3 /* B1 */, 46 /* B2 */, 9 /* B3 */, 1 /* B4 */,
        0 /* hsync_polarity */, 8 /* hsync_front_porch */, 8 /* hsync_pulse_width */, 8 /* hsync_back_porch */,
        0 /* vsync_polarity */, 8 /* vsync_front_porch */, 8 /* vsync_pulse_width */, 8 /* vsync_back_porch */,
        1 /* pclk_active_neg */, 16000000 /* prefer_speed */);
    
    Arduino_RGB_Display *gfx = new Arduino_RGB_Display(
        800 /* width */, 480 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */);
    

    I plan to use LovyanGFX with it, and based on my experience getting a couple of other Elecrow screens configured, and the Arduino_GFX config, I expect this to work:

    class LGFX : public lgfx::LGFX_Device
    {
    public:
        lgfx::Bus_RGB _bus_instance;
        lgfx::Panel_RGB _panel_instance;
        lgfx::Light_PWM _light_instance;
        lgfx::Touch_GT911 _touch_instance;
        LGFX(void)
        {
            {
                auto cfg = _panel_instance.config();
                cfg.memory_width = 800;
                cfg.memory_height = 480;
                cfg.panel_width = 800;
                cfg.panel_height = 480;
                cfg.offset_x = 0;
                cfg.offset_y = 0;
                _panel_instance.config(cfg);
            }
    
    
            {
                auto cfg = _bus_instance.config();
                cfg.panel = &_panel_instance;
    
    
                cfg.pin_d0 = GPIO_NUM_15; // B0
                cfg.pin_d1 = GPIO_NUM_7;  // B1
                cfg.pin_d2 = GPIO_NUM_6;  // B2
                cfg.pin_d3 = GPIO_NUM_5;  // B3
                cfg.pin_d4 = GPIO_NUM_4;  // B4
    
    
                cfg.pin_d5 = GPIO_NUM_9;  // G0
                cfg.pin_d6 = GPIO_NUM_46; // G1
                cfg.pin_d7 = GPIO_NUM_3;  // G2
                cfg.pin_d8 = GPIO_NUM_8;  // G3
                cfg.pin_d9 = GPIO_NUM_16; // G4
                cfg.pin_d10 = GPIO_NUM_1; // G5
    
    
                cfg.pin_d11 = GPIO_NUM_14; // R0
                cfg.pin_d12 = GPIO_NUM_21; // R1
                cfg.pin_d13 = GPIO_NUM_47; // R2
                cfg.pin_d14 = GPIO_NUM_48; // R3
                cfg.pin_d15 = GPIO_NUM_45; // R4
    
    
                cfg.pin_henable = GPIO_NUM_40;
                cfg.pin_vsync = GPIO_NUM_41;
                cfg.pin_hsync = GPIO_NUM_39;
                cfg.pin_pclk = GPIO_NUM_0;
                cfg.freq_write = 16000000;
    
    
                cfg.hsync_polarity = 0;
                cfg.hsync_front_porch = 40;
                cfg.hsync_pulse_width = 48;
                cfg.hsync_back_porch = 40;
    
    
                cfg.vsync_polarity = 0;
                cfg.vsync_front_porch = 1;
                cfg.vsync_pulse_width = 31;
                cfg.vsync_back_porch = 13;
    
    
                cfg.pclk_active_neg = 1;
                cfg.de_idle_high = 0;
                cfg.pclk_idle_high = 0;
    
    
                _bus_instance.config(cfg);
            }
            _panel_instance.setBus(&_bus_instance);
    
    
            {
                auto cfg = _light_instance.config();
                cfg.pin_bl = GPIO_NUM_2;
                _light_instance.config(cfg);
            }
            _panel_instance.light(&_light_instance);
    
    
            {
                auto cfg = _touch_instance.config();
                cfg.x_min      = 0;
                cfg.x_max      = 799;
                cfg.y_min      = 0;
                cfg.y_max      = 479;
                cfg.pin_int    = -1;
                cfg.pin_rst    = -1;
                cfg.bus_shared = false;
                cfg.offset_rotation = 0;
                cfg.i2c_port   = I2C_NUM_1;
                cfg.pin_sda    = GPIO_NUM_19;
                cfg.pin_scl    = GPIO_NUM_20;
                cfg.freq       = 400000;
                cfg.i2c_addr   = 0x14;
                _touch_instance.config(cfg);
                _panel_instance.setTouch(&_touch_instance);
            }
            setPanel(&_panel_instance);
        }
    };
    
  • edited August 2023

    Ignore the LovyanGFX settings I posted above - I had based them on the wrong source template and they don't work. Working settings are here.

Sign In or Register to comment.