HASwitchPlate / openHASP

HomeAutomation Switchplate based on lvgl for ESP32
https://www.openhasp.com
MIT License
730 stars 187 forks source link

support for esp32-2432s022c board #606

Open cosmos1978 opened 10 months ago

cosmos1978 commented 10 months ago

I recently bought some of these screens (ESP32-2432s022c)

I tried configuring it based on your github but I only am able to get some distorted images on the display. ( snow pattern ) It uses ST7789 driver and the same touch driver as your board. The difference is that the tft display uses an 8 bit parallel bus. It also needs to use lovyanGFX since it uses pin's above 31

I have some sample code that runs perfect on the board. And I tried to map the pins like in that code but I am stuck now on this distorted image

Perhaps you have some ideas on how to get it working ?

below is the working arduino code and the platformio.ini env I created based on https://github.com/elik745i/ESP32-2432s024c since he was able to include support for the touch chipset

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);
}

{
    auto cfg = _panel_instance.config();

    cfg.pin_cs = 17;
    cfg.pin_rst = -1;
    cfg.pin_busy = -1;

    cfg.panel_width = 240;
    cfg.panel_height = 320;
    cfg.offset_x = 0;
    cfg.offset_y = 0;
    cfg.offset_rotation = 0;
    // cfg.dummy_read_pixel = 8;
    // cfg.dummy_read_bits = 1;
    cfg.readable = false;
    cfg.invert = false;
    cfg.rgb_order = false;
    cfg.dlen_16bit = false;
    cfg.bus_shared = true;

    _panel_instance.config(cfg);
}

setPanel(&_panel_instance);

} };

[env:esp32-2432s022c_4MB] extends = esp32-2432s022, flash_4mb board = esp32dev build_flags = ${esp32-2432s022.build_flags} ${esp32.no_ps_ram}

${esp32.hspi} -D LGFX_USE_V1=1 -D ILI9341_DRIVER=1 -D ESP32_PARALLEL=1 -D TOUCH_DRIVER=0x0820 -D HASP_USE_LGFX_TOUCH=1 -D TFT_ROTATION=0 -D TFT_WIDTH=240 -D TFT_HEIGHT=320 -D TFT_BCKL=5 ;None, configurable via web UI (e.g. 2 for D4) -D TFT_CS=17 ; Chip select control pin -D TFT_RST=-1 ; Reset pin -D TFT_DC=16
-D TFT_WR=4 ; Write strobe control pin - must use a pin in the range 0-31 -D TFT_RD=2 -D TFT_D0=15 ; Must use pins in the range 0-31 for the data bus -D TFT_D1=13 ; so a single register write sets/clears all bits -D TFT_D2=12 -D TFT_D3=14 -D TFT_D4=27 -D TFT_D5=25 -D TFT_D6=33 -D TFT_D7=32 -D TOUCH_SDA=21 -D TOUCH_SCL=22 ;-D TOUCH_IRQ=34 ; use 34-39 as these are input only pins -D TOUCH_RST=-1 ; not used, connected to 3.3V -D SUPPORT_TRANSACTIONS -D TOUCH_OFFSET_ROTATION=0 ;-D I2C_TOUCH_FREQUENCY=400000 ;-D I2C_TOUCH_PORT=1 -D I2C_TOUCH_ADDRESS=0x15 -D SPI_FREQUENCY=65000000 -D SPI_TOUCH_FREQUENCY=2500000 -D SPI_READ_FREQUENCY=20000000 lib_deps = ${esp32-2432s022.lib_deps} ${lovyangfx.lib_deps}

gekkie commented 8 months ago

I second this request

cafalchio commented 4 months ago

same issue, not sure which are the correct pins

Panaceabeachbum commented 4 months ago

Same here, any help appreciated

Panaceabeachbum commented 4 months ago

Is there a pinout available for this particular board? I have no problem finding a get started pdf for a number of their other boards but not this one

bennydiamond commented 2 months ago

Somebody seems to have a platformio config for this very board. https://github.com/rzeldent/platformio-espressif32-sunton/blob/main/esp32-2432S022C.json

Probably this could be used in some fashion in this project.