Need help getting RA8875 LCD working with LVGL library

brubor2005
Posts: 5
Joined: Mon Dec 14, 2020 10:37 pm

Need help getting RA8875 LCD working with LVGL library

Postby brubor2005 » Sun May 07, 2023 2:39 am

Here is my setup:

Windows 10
VSCode 1.78.0
ESP-IDF 5.0.1
ESP32-DEVKITC-VE (has ESP32-WROVER-E module on it)
BuyDisplay.com ER-TFTM090-2, 9-inch LCD module with RA8875 controller, operating from 3V3.
LVGL -Light and Versatile Embedded Graphics Library for ESP32 from here https://github.com/lvgl/lv_port_esp32

Connections:
ESP32-DEVKITC-VE ER-TFTMO90-2 LCD MODULE
SS (GPIO5) to SCS (pin 5)
MOSI (GPIO23) to SDI (pin 7)
MISO (GPIO19) to SDO (pin 6)
SCK (GPIO18) to SCLK (pin 8)
GPIO21 to RST (pin 11)

The above SPI connections are for VSPI (SPI3) of the ESP32.

The problem I am having is getting LVGL configured to use the above connections. Using menuconfig, I have selected the RA8875 as the controller and VSPI as the SPI interface. I also have full-duplex operation configured (not sure what LVGL really wants). But I always get the following configuration reported in the terminal upon start-up:

I (40) lvgl_helpers: Initializing SPI master for display
I (50) lvgl_helpers: Configuring SPI host VSPI_HOST (2)
I (60) lvgl_helpers: MISO pin: -1, MOSI pin: 13, SCLK pin: 14, IO2/WP pin: -1, IO3/HD pin: -1
I (60) lvgl_helpers: Max transfer size: 64000 (bytes)
I (70) lvgl_helpers: Initializing SPI bus...
I (80) disp_spi: Adding SPI device
I (80) disp_spi: Clock speed: 40000000Hz, mode: 0, CS pin: 15

The above pin assignments are for HSPI, not VSPI.

What else do I need to configure to get the VSPI pins to be used instead of the HSPI pins?

Thanks for any help.

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

Re: Need help getting RA8875 LCD working with LVGL library

Postby bidrohini » Wed May 10, 2023 8:50 am

It seems like the LVGL library is not using the VSPI interface as expected. To configure LVGL to use the VSPI interface, you need to modify the lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c file.

First, make sure that you have selected the correct SPI interface and pins in the menuconfig of ESP-IDF. Then, in the lvgl_helpers.c file, you need to modify the following lines of code:

arduino
Copy code
spi_bus_config_t spi_bus_cfg = {
.miso_io_num = -1,
.mosi_io_num = 13,
.sclk_io_num = 14,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
.max_transfer_sz = LVGL_SPI_MAX_TRANSFER_SIZE,
.flags = 0,
.intr_flags = ESP_INTR_FLAG_LEVEL1,
};
Change the .mosi_io_num, .miso_io_num, and .sclk_io_num fields to the appropriate VSPI pins that you have connected to your display. In your case, you should set .mosi_io_num to 23, .miso_io_num to 19, and .sclk_io_num to 18.

After modifying the lvgl_helpers.c file, rebuild your project and upload it to your ESP32 board. LVGL should now use the correct VSPI pins to communicate with your display.

If nothing solves this problem, you may switch to something simple like the generic 16×2 LCD.

https://www.theengineeringprojects.com/ ... odule.html

vanBassum
Posts: 68
Joined: Sun Jan 17, 2021 11:59 am

Re: Need help getting RA8875 LCD working with LVGL library

Postby vanBassum » Thu May 11, 2023 6:23 am

Also, its quite easy to implement your own driver.
https://docs.lvgl.io/latest/en/html/por ... splay.html

Who is online

Users browsing this forum: No registered users and 109 guests