ILI9341 -> SPI is very slow

TuxuT_ESP32
Posts: 2
Joined: Fri Mar 22, 2019 1:33 pm

ILI9341 -> SPI is very slow

Postby TuxuT_ESP32 » Fri Mar 22, 2019 1:50 pm

Hi guys,

I guess I need your help with the SPI interface.
I downloaded a current master branch of the esp-idf and included the LCD component from the ESP IoT Solution which included/wrapped the Adafruit GFX Library (esp-iot-solution/components/spi_devices/lcd/) to drawing text string to my ILI9341 LCD Display.

This was a very straight forwarded way and my code build successfully.
BUT: Writing to the display seems very very slow at this moment. Currently I don't know why. If I writing a string to the display, I can see building up the text character by character on the display. This is a wrong behaviour.

I uses the following code to initilialize the LCD and getting a lcd_obj object to access the display:

Code: Select all

void initialise_lcd(void)
{
    /*Initialize LCD*/
    lcd_conf_t lcd_pins = {
        .lcd_model    = LCD_MOD_ILI9341,
        .pin_num_miso = GPIO_NUM_12,   // leave unconnected
        .pin_num_mosi = GPIO_NUM_13,   
        .pin_num_clk  = GPIO_NUM_14,   
        .pin_num_cs   = GPIO_NUM_15,   
        .pin_num_dc   = GPIO_NUM_26,   // better 35
        .pin_num_rst  = GPIO_NUM_25,   // better 34
        .pin_num_bckl = GPIO_NUM_17,  // leave unconnected
        .clk_freq     = 40 * 1000 * 1000,
        .rst_active_level = 0,
        .bckl_active_level = 0,
        .spi_host = HSPI_HOST,
        .init_spi_bus = true,
    };

    if (lcd_obj == NULL) {
        lcd_obj = new CEspLcd(&lcd_pins);
    }
    
    // write test
    lcd_obj->setRotation(2);
    lcd_obj->fillScreen(COLOR_ESP_BKGD);
    lcd_obj->setTextSize(1);

    lcd_obj->setTextColor(COLOR_GREEN, COLOR_ESP_BKGD);
    lcd_obj->setFont(&FreeSans9pt7b);
    lcd_obj->drawString("HELLO WORLD",                        3, 40);
} 

The SPI device should run with 40MHz and should use the HW SPI of the ESP32 device.

Please did you have any idea what is my mistake?
Thank you very much,
Stefan

shansted
Posts: 1
Joined: Wed Mar 27, 2019 6:59 am

Re: ILI9341 -> SPI is very slow

Postby shansted » Wed Mar 27, 2019 8:59 am

Have you tried using a slower SPI , say 10Mhz. The example code uses 10mhz or 26mhz.
https://github.com/espressif/esp-idf/bl ... ple_main.c

bembite
Posts: 5
Joined: Tue Mar 02, 2021 3:45 pm

Re: ILI9341 -> SPI is very slow

Postby bembite » Tue Mar 02, 2021 3:51 pm

I have ported custom graphic library for lcd displays on esp32, I am using hw spi as in the example provided with esp-idf. The speed(not freq) of filling screen is super low. I tried 26MHz and 10MHz config, the esp32 seems to be the slowest mcu I tried for my lib. Can't figure out what is happening!

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: ILI9341 -> SPI is very slow

Postby ESP_Sprite » Wed Mar 03, 2021 1:47 am

The ESP32 can be pretty fast wrt SPI using its internal DMA capability, however this speed only kicks in with large transactions (that is, loads of data to be sent in one go with CS only going low once). If your graphic library e.g. does one SPI transaction for each pixel it sets, it's going to be really slow, and you may want to add some caching or rework the display controller logic in it.

Who is online

Users browsing this forum: dzungpv, Google [Bot] and 141 guests