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

Having trouble getting an ESP32S3 to work with an RGB Bus and Panel (EK9713, ER-TFT065-1) #487

Closed
briandilley opened this issue Dec 8, 2023 · 3 comments
Labels
stale Inactive issues

Comments

@briandilley
Copy link

Environment ( 実行環境 )

  • MCU or Board name: ESP32S (custom board)
  • Panel Driver IC: EK9713
  • Bus type: RGB (16bit)
  • LovyanGFX version: latest develop
  • FrameWork version: ArduinoESP32
  • Build Environment: PlatformIO
  • Operating System: macOS

Problem Description ( 問題の内容 )

I'm having trouble getting this panel to work with the esp32s3 and the RGB bus. The backlight comes on, but nothing is drawn to screen. I've verified that the display.init() returns true of my custom LGFX_Device, and when i call the draw functions there aren't any crashes - but nothing is displayed on the screen. I'm hoping that someone can spot something that I've missed.

Here's a link to the panel driver IC data sheet

Here's a link to the display data sheet

Here are the build flags in use (it's a custom board using an esp32s), if you need any other build settings i'm happy to oblige.

        -DARDUINO_CURRENT_EV_C121
        -DARDUINO_USB_CDC_ON_BOOT=1
        -DARDUINO_EVENT_RUNNING_CORE=1
        -DBOARD_HAS_PSRAM

Here's the custom LGFX_Device implementation that I've made (C121 is the internal name of the board):

#include "C121_Pinout.h"

#include <LovyanGFX.hpp>

#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>

// https://github.com/lovyan03/LovyanGFX/blob/master/examples/HowToUse/2_user_setting/2_user_setting.ino

#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 320

class C121_LGFX : public lgfx::LGFX_Device {
private:

  lgfx::Panel_RGB       _panel_instance;
  lgfx::Bus_RGB         _bus_instance;
  lgfx::Light_PWM       _light_instance;
  lgfx::Touch_GT911     _touch_instance;

public:

  C121_LGFX() {

    {
      auto cfg = _panel_instance.config();

      cfg.memory_width  = SCREEN_WIDTH;
      cfg.memory_height = SCREEN_HEIGHT;
      cfg.panel_width  = SCREEN_WIDTH;
      cfg.panel_height = SCREEN_HEIGHT;

      cfg.offset_x = 0;
      cfg.offset_y = 0;

      _panel_instance.config(cfg);
    }

    {
      auto cfg = _panel_instance.config_detail();
      cfg.use_psram = 1;
      _panel_instance.config_detail(cfg);
    }

    {
      auto cfg = _bus_instance.config();

      cfg.panel   = &_panel_instance;
      cfg.pin_d0  = C121_ESP_BLUE_BIT3;     // B0
      cfg.pin_d1  = C121_ESP_BLUE_BIT4;     // B1
      cfg.pin_d2  = C121_ESP_BLUE_BIT5;     // B2
      cfg.pin_d3  = C121_ESP_BLUE_BIT6;     // B3
      cfg.pin_d4  = C121_ESP_BLUE_BIT7;     // B4
      cfg.pin_d5  = C121_ESP_GREEN_BIT2;    // G0
      cfg.pin_d6  = C121_ESP_GREEN_BIT3;    // G1
      cfg.pin_d7  = C121_ESP_GREEN_BIT4;    // G2
      cfg.pin_d8  = C121_ESP_GREEN_BIT5;    // G3
      cfg.pin_d9  = C121_ESP_GREEN_BIT6;    // G4
      cfg.pin_d10 = C121_ESP_GREEN_BIT7;    // G5
      cfg.pin_d11 = C121_ESP_RED_BIT3;      // R0
      cfg.pin_d12 = C121_ESP_RED_BIT4;      // R1
      cfg.pin_d13 = C121_ESP_RED_BIT5;      // R2
      cfg.pin_d14 = C121_ESP_RED_BIT6;      // R3
      cfg.pin_d15 = C121_ESP_RED_BIT7;      // R4

      cfg.pin_henable = C121_ESP_LDC_DE;
      cfg.pin_vsync   = C121_ESP_LCD_VSYNC;
      cfg.pin_hsync   = C121_ESP_LCD_HSYNC;
      cfg.pin_pclk    = C121_ESP_LCD_DCLK;
      cfg.freq_write  = 14000000;

      cfg.hsync_polarity    = 0;
      cfg.hsync_front_porch = 210; // 16, 210, 354
      cfg.hsync_pulse_width = 4; // 1, 40
      cfg.hsync_back_porch  = 46; // 46
      cfg.vsync_polarity    = 0;
      cfg.vsync_front_porch = 7; // 7, 22, 147
      cfg.vsync_pulse_width = 4; // 1, 20
      cfg.vsync_back_porch  = 23; // 23
      cfg.pclk_idle_high    = 1;

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

    {
      auto cfg = _light_instance.config();
      cfg.pin_bl = C121_ESP_LCD_BACKLIGHT;
      _light_instance.config(cfg);
    }
    _panel_instance.light(&_light_instance);

    {
      auto cfg = _touch_instance.config();
      cfg.x_min      = 0;
      cfg.x_max      = SCREEN_WIDTH;
      cfg.y_min      = 0;
      cfg.y_max      = SCREEN_HEIGHT;
      cfg.pin_int    = C121_ESP_TOUCH_SCREEN_INTERRUPT;
      cfg.bus_shared = true;
      cfg.offset_rotation = 0;

      // cfg.i2c_port   = I2C_NUM_1;
      cfg.pin_sda    = C121_ESP_I2C_SDA;
      cfg.pin_scl    = C121_ESP_I2C_SCL;
      cfg.freq       = 400000;
      cfg.i2c_addr   = 0x14;        // 0x5D , 0x14
      _touch_instance.config(cfg);
      _panel_instance.setTouch(&_touch_instance);
    }

    setPanel(&_panel_instance);
  }
};

And here is how it's used:

#include "C121_LGFX.h"

C121_LGFX display;
bool displayInited = false;

void setup() {
  Serial.begin(115200);
  delay(2000);

  displayInited = display.init();
  display.setBrightness(254);
  display.clear(TFT_WHITE);
  display.clear(TFT_BLACK);
}

void loop() {
  if (!displayInited) {
    Serial.println("display didn't init");
    delay(5000);
    return;
  }

  display.startWrite();
  display.setColorDepth(16);
  display.setColor(TFT_WHITE);
  display.fillRect(0, 0, 400, 320);
  display.setColor(TFT_YELLOW);
  display.fillRect(400, 0, 400, 320);
  display.endWrite();
}
@briandilley briandilley changed the title Having trouble getting an ESP32S to work with an RGB Bus and Panel (EK9713, ER-TFT065-1) Having trouble getting an ESP32S3 to work with an RGB Bus and Panel (EK9713, ER-TFT065-1) Dec 8, 2023
@Nathan-L-Cook
Copy link

This particular LCD driver chip supports both DE and SYNC modes. Does the esp32-s3, and LGFX library, also support both modes?

It looks like the LGFX has configuration options for both DE and SYNC pins, but it's not clear which mode of operation the library is actually using.

Once the hardware configuration is set up, Is there a way to specifically set the mode to either DE mode or SYNC mode in the library to match the hardware?

Copy link

github-actions bot commented Jan 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Inactive issues label Jan 7, 2024
Copy link

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.

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

No branches or pull requests

2 participants