espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.49k stars 7.26k forks source link

Sunton LCD ESP32-4827S043 unexpected drift occurs (IDFGH-10421) #11675

Closed Dadigno closed 1 year ago

Dadigno commented 1 year ago

Answers checklist.

General issue report

IDF version v5.0

Operating System used. Windows

How did you build your project? idf.py build

If you are using Windows, please specify command line type. CMD

Development Kit. Sunton LCD ESP32-4827S043 4.3” 480X272-TN bare screen specs.pdf

What is the expected behavior? I started from rgb_lcd_example_main.c and managed to run lv_demo_widgets. It works, but drift issue show off if EXAMPLE_LCD_PIXEL_CLOCK_HZ is greater than (6*1000*1000). I would work with 9Mhz ( typical value in device specs )

https://github.com/espressif/esp-idf/assets/32482073/005dfe6e-2988-4e6e-8c00-b6b33dc196da

What I tried: I read all doc included with the dev kit ( schematics, arduino example ecc ) and here. Also, as explained here, I tried double buffering setting CONFIG_EXAMPLE_DOUBLE_FB = 1 and I'm using .fb_in_psram = true

Below my panel_config. I got pin timings and pin number from here and schematics. image

.......
....
..
.
 esp_lcd_rgb_panel_config_t panel_config = {
        .clk_src = LCD_CLK_SRC_DEFAULT,
        .timings = {
            .pclk_hz = EXAMPLE_LCD_PIXEL_CLOCK_HZ,
            .h_res = LCD_H_RES,
            .v_res = LCD_V_RES,
            // The following parameters should refer to LCD spec
            .hsync_pulse_width = 4,
            .hsync_back_porch = 43,
            .hsync_front_porch = 8,
            .vsync_pulse_width = 4,
            .vsync_back_porch = 12,
            .vsync_front_porch = 8,
            .flags.pclk_active_neg = true,
        },
        .data_width = 16, // RGB565 in parallel mode, thus 16bit in width
        .num_fbs = 2,
         #if CONFIG_EXAMPLE_USE_BOUNCE_BUFFER
            .bounce_buffer_size_px = 10 * EXAMPLE_LCD_H_RES,
        #endif
        .psram_trans_align = 64,
        .hsync_gpio_num = EXAMPLE_PIN_NUM_HSYNC,
        .vsync_gpio_num = EXAMPLE_PIN_NUM_VSYNC,
        .de_gpio_num = EXAMPLE_PIN_NUM_DE,
        .pclk_gpio_num = EXAMPLE_PIN_NUM_PCLK,
        .disp_gpio_num = EXAMPLE_PIN_NUM_DISP_EN,
        .data_gpio_nums = {
            EXAMPLE_PIN_NUM_DATA0,
            EXAMPLE_PIN_NUM_DATA1,
            EXAMPLE_PIN_NUM_DATA2,
            EXAMPLE_PIN_NUM_DATA3,
            EXAMPLE_PIN_NUM_DATA4,
            EXAMPLE_PIN_NUM_DATA5,
            EXAMPLE_PIN_NUM_DATA6,
            EXAMPLE_PIN_NUM_DATA7,
            EXAMPLE_PIN_NUM_DATA8,
            EXAMPLE_PIN_NUM_DATA9,
            EXAMPLE_PIN_NUM_DATA10,
            EXAMPLE_PIN_NUM_DATA11,
            EXAMPLE_PIN_NUM_DATA12,
            EXAMPLE_PIN_NUM_DATA13,
            EXAMPLE_PIN_NUM_DATA14,
            EXAMPLE_PIN_NUM_DATA15,
        },
        .flags = { 
            .fb_in_psram = true // allocate frame buffer in PSRAM
        },
    };
    ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&panel_config, &panel_handle));

....
..
.
suda-morris commented 1 year ago

drift issue show off if EXAMPLE_LCD_PIXEL_CLOCK_HZ is greater than (610001000).

https://github.com/espressif/esp-idf/tree/master/examples/peripherals/lcd/rgb_panel#troubleshooting

Dadigno commented 1 year ago

Thank you for your response. I checked it out yet. As I said lowering frequency to 6MHz makes it work, but this value is out of LCD spec. I don't know what is depends on.

suda-morris commented 1 year ago

It's a bandwidth issue of the PSRAM. There're some instructions here: https://espressif-docs.readthedocs-hosted.com/projects/espressif-esp-faq/en/latest/software-framework/peripherals/lcd.html#why-do-i-get-drift-overall-drift-of-the-display-when-driving-an-rgb-lcd-screen

Dadigno commented 1 year ago

Okay. Sorry, I missed this page.

This: Reduce data_cache_line_size to 32 bytes makes it work at 9Mhz.