DIS07050H : CrowPanel 5.0" HMI ESP32 Display - Need ESP-IDF Driver

edited February 2025 in Elecrow HMI Display

I am working on a project using the CrowPanel 5.0"-HMI ESP32 Display 800x480 RGB TFT LCD Touch Screen. I am writing my code with ESP-IDF and I am struggling to find a driver for this HMI (ILI6122 & ILI5960).

I am specifically looking for a non-Arduino based solution. Can anyone provide guidance or resources for finding or developing a driver for this display in ESP-IDF?

Comments

  • Hello @frknn
    Please kindly check the ESP-IDF tutorial for the 5'' HMI ESP32 Display at: https://www.elecrow.com/wiki/CrowPanel-ESP32-5.0-inch-with-ESP-IDF.html

  • @Winny said:
    Hello @frknn
    Please kindly check the ESP-IDF tutorial for the 5'' HMI ESP32 Display at: https://www.elecrow.com/wiki/CrowPanel-ESP32-5.0-inch-with-ESP-IDF.html

    This is not pure ESP-IDF, it still uses Arduino libraries. Can you provide an SDK which used only ESP-IDF?

  • @frknn said:
    I am working on a project using the CrowPanel 5.0"-HMI ESP32 Display 800x480 RGB TFT LCD Touch Screen. I am writing my code with ESP-IDF and I am struggling to find a driver for this HMI(
    ILI6122 & ILI5960).

    I am specifically looking for a non-Arduino based solution. Can anyone provide guidance or resources for finding or developing a driver for this display in ESP-IDF?

    did you find anything?

  • I need this as well.. I can't find any ESP-IDF examples that run on the Elecrow HMI panels. They are all Arduino - I have SquareLine Studio, but there isn't any functional ESP-IDF project from Elecrow. This is really frustrating - don't want to use Arduino for a product.

  • I too need this.

  • I need this driver for ESP-IDF 5

  • edited December 2025

    Hi guys iam working on this display too and same env. Somehow i have managed to write driver for display and working fine for now (of course using AI) but not touch support yet. It would be great help if anyone have already cracked.Do anyone have the complete driver for esp idf (v5.4 compatible) ?

  • @oggysaud245 said:
    Hi guys iam working on this display too and same env. Somehow i have managed to write driver for display and working fine for now (of course using AI) but not touch support yet. It would be great help if anyone have already cracked.Do anyone have the complete driver for esp idf (v5.4 compatible) ?

    I'm desperately trying to get this display working on the ESP IDF and I'm not getting any results.

    Could you post the result you achieved?

  • edited February 16

    I'll leave here the code that I managed to get working on the ESP-IDF 5.3 with this display.

    f_elecrow_5in.c:

    #include "driver/gpio.h"
    #include "esp_lcd_panel_io.h"
    #include "esp_lcd_panel_ops.h"
    #include "esp_lcd_panel_rgb.h"
    #include "esp_err.h"
    
    static const char *TAG = "ELECROW_5IN";
    
    esp_err_t elecrow_5in_init(esp_lcd_panel_handle_t *out_panel)
    {
        esp_lcd_rgb_panel_config_t cfg = {
            .clk_src = LCD_CLK_SRC_PLL160M,
            .data_width = 16,
            .bits_per_pixel = 16,
    
            .de_gpio_num    = GPIO_NUM_40,
            .vsync_gpio_num = GPIO_NUM_41,
            .hsync_gpio_num = GPIO_NUM_39,
            .pclk_gpio_num  = GPIO_NUM_0,
    
            // >>> ESTE É O PONTO-CHAVE (equivalente ao pinMode(38)/digitalWrite(38,HIGH) do Arduino)
            .disp_gpio_num  = GPIO_NUM_38,
            .flags = {
                .fb_in_psram = 1,
                .disp_active_low = 0,   // HIGH liga o display
            },
    
            .data_gpio_nums = {
                8,  3, 46,  9,  1,
                5,  6,  7, 15, 16,  4,
                45, 48, 47, 21, 14
            },
    
            // Recomendo manter bounce buffer se FB está na PSRAM (doc oficial)
            .bounce_buffer_size_px = 10 * 800,   // 10 linhas * h_res
            .sram_trans_align = 64,
            .psram_trans_align = 64,
    
            .timings = {
                .pclk_hz = 16000000,     // Arduino usa 16 MHz
                .h_res = 800,
                .v_res = 480,
    
                .hsync_front_porch = 210,
                .hsync_pulse_width = 4,
                .hsync_back_porch  = 43,
    
                .vsync_front_porch = 22,
                .vsync_pulse_width = 4,
                .vsync_back_porch  = 12,
    
                .flags = {
                    // Esses flags existem no timing do IDF
                    .pclk_active_neg = 1,   // Arduino: pclk_active_neg = 1
                    .pclk_idle_high  = 0,
                    .de_idle_high    = 0,
                    .hsync_idle_low  = 0,   // Arduino: hsync_polarity = 0 (tipicamente idle HIGH)
                    .vsync_idle_low  = 0,   // Arduino: vsync_polarity = 0
                },
            },
        };
    
        esp_lcd_panel_handle_t panel = NULL;
        ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&cfg, &panel));
        ESP_ERROR_CHECK(esp_lcd_panel_reset(panel));
        ESP_ERROR_CHECK(esp_lcd_panel_init(panel));
    
        // Com disp_gpio_num definido, isso aqui passa a fazer sentido (driver controla DISP):
        ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel, true));
    
        *out_panel = panel;
        return ESP_OK;
    }
    
    
    

    f_display.c:

    #include "freertos/FreeRTOS.h"
    #include "freertos/task.h"
    #include "esp_log.h"
    #include "f_elecrow_5in.h"
    #include "esp_lcd_panel_ops.h"   // draw_bitmap
    #include "driver/gpio.h"
    #include "esp_heap_caps.h"
    #include <assert.h>
    
    
    static const char *TAG = "DISPLAY";
    
    
    static void fill_screen_solid(esp_lcd_panel_handle_t panel, uint16_t rgb565) {
        const int w = 800, h = 480;
        const int stripe_h = 40; // 40 linhas por vez (pode ser 20 também)
        const size_t stripe_px = w * stripe_h;
    
        uint16_t *buf = heap_caps_malloc(stripe_px * sizeof(uint16_t),
                                         MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA);
        assert(buf);
    
        for (int i = 0; i < (int)stripe_px; i++) buf[i] = rgb565;
    
        for (int y = 0; y < h; y += stripe_h) {
            int y2 = y + stripe_h;
            if (y2 > h) y2 = h;
            ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel, 0, y, w, y2, buf));
        }
    
        heap_caps_free(buf);
    }
    
    void f_SetupDisplay() {
    
        esp_lcd_panel_handle_t panel = NULL;
        ESP_ERROR_CHECK(elecrow_5in_init(&panel));
    
        gpio_reset_pin(GPIO_NUM_2);
        gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT);
        gpio_set_level(GPIO_NUM_2, 1);    // backlight ON só depois do init
    
        fill_screen_solid(panel, 0xF800); // vermelho
        vTaskDelay(pdMS_TO_TICKS(2000));
        fill_screen_solid(panel, 0x07E0); // verde
        vTaskDelay(pdMS_TO_TICKS(2000));
        fill_screen_solid(panel, 0x001F); // azul
    
        ESP_LOGI(TAG, "Display test Finished");
    
        while (1) {
            vTaskDelay(pdMS_TO_TICKS(1000));
        }
    }
    
    
    
Sign In or Register to comment.