Elecrow Wiki CrowPanel Advance 5.0-HMI ESP32 Help

Hello, im trying to use the 5in advance device and i followed the guide for using LovyanGFX and i noticed the pinouts and stuff were wrong so i looked around and got the one for 5in and tried to flash it, nothing displayed so i am here to ask for a bare bones example to use as all of the examples are all over the place and are confusing to follow when guides listed for 5in use the 3.5in one or 7in and i dont know what else to do.

Tutorial i followed:
https://www.elecrow.com/pub/wiki/lesson02-start-the-esp32-display-gui-drawing-via-lovyangfx-graphics-library.html

main.cpp

// Contains LovyanGFX library and related font library

#include "rgbdisplay.h"
#include "Latin_Hiragana_24.h"
#include "NotoSansBold15.h"
#include "NotoSansMonoSCB20.h"
// define font
#define latin Latin_Hiragana_24
#define small NotoSansBold15
#define digits NotoSansMonoSCB20

// define color
#define c1 0xE73C   // white
#define c2 0x18C3   // gray
#define c3 0x9986   // red
#define c4 0x2CAB   // green
#define c5 0xBDEF   // gold
#define c6 0xFFFAFA // snow

// Settings for initializing the program
void setup()
{

  pinMode(19, OUTPUT);
  pinMode(20, OUTPUT);
  pinMode(1, OUTPUT);
  digitalWrite(1, LOW);
  delay(120);
  pinMode(1, INPUT);
}

void loop()
{
  // draw graphics
  sprite.fillRect(80, 61, 310, 50, 0x9986);  // draw a rectangle
  sprite.drawLine(80, 164, 80, 240, 0x2CAB); // draw a line
  sprite.loadFont(small);
  sprite.setTextColor(c4, c3);
  sprite.drawString("Hello elecrow!", 190, 230); // write a paragraph
  sprite.drawCircle(240, 160, 30, c5);           // draw a circle
  sprite.pushSprite(0, 0);
}

I only replaced "rgbdisplay.h" with the code from the shared code for the 5in using the right driver to

#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <driver/i2c.h>

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 = _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 = GPIO_NUM_21;  // B0
            cfg.pin_d1 = GPIO_NUM_47;  // B1
            cfg.pin_d2 = GPIO_NUM_48;  // B2
            cfg.pin_d3 = GPIO_NUM_45;  // B3
            cfg.pin_d4 = GPIO_NUM_38;  // B4
            cfg.pin_d5 = GPIO_NUM_9;   // G0
            cfg.pin_d6 = GPIO_NUM_10;  // G1
            cfg.pin_d7 = GPIO_NUM_11;  // G2
            cfg.pin_d8 = GPIO_NUM_12;  // G3
            cfg.pin_d9 = GPIO_NUM_13;  // G4
            cfg.pin_d10 = GPIO_NUM_14; // G5
            cfg.pin_d11 = GPIO_NUM_7;  // R0
            cfg.pin_d12 = GPIO_NUM_17; // R1
            cfg.pin_d13 = GPIO_NUM_18; // R2
            cfg.pin_d14 = GPIO_NUM_3;  // R3
            cfg.pin_d15 = GPIO_NUM_46; // R4

            cfg.pin_henable = GPIO_NUM_42;
            cfg.pin_vsync = GPIO_NUM_41;
            cfg.pin_hsync = GPIO_NUM_40;
            cfg.pin_pclk = GPIO_NUM_39;
            cfg.freq_write = 21000000;

            cfg.hsync_polarity = 0;
            cfg.hsync_front_porch = 8;
            cfg.hsync_pulse_width = 4;
            cfg.hsync_back_porch = 8;
            cfg.vsync_polarity = 0;
            cfg.vsync_front_porch = 8;
            cfg.vsync_pulse_width = 4;
            cfg.vsync_back_porch = 8;
            cfg.pclk_idle_high = 1;

            _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 = 800;
            cfg.y_min = 0;
            cfg.y_max = 480;
            cfg.pin_int = -1;
            cfg.bus_shared = false;
            cfg.offset_rotation = 0;
            // I2C接続
            cfg.i2c_port = I2C_NUM_0;
            cfg.pin_sda = GPIO_NUM_15;
            cfg.pin_scl = GPIO_NUM_16;
            cfg.pin_rst = -1;
            cfg.freq = 400000;
            cfg.i2c_addr = 0x5D; // 0x5D , 0x14
            _touch_instance.config(cfg);
            _panel_instance.setTouch(&_touch_instance);
        }

        setPanel(&_panel_instance);
    }
};

LGFX lcd;
LGFX_Sprite sprite(&lcd);

Comments

Sign In or Register to comment.