GithubHelp home page GithubHelp logo

lvgl / lv_port_esp32 Goto Github PK

View Code? Open in Web Editor NEW
952.0 39.0 419.0 18.38 MB

LVGL ported to ESP32 including various display and touchpad drivers

License: MIT License

Makefile 8.17% C 83.12% CMake 5.77% Shell 2.94%
esp32 esp-idf graphics ui lvgl

lv_port_esp32's Introduction

LVGL project for ESP32

This is an ESP32 demo project showcasing LVGL v7 with support for several display controllers and touch controllers. The demo application is the lv_demo_widgets project from the lv_examples repository.

  • Version of ESP-IDF required 4.2. NOTE: We're trying to make this repo backwards compatible, usage of idf.py is encouraged.
  • Version of LVGL used: 7.9.
  • Version of lv_examples used: 7.9.

Table of content

Example demo for TFT displays:

Example GUI_DEMO with ESP32 using LVGL

Monochrome support:

Example_monochrome demo with ESP32 using LVGL

Display and touch controllers

The display and touch (indev) controllers are now into it's own repository, you can find it here. To report any issue or add new display or touch (indev) drivers you can do so in the lvgl_esp32_drivers repo.

Get started

Prerequisites

  • ESP-IDF Framework.

Note

This project tries to be compatible with both the ESP-IDF v3.x and v4.0, but using v4.0 is recommended. Instructions assume you are using the v4.x toolchain, otherwise use the make commands, e.g. instead of running idf.py menuconfig, run make menuconfig.

Build and run the demo.

  1. Clone this project by git clone --recurse-submodules https://github.com/lvgl/lv_port_esp32.git, this will pull this repo and its submodules.

  2. Get into the created lv_port_esp32 directory.

  3. Run idf.py menuconfig

  4. Configure LVGL in Components config->LVGL Configuration. For monochrome displays use the mono theme and we suggest enabling the unscii 8 font.

  5. Configure your display and/or touch controllers in Components config->LVGL TFT Display Configuration and Components config->LVGL TOUCH Configuration.

  6. Store your project configuration.

  7. Build the project with idf.py build

  8. If the build don't throw any errors, flash the demo with idf.py -p (YOUR SERIAL PORT) flash (with make this is just make flash - in 3.x PORT is configured in menuconfig)

Use LVGL in your ESP-IDF project

LVGL now includes a Kconfig file which is used to configure most of the LVGL configuration options via menuconfig, so it's not necessary to use a custom lv_conf.h file.

It is recommended to add LVGL as a submodule in your IDF project's git repo.

From your project's root directory:

  1. Create a directory named components (if you don't have one already) with mkdir -p components.
  2. Clone the lvgl repository inside the components directory with git submodule add https://github.com/lvgl/lvgl.git components/lvgl
  3. Run idf.py menuconfig, go to Component config then LVGL configuration to configure LVGL.

Use lvgl_esp32_drivers in your project

It is recommended to add lvgl_esp32_drivers as a submodule in your IDF project's git repo.

From your project's root directory:

  1. Create a directory named components (if you don't have one already) with mkdir -p components.
  2. Clone the lvgl_esp32_drivers repository inside the components directory with git submodule add https://github.com/lvgl/lvgl_esp32_drivers.git components/lvgl_esp32_drivers
  3. Run idf.py menuconfig, go to Component config then LVGL TFT configuration and LVGL TFT Display configuration to configure lvgl_esp32_drivers.

Platformio support

Using the lv_platformio project add the following lines to platformio.ini file:

[env:esp32]
platform = espressif32
framework = espidf
board = esp-wrover-kit

Change the default environment to default_envs = esp32.

Modify the main.c like this:

#include "lvgl.h"

// #include "driver.h"

#include "demo.h"

int app_main(void)
{
    lv_init();

    /* Initialize your hardware. */
    
    /* hw_init(); */

    demo_create();

    /* Create the UI or start a task for it.
     * In the end, don't forget to call `lv_task_handler` in a loop. */

    /* hw_loop(); */

    return 0;
}

For more information see: platformio with espidf framework compability.

ESP32-S2 Support

Support for ESP32-S2 variant is Work In Progress. Smaller displays (e.g. 320x240) work fine, but larger ones need testing.

Background

ESP32-S2 has less on-chip SRAM than its predecessor ESP32 (520kB vs. 320kB). This causes problems with memory allocation with large LVGL display buffers as they don't fit into the on-chip memory and external PSRAM is not accessible by DMA.

Moreover, static allocation to external PSRAM is not yet supported (see GitHub issue).

At this momement, the buffers are dynamicaly allocated with DMA capabilty and memory allocator handles the rest.

lv_port_esp32's People

Contributors

an-erd avatar bneuen avatar bzgec avatar c47d avatar cmumford avatar danjulio avatar davidjade avatar embeddedt avatar frmdstryr avatar h3ndrik avatar huming2207 avatar husky-koglhof avatar jaghatei avatar jeremyjh avatar jonans avatar kisvegabor avatar limitz avatar lukunn avatar manuelvegamtx avatar maxd avatar mb175 avatar mcerveny avatar mcrobs avatar mica-angeli avatar nicofossa avatar seeul8er avatar tlechman49 avatar tonystuart avatar tore-espressif avatar vheathen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lv_port_esp32's Issues

Cannot get the example to work

Steps to produce the issue:

  1. follow cloning and copying component.mk files
  2. make manuconfig and change serial flasher to 115200
  3. I am using this display http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807, ESP module is https://wiki.wemos.cc/products:d32:d32
  4. connect the following pins (MOSI, SCLK, CS, DC, BCKL, RST) as per default config
  5. make flash monitor
  6. the error is bellow
ILI9341 initialization.
Enable backlight.
E (11314) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (11314) task_wdt:  - IDLE0 (CPU 0)
E (11314) task_wdt: Tasks currently running:
E (11314) task_wdt: CPU 0: main
E (11314) task_wdt: CPU 1: IDLE1

Driver for 3.5inch RPi Display (MPI3501)

I developed and tested driver for the tft MPI3501.
It's based on ILI9486 with custom circuit to convert 3-line SPI to 16-bit parallel. Touch controller is XPT2046.

Can I release it? If yes, how to proceed?

ESP32 Chip version: ESP32D0WDQ6 (revision 1)

ESP-IDF version: 4.0

Development kit used: DevKitC

Development machine OS: Windows 10

Display flickers when ESP32 is in AP mode

I've noticed a consistent issue with the display flickering when the ESP32 is in AP or APSTA mode. I'm using a 240x320 2.4" TFT LCD from AliExpress with ILI9341 display driver and XPT2046 touch driver. The display works perfectly when wifi is not enabled or when the ESP32 is connected in STA mode. As soon as it is in AP or APSTA mode, without changing any other factors or connecting to the AP, the display has a constant flicker (maybe 20-30Hz just by looking at it). Any ideas on how to resolve this issue? Thanks!

Port to LVGL v7.0

List of necessary changes:

  • Update lvgl submodule.
  • Update lvgl example submodule.
  • Update lvgl configuration file.

How make rotation screen (Set portrait orientation) Driver ILI9488

ESP-IDF version
last master

Development kit used
ESP-WROOM32

Development machine OS
Windows 10

Hello! How can I rotate the screen? I need to set portrait orientation.
I use display with driver ILI9488.

As I understand it, I need to change the starting coordinates of the rendering in the file ili9488.c :

`/* Column addresses */
uint8_t xb[] = {
(uint8_t) (area->x1 >> 8) & 0xFF,
(uint8_t) (area->x1) & 0xFF,
(uint8_t) (area->x2 >> 8) & 0xFF,
(uint8_t) (area->x2) & 0xFF,
};

/* Page addresses  */
uint8_t yb[] = {
    (uint8_t) (area->y1 >> 8) & 0xFF,
    (uint8_t) (area->y1) & 0xFF,
    (uint8_t) (area->y2 >> 8) & 0xFF,
    (uint8_t) (area->y2) & 0xFF,
};`

photo_2020-03-17_12-14-27

Init SPI bus in main and just the SPI device on TFT and touch controller

Hi,

Right now we init the SPI bus and SPI devices on the TFT and touch init functions, like so:

https://github.com/littlevgl/lv_port_esp32_ili9341/blob/6c0a081029bcb05beb01033d6f12eb580ab999e8/components/lvgl_ili9341/disp_spi.c#L47-L82

I think is better to init the SPI bus on main so the user can add more devices, like sensors, etc, on main instead of modifying the TFT and touch controller functions to do so, maybe something like this:

In disp_spi.c:

void disp_spi_init(spi_host_device_thost host)
{
    esp_err_t ret;

    spi_device_interface_config_t devcfg={
            .clock_speed_hz=40*1000*1000,           //Clock out at 40 MHz
            .mode=0,                                //SPI mode 0
            .spics_io_num=DISP_SPI_CS,              //CS pin
            .queue_size=1,
            .pre_cb=NULL,
            .post_cb=spi_ready,
            .flags = SPI_DEVICE_HALFDUPLEX
    };

    //Attach the LCD to the SPI bus
    ret=spi_bus_add_device(host, &devcfg, &spi);
    assert(ret==ESP_OK);
}

In main.c:

void app_main()
{
	lv_init();

    spi_bus_config_t buscfg={
            .miso_io_num=-1,
            .mosi_io_num=DISP_SPI_MOSI,
            .sclk_io_num=DISP_SPI_CLK,
            .quadwp_io_num=-1,
            .quadhd_io_num=-1,
#if CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == 0
            .max_transfer_sz = DISP_BUF_SIZE * 2,
#elif CONFIG_LVGL_TFT_DISPLAY_CONTROLLER == 1
            .max_transfer_sz = DISP_BUF_SIZE * 3,
#endif
    };

    //Initialize the SPI bus
    ret=spi_bus_initialize(host, &buscfg, 1);
    assert(ret==ESP_OK);

	disp_spi_init(HSPI_HOST);
	disp_driver_init();

#if ENABLE_TOUCH_INPUT
	tp_spi_init();
	xpt2046_init();
#endif

    static lv_color_t buf1[DISP_BUF_SIZE];
    static lv_color_t buf2[DISP_BUF_SIZE];
    static lv_disp_buf_t disp_buf;
    lv_disp_buf_init(&disp_buf, buf1, buf2, DISP_BUF_SIZE);

	lv_disp_drv_t disp_drv;
	lv_disp_drv_init(&disp_drv);
	disp_drv.flush_cb = disp_driver_flush;
	disp_drv.buffer = &disp_buf;
	lv_disp_drv_register(&disp_drv);

#if ENABLE_TOUCH_INPUT
    lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv);
    indev_drv.read_cb = xpt2046_read;
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    lv_indev_drv_register(&indev_drv);
#endif

	esp_register_freertos_tick_hook(lv_tick_task);

	demo_create();

	while(1) {
		vTaskDelay(1);
		lv_task_handler();
	}
}

Add examples using ESP32 peripherals

As #39 explains there are certain consideratioยดn when using some ESP32 peripherals, how can we add examples using some peripherals? Maybe having the lvgl and other example projects and choosing one at configuration time?

Do you know if this is possible @jeremyjh?

ILI9341 and XPT2046 on same SPI

My HW connection is as follows and use use idf 4.0:
Diplay:

  • MISO 25
  • MOSI 23
  • CLK 19
  • CS 22
  • DC 21
  • RESET 18
  • BACKLIGHT 5

Touch

  • CS 32
  • IRQ 33

I found a problem in xpt2046_init function in xpt2046.c file.
I modified
.pin_bit_mask = 1UL << XPT2046_IRQ,
to
.pin_bit_mask = 1ULL << XPT2046_IRQ,
however the touch does not work.
Note that I have already tested it with the esp-iot-solution (IDF 3.x) lvgl_thermostat project.

ili9341 PORTRAIT mode

I saw some questions about screen rotations, so I think I post my solution here.
Things to change:

ili9341.c at line 62:
original:
{0x36, {0x28}, 1}, /*Memory Access Control*/
modify to
{0x36, {0x48}, 1}, /*Memory Access Control*/

lv_conf.h at line 24
original:

#define LV_HOR_RES_MAX          (320)
#define LV_VER_RES_MAX          (240)

modify to:

#define LV_HOR_RES_MAX          (240)
#define LV_VER_RES_MAX          (320)

After theres simple changes the display must show portrait image.

Program crashes when adding wifi support

We use GitHub issues for development related discussions.
Please use the forum to ask questions.

Describe the issue
added wifi station code from esp-idf mqtt example:
https://github.com/espressif/esp-idf/blob/release/v3.3/examples/protocols/mqtt/tcp/main/app_main.c#L171

Code to reproduce the issue

  esp_register_freertos_tick_hook(lv_tick_task);
  xTaskCreate(display_task, "display_task", 2048, NULL, 5, NULL); 
  esp_err_t error_test = nvs_flash_init();
  if(error_test == ESP_OK)
  {
    wifi_init_sta();
  }
  while(1)
  {
		vTaskDelay(1000/portTICK_PERIOD_MS);
	}
}

static void display_task(void *pvParameter)
{
  Demo();
  while(1) {
		vTaskDelay(5/portTICK_PERIOD_MS);
		lv_task_handler();
	}

}

Expected Results
The display shows to demo and wifi connects
Actual Results
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)
ESP32 Chip version

ESP-IDF version
3.3
Development kit used
NodeMCU 32s
Development machine OS
Windows 10, Platoformio
Compilation warnings/errors (if available)

If possible, copy the compilation log into a file and attach it here

leak memony

I try to decode several png images.However,when I decode over two images,it will reduce the heap size gradully.It is ok when I decode only one image.Do you know the reason?

source code:

`

CURRENT_img1= lv_img_create(lv_scr_act(), NULL);

lv_obj_set_pos(CURRENT_img1, 10, 65);

lv_img_set_src(CURRENT_img1, "/spiffs/wet/100.png");

lv_obj_t * NEXT_day_weather_img = lv_img_create(lv_scr_act(), NULL);

lv_obj_set_pos(NEXT_day_weather_img, 0, 185);

lv_img_set_src(NEXT_day_weather_img, "/spiffs/wet/101.png");`

print the heap size every second.

debug:

`

app_main buffer get: 4170120

app_main buffer get: 4168480

app_main buffer get: 4165284

app_main buffer get: 4162092

app_main buffer get: 4158896

app_main buffer get: 4155700

app_main buffer get: 4152504

app_main buffer get: 4147752

app_main buffer get: 4146112

app_main buffer get: 4142916

app_main buffer get: 4139720

app_main buffer get: 4136524

`

disp_spi driver fix?

Hi.

I'm using this example with another kind of spi display, but in general, all works without much changes, only command sequence need to adjust.

With latest spi driver nothing dispays on screen.

I'm able to fix it if added:

spi_device_get_trans_result() to both functions disp_spi_send_data() and disp_spi_send_colors()

So it looks like next now in disp_spi.c

void disp_spi_send_data(uint8_t * data, uint16_t length)
{
    if (length == 0) return;           //no need to send anything

    while(spi_trans_in_progress);

    spi_transaction_t t;
    memset(&t, 0, sizeof(t));       	//Zero out the transaction
    t.length = length * 8;              //Length is in bytes, transaction length is in bits.
    t.tx_buffer = data;               	//Data
    spi_trans_in_progress = true;
    spi_color_sent = false;             //Mark the "lv_flush_ready" NOT needs to be called in "spi_ready"
    spi_device_queue_trans(spi, &t, portMAX_DELAY);

    //added
    spi_transaction_t * rt;
    spi_device_get_trans_result(spi, &rt, portMAX_DELAY);
}

void disp_spi_send_colors(uint8_t * data, uint16_t length)
{
    if (length == 0) return;           //no need to send anything

    while(spi_trans_in_progress);

    spi_transaction_t t;
    memset(&t, 0, sizeof(t));           //Zero out the transaction
    t.length = length * 8;              //Length is in bytes, transaction length is in bits.
    t.tx_buffer = data;                 //Data
    spi_trans_in_progress = true;
    spi_color_sent = true;              //Mark the "lv_flush_ready" needs to be called in "spi_ready"
    spi_device_queue_trans(spi, &t, portMAX_DELAY);

    //added
    spi_transaction_t * rt;
    spi_device_get_trans_result(spi, &rt, portMAX_DELAY);
}

Converted font won't compile as-is

We use GitHub issues for development related discussions.
Please use the forum to ask questions.

Describe the issue
I used the LittlevGL online font converter tool to convert a font.
I downloaded the resulting C file and added it to my project incorporating the lv_port_esp32_ili9341.
The font source isn't fully compatible with this version of LittlevGL and had errors I had to fix.
It is not actually clear to me whether this is an issue in the font converter being too new, or the code in this port being different, not sure. The errors are minor, here is the diff

rbarris@oryx-i7:~/sandbox/ray/esp1$ diff ~/Downloads/build.c ~/sandbox/ray/esp1/main/build.c
1377c1377
< .class_pair_values = kern_class_values,

.class_pair_values   = (const uint8_t *)kern_class_values,

1412c1412
< .subpx = LV_FONT_SUBPX_NONE,

// .subpx = LV_FONT_SUBPX_NONE,

Code to reproduce the issue
font edits.zip

Expected Results
A converted font should integrate smoothly with LVGL

Actual Results
minor compile errors

ESP32 Chip version
m5stack gray

ESP-IDF version
ESP-IDF v4.1-dev-1086-g93a8603c5-dirty

Development machine OS
Ubuntu 17.10

Menuconfig improvements

There's a lot of room for improvements to make this reference project easier to use.

Display/touch controller configuration:

  • Display pins configuration must be independent of the bus used to communicate with the display controller, I2C, SPI, etc. So if a SPI bus is used the pins to configure must be MOSI, MISO, SCLK and /SS, if I2C bus is used only SDA and SCL must be available. Fixed in #94, ef9424f
  • Ditto for touch controllers.
  • Set display rotation, see #82 and #88, Mostly fixed in #94, 900c1d1 and 42c2fd2

LVGL configuration

  • Being able to configure lvgl from the menuconfig, see #57.

Add more in the comments to add them to this task list.

No Display on M5Stack

I configured this library for the pinouts on the M5Stack. Built and flashed it, and judging from the INFO logs it runs through the demo just fine, there are no errors. However, nothing is ever displayed on the screen.

These pin configurations work fine on this device with both loboris's driver and with the lvgl demo using the Adafruit driver as appropriated in the esp-iot-solution.

I thought there must be some difference in initialization command sequence, so I even tried wedging in the init sequence from loboris's repo, but this did not work either. I'm really at a loss as to what could be going wrong, assuming this repo does currently work with other devices.

Sample output:

I (0) cpu_start: App cpu up.
I (308) heap_init: Initializing. RAM available for dynamic allocation:
I (315) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (321) heap_init: At 3FFC5CE0 len 0001A320 (104 KiB): DRAM
I (327) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (334) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (340) heap_init: At 4008AA58 len 000155A8 (85 KiB): IRAM
I (346) cpu_start: Pro cpu start user code
I (29) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Info: lv_init ready 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_core/lv_obj.c #117)
ILI9341 initialization.
Enable backlight.
Info: Screen create ready 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_core/lv_obj.c #211)
Info: Screen create ready 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_core/lv_obj.c #211)
Info: Screen create ready 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_core/lv_obj.c #211)
Info: image created 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_objx/lv_img.c #108)
Info: lv_img_set_src:  `LV_IMG_SRC_VARIABLE` type found 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_objx/lv_img.c #152)
Info: container created 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_objx/lv_cont.c #113)
Info: button matrix created 	(/Users/jeremy/esp/esp32_ili9341/components/lvgl/src/lv_objx/lv_btnm.c #127)
...

Menuconfig does not give HSPI/VSPI option for TFT

Latest update no longer includes option to set SPI port in Menuconfig for TFT controller. After saving Menuconfig, lvgl_spi_conf.h shows that both defines for TFT_SPI_HOST and TOUCH_SPI_HOST expand to VSPI_HOST

When running the demo.h from the main.c example I get the following printed to serial.

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6876
load:0x40078000,len:14076
ho 0 tail 12 room 4
load:0x40080400,len:4304
entry 0x400806e8
I (71) boot: Chip Revision: 1
I (72) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (41) boot: ESP-IDF v4.0 2nd stage bootloader
I (41) boot: compile time 00:27:27
I (52) boot: Enabling RNG early entropy source...
I (52) boot: SPI Speed      : 40MHz
I (52) boot: SPI Mode       : DIO
I (56) boot: SPI Flash Size : 2MB
I (60) boot: Partition Table:
I (64) boot: ## Label            Usage          Type ST Offset   Length
I (71) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (79) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (86) boot:  2 factory          factory app      00 00 00010000 00100000
I (94) boot: End of partition table
I (98) boot_comm: chip revision: 1, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x42b44 (273220) map
I (212) esp_image: segment 1: paddr=0x00052b6c vaddr=0x3ffb0000 size=0x023a0 (  9120) load
I (216) esp_image: segment 2: paddr=0x00054f14 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at C:/Users/ben/esp-idf-v4.0/components/freertos/xtensa_vectors.S:1778

I (219) esp_image: segment 3: paddr=0x0005531c vaddr=0x40080400 size=0x0a858 ( 43096) load
I (245) esp_image: segment 4: paddr=0x0005fb7c vaddr=0x00000000 size=0x00494 (  1172) 
I (246) esp_image: segment 5: paddr=0x00060018 vaddr=0x400d0018 size=0x2d710 (186128) map
0x400d0018: _stext at ??:?

I (325) boot: Loaded app from partition at offset 0x10000
I (325) boot: Disabling RNG early entropy source...
I (326) cpu_start: Pro cpu up.
I (329) cpu_start: Application information:
I (334) cpu_start: Project name:     esp_sunrise_alarm_clock
I (340) cpu_start: App version:      0075c49-dirty
I (346) cpu_start: Compile time:     Apr 14 2020 02:18:53
I (352) cpu_start: ELF file SHA256:  4f77b4f9d657a4a3...
I (358) cpu_start: ESP-IDF:          v4.0
I (363) cpu_start: Starting app cpu, entry point is 0x4008118c
0x4008118c: call_start_cpu1 at C:/Users/ben/esp-idf-v4.0/components/esp32/cpu_start.c:272

I (349) cpu_start: App cpu up.
I (373) heap_init: Initializing. RAM available for dynamic allocation:
I (380) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (386) heap_init: At 3FFC85F8 len 00017A08 (94 KiB): DRAM
I (392) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (399) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (405) heap_init: At 4008AC58 len 000153A8 (84 KiB): IRAM
I (411) cpu_start: Pro cpu start user code
I (430) spi_flash: detected chip: generic
I (430) spi_flash: flash io: dio
W (430) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (441) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (210) ILI9341: ILI9341 initialization.
E (410) spi: SPI3 already claimed by spi master.
E (410) spi_master: spi_bus_initialize(231): host already in use
assertion "ret==ESP_OK" failed: file "../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch/tp_spi.c", line 92, function: tp_spi_init
abort() was called at PC 0x400ef72f on core 1
0x400ef72f: __assert_func at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)


ELF file SHA256: 4f77b4f9d657a4a3d5aab77d92d449c0c718810cb575cdb86541e3403626f323

Backtrace: 0x4008512d:0x3ffcdd90 0x400854a5:0x3ffcddb0 0x400ef72f:0x3ffcddd0 0x400d5189:0x3ffcde00 0x400d50e1:0x3ffcde40 0x400d4344:0x3ffcde60 0x400d4261:0x3ffcde80 0x400882a5:0x3ffcdf00
0x4008512d: invoke_abort at C:/Users/ben/esp-idf-v4.0/components/esp32/panic.c:155

0x400854a5: abort at C:/Users/ben/esp-idf-v4.0/components/esp32/panic.c:172

0x400ef72f: __assert_func at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:62 (discriminator 8)

0x400d5189: tp_spi_init at C:\Users\ben\esp_sunrise_alarm_clock\build/../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch/tp_spi.c:92 (discriminator 1)

0x400d50e1: touch_driver_init at c:\users\ben\esp_sunrise_alarm_clock\build/../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch/touch_driver.c:13

0x400d4344: lvgl_driver_init at C:\Users\ben\esp_sunrise_alarm_clock\build/../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_driver.c:63

0x400d4261: guiTask at C:\Users\ben\esp_sunrise_alarm_clock\build/../main/main.c:69

0x400882a5: vPortTaskWrapper at C:/Users/ben/esp-idf-v4.0/components/freertos/port.c:143

The TFT screen flickers white and resets within 1 second. The above message is printed to serial every time.

ESP32 Chip version DevKit Rev1

ESP-IDF version 4.0

Development kit used Eclipse ESP IDF

Development machine OS Windows

Error when compiling

Hello,
i am facing following error when try to build the project:
esp-idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x10): undefined reference to app_main' esp-idf/esp32/libesp32.a(cpu_start.c.obj): In function main_task':
C:/Users/asenn/Desktop/esp-idf-2/components/esp32/cpu_start.c:514: undefined reference to `app_main'
collect2.exe: error: ld returned 1 exit status

I use this guide as in the readme file:
https://docs.espressif.com/projects/esp-idf/en/latest/get-started/windows-setup.html
but can't 'figured out what is wrong.

Readme.md should be enhanced regarding adjustments in Makefile

The Readme says in section Readme.md#makefile to add the following line(s):

EXTRA_COMPONENT_DIRS := externals/lv_port_esp32/components

If only this directory is added, the Kconfig files in the following files are not reflected in menuconfig:

./externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_tft/Kconfig
./externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch/Kconfig

and thus compilation does not work.

Adding the following line works for me:

EXTRA_COMPONENT_DIRS := externals/lv_port_esp32/components externals/lv_port_esp32/components/lvgl_esp32_drivers externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_tft

Gamma correction issue

Init should be like that

  •    // Gamma setting.
    
  • st7789_send_cmd(Cmd_Positive_Gamma_Control);
  • tft_send_byte(0xd0);
  • tft_send_byte(0x00);
  • tft_send_byte(0x02);
  • tft_send_byte(0x07);
  • tft_send_byte(0x0a);
  • tft_send_byte(0x28);
  • tft_send_byte(0x32);
  • tft_send_byte(0x44);
  • tft_send_byte(0x42);
  • tft_send_byte(0x06);
  • tft_send_byte(0x0e);
  • tft_send_byte(0x12);
  • tft_send_byte(0x14);
  • tft_send_byte(0x17);
  • st7789_send_cmd(Cmd_Negative_Gamma_Control);
  • tft_send_byte(0xd0);
  • tft_send_byte(0x00);
  • tft_send_byte(0x02);
  • tft_send_byte(0x07);
  • tft_send_byte(0x0a);
  • tft_send_byte(0x28);
  • tft_send_byte(0x31);
  • tft_send_byte(0x54);
  • tft_send_byte(0x47);
  • tft_send_byte(0x0e);
  • tft_send_byte(0x1c);
  • tft_send_byte(0x17);
  • tft_send_byte(0x1b);
  • tft_send_byte(0x1e);
  • st7789_enable_backlight(true);

[Wrover Kit v4.1] The display doesn't display anything when the SD Card is inserted.

When the SD Card is inserted into the SD Card holder of the Wrover Kit v4.1, the display doesn't show anything.

This is because the Card Detect (CD) signal is connected to the IO_21 pin, R168 is pulling the IO_21 pin high (to VDD33) and R167 is connected in series between the CD signal and IO_21.
IO_21 is also connected to the D/C signal of the display, so the display D/C pin always gets a logic high, the display controller thinks it's always getting data and no commands.

To solve the issue I removed both R167 and R168, this have the caveat of not being able to detect when the SD Card is inserted on the holder, at least not without soldering a jumper wire connecting the CD signal from the SD Card holder to an unused IO of the ESP32 chip.

Remove_resistors_from_SD_CARD_CD_signal

"Install this project as a library submodule in your own project" not working

When following instructions to add lv_port_esp32 with CMake 4.0 repeated CMake error:

-- Building ESP-IDF components for target esp32
CMake Error at C:/ESP/esp-idf/tools/cmake/build.cmake:185 (message):
Failed to resolve component 'lvgl_tft'.
Call Stack (most recent call first):
C:/ESP/esp-idf/tools/cmake/build.cmake:211 (__build_resolve_and_add_req)
C:/ESP/esp-idf/tools/cmake/build.cmake:425 (__build_expand_requirements)
C:/ESP/esp-idf/tools/cmake/project.cmake:337 (idf_build_process)
CMakeLists.txt:7 (project)

Fixed by adding additional EXTRA_COMPONENT_DIRS arguments as follows:

set(EXTRA_COMPONENT_DIRS externals/lv_port_esp32/components externals/lv_port_esp32/components/lvgl_esp32_drivers externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_touch externals/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_tft)

Could this be because lvgl_touch and lvgl_tft are within a subdirectory of components rather than within components directory?

Hope this is helpful!

ESP-WROVER-KIT V4.1

I have compiled esp32_ili9341 example with the following changes:

file drv/disp_spi.h

#define DISP_SPI_MOSI 23
#define DISP_SPI_CLK  19
#define DISP_SPI_CS   22

file drv/ili9341.h

#define ILI9341_DC   21
#define ILI9341_RST  18
#define ILI9341_BCKL 5

drv/ili9341.c

///Enable backlight
printf("Enable backlight.\n");
gpio_set_level(ILI9341_BCKL, 0);

At run time I have the following error:

E (221) spi_master: spi_bus_add_device(455): When work in full-duplex mode at frequency > 26.7MHz, device cannot read correct data.
Try to use IOMUX pins to increase the frequency limit, or use the half duplex mode.
Please note the SPI master can only work at divisors of 80MHz, and the driver always tries to find the closest frequency to your configuration.
Specify ``SPI_DEVICE_NO_DUMMY`` to ignore this checking. Then you can output data at higher speed, or read data at your own risk.
assertion "ret==ESP_OK" failed: file "/home/anto/Projects/esp32/workspace/esp32_ili9341/drv/disp_spi.c", line 68, function: disp_spi_init
abort() was called at PC 0x400d289f on core 0

If the SPI speed is lowered to 20 MHz, the application turns correctly.
How can I solve?

[META] Add issue template?

Hi,

I would like to add an issue template to help users give us valuable information when they can't make the project run on their setup.

What should we ask for? Here's what i have so far...

  • Symptoms (display flickering, display all black/white)?
  • ESP32 Chip.
  • ESP-IDF version.
  • Development kit.
  • Development machine OS.
  • Compilation warnings/errors if available.
  • File with the compilation log?

On the README is a paragraph about using this repo as a way to add lvgl to custom user projects, in that case I think we should ask for the user directory structure.

Any aditional ideas?

Driver ILI9488 renders only a portion of the screen

Describe the issue
Hello! I place my question here, because I think that the error is due to driver ILI9488.
I ported the project to ESP32 according to the readme. I use Waveshare_ILI9486 display. After compiling and downloading, I see on the screen an incomplete picture, besides an inverted 90 degrees. Screen resolution 320x480, this parameters I save to sdkconfig, all other parameters I use the default. SPI frequency = 10 MHz, I use HSPI, but at higher frequencies there is no picture at all, perhaps because of the wired connection. With what may be due to this problem?

ESP-IDF version
last master

Development kit used
ESP-WROOM32

Development machine OS
Windows

If possible, copy the compilation log into a file and attach it here
Info: lv_init ready (../components/lvgl/lvgl/src/lv_core/lv_obj.c #117)
ILI9488 initialization.
Enabling backlight.
Info: Screen create ready (../components/lvgl/lvgl/src/lv_core/lv_obj.c #211)
Info: Screen create ready (../components/lvgl/lvgl/src/lv_core/lv_obj.c #211)
Info: Screen create ready (../components/lvgl/lvgl/src/lv_core/lv_obj.c #211)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: lv_img_set_src: LV_IMG_SRC_VARIABLE type found (../components/lvgl/lvgl/src/lv_objx/lv_img.c #152)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button matrix created (../components/lvgl/lvgl/src/lv_objx/lv_btnm.c #127)
Info: tab view created (../components/lvgl/lvgl/src/lv_objx/lv_tabview.c #184)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: page created (../components/lvgl/lvgl/src/lv_objx/lv_page.c #167)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: page created (../components/lvgl/lvgl/src/lv_objx/lv_page.c #167)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: page created (../components/lvgl/lvgl/src/lv_objx/lv_page.c #167)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: page created (../components/lvgl/lvgl/src/lv_objx/lv_page.c #167)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: text area created (../components/lvgl/lvgl/src/lv_objx/lv_ta.c #193)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: page created (../components/lvgl/lvgl/src/lv_objx/lv_page.c #167)
Info: list created (../components/lvgl/lvgl/src/lv_objx/lv_list.c #148)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: button created (../components/lvgl/lvgl/src/lv_objx/lv_btn.c #145)
Info: image created (../components/lvgl/lvgl/src/lv_objx/lv_img.c #108)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: container created (../components/lvgl/lvgl/src/lv_objx/lv_cont.c #113)
Info: label created (../components/lvgl/lvgl/src/lv_objx/lv_label.c #154)
Info: mesasge box created (../components/lvgl/lvgl/src/lv_objx/lv_mbox.c #125)
Info: button matrix created (../components/lvgl/lvgl/src/lv_objx/lv_btnm.c #127)
Info: chart created (../components/lvgl/lvgl/src/lv_objx/lv_chart.c #140)
Info: bar created (../components/lvgl/lvgl/src/lv_objx/lv_bar.c #116)
Info: slider created (../components/lvgl/lvgl/src/lv_objx/lv_slider.c #104)
Info: image draw: cache miss, cached to an empty entry (../components/lvgl/lvgl/src/lv_draw/lv_img_cache.c #109)

20200303_102630

Add ranges to Kconfig integer parameters?

Hi @jeremyjh, should we add ranges to the display pin configurations? So the users doesn't configure invalid pins?

In espressif examples they use them like so:

menu "Example Configuration"

    config BLINK_GPIO
        int "Blink GPIO number"
        range 0 34
        default 5
        help
            GPIO number (IOxx) to blink on and off.

            Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink.

            GPIOs 35-39 are input-only so cannot be used as outputs.

endmenu

line width for style not always functioning correctly

Below is a variation of the main program from this repository. The goal of the program is to display something similar to a big wide letter "W" at the top of the display.

If the line width (style_letter_w.line.width) for the lines making up this big wide letter "W" is 1, 2, 3 or 4, the program functions correctly. If the line width is 5 the "W" is no longer displayed correctly. What appears on the display is not even close to what it should be.

The tests were performed on an ESP-WROVER-KIT v4.

/* SPI Master example

   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "driver/gpio.h"
#include "lvgl/lvgl.h"
#include "lv_examples/lv_apps/demo/demo.h"
#include "esp_freertos_hooks.h"


#include "drv/disp_spi.h"
#include "drv/ili9341.h"
#include "drv/tp_spi.h"
#include "drv/xpt2046.h"

static void IRAM_ATTR lv_tick_task(void);

static lv_obj_t *letter_w;

void ui_create()
{
  // The points for a big wide letter "w" that will be displayed at the top
  // of the display.
  static lv_point_t letter_w_points[] = {
    {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10}
  };

  static lv_style_t style_letter_w;
  lv_style_copy(&style_letter_w, &lv_style_plain);
  style_letter_w.line.width = 5; // ***************************************************
                     // If style_letter_w.line.width is set to 5 the program breaks
                     // If style_letter_w.line.width is set to 3 the program functions

  letter_w = lv_line_create(lv_disp_get_scr_act(NULL), NULL);
  lv_line_set_points(letter_w, letter_w_points, 5);
  lv_line_set_style(letter_w, LV_LINE_STYLE_MAIN, &style_letter_w);
  lv_obj_align(letter_w, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
}

void app_main()
{
  lv_init();

  disp_spi_init();
  ili9341_init();

#if ENABLE_TOUCH_INPUT
  tp_spi_init();
  xpt2046_init();
#endif

  static lv_color_t buf1[DISP_BUF_SIZE];
  static lv_color_t buf2[DISP_BUF_SIZE];
  static lv_disp_buf_t disp_buf;
  lv_disp_buf_init(&disp_buf, buf1, buf2, DISP_BUF_SIZE);

  lv_disp_drv_t disp_drv;
  lv_disp_drv_init(&disp_drv);
  disp_drv.flush_cb = ili9341_flush;
  disp_drv.buffer = &disp_buf;
  lv_disp_drv_register(&disp_drv);

  // Set TOUCH_SUPPORT on drv\component.mk to 1 if
  // your board have touch support
#if ENABLE_TOUCH_INPUT
  lv_indev_drv_t indev_drv;
  lv_indev_drv_init(&indev_drv);
  indev_drv.read_cb = xpt2046_read;
  indev_drv.type = LV_INDEV_TYPE_POINTER;
  lv_indev_drv_register(&indev_drv);
#endif

  esp_register_freertos_tick_hook(lv_tick_task);

  ui_create();

  while(1) {
    vTaskDelay(1);
    lv_task_handler();
  }
}

static void IRAM_ATTR lv_tick_task(void)
{
  lv_tick_inc(portTICK_RATE_MS);
}

KConfig?

The standard convention in ESP-IDF libraries is to use KConfig / menuconfig / sdkconfig for user configuration of libraries/components. Right now this project uses a couple of makefile flags as well as header defines for configuration of the library for the end-user's device. I would suggest a move to use all header defines but have those defines in turn reference sdkconfig variables.

So in the header for example we'd change this:

#define DISP_SPI_MOSI 23

to

#define DISP_SPI_MOSI CONFIG_DISP_SPI_MOSI

CONFIG_DISP_SPI_MOSI in turn is set in sdkconfig directly or through menuconfig, and will still have a default value. The two layers of defines gives you the flexibility to quickly change it in the library header while testing, which does not recompile the whole sdk.

The advantage for the user is this similar to other libraries as well as all the IDF components themselves, but also that they do not necessarily have to vendor the library, they can keep it as a git submodule without worrying about the dirty flags.

I very recently implemented such a scheme for the loboris driver and would be happy to submit a PR for this library as well.

Install this project as a library submodule breaks build

Describe the issue
this commit changed instructions on adding the library into the components folder as aposed to an external directory. Following these instructions breaks the build

to reproduce...

  1. create a new esp-idf project
npx create-esp32-app
  1. try to build
idf.py build
  1. follow steps to add sub modules
mkdir -p components
git submodule add https://github.com/littlevgl/lv_port_esp32.git components/lv_port_esp32
git submodule update --init --recursive
  1. clean the build
    idf.py fullclean
  2. build the project
idf.py build

build is now broken adding references in the CMakeLists.txt files doesn't make any difference

Expected Results
idf.py build builds the project with no errors
Actual Results
cmake errors

ESP-IDF version
4.0

Development machine OS
windows
Compilation warnings/errors (if available)

If possible, copy the compilation log into a file and attach it here
C:\projects\spike\testv1>idf.py build
Checking Python dependencies...
Python requirements from C:\esp\esp-idf\requirements.txt are satisfied.
Executing action: all (aliases: build)
Running ninja in directory c:\projects\spike\testv1\build
Executing "ninja all"...
[0/1] Re-running CMake...
-- mconf-idf version mconf-v4.6.0.0-idf-20190628-win32
-- Project version: 032159a-dirty
-- Building ESP-IDF components for target esp32
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.25.1.windows.1")
CMake Error at C:/esp/esp-idf/tools/cmake/component.cmake:222 (message):
CMake Warning (dev) at build_properties.temp.cmake:2 (set):

Syntax error in cmake code at

  C:/projects/spike/testv1/build/build_properties.temp.cmake:2

when parsing string

  C:\esp\tools\.espressif\python_env\idf4.0_py3.7_env\Scripts\python.exe

Invalid escape sequence \e


Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
"cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
command to set the policy and suppress this warning.

Call Stack (most recent call first):

C:/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:1 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at
C:/esp/tools/.espressif/tools/cmake/3.13.4/share/cmake-3.13/Modules/ExternalProject.cmake:980
(define_property):

define_property command is not scriptable

Call Stack (most recent call first):

C:/esp/esp-idf/tools/cmake/kconfig.cmake:1 (include)
C:/esp/esp-idf/tools/cmake/idf.cmake:36 (include)
C:/esp/esp-idf/tools/cmake/project.cmake:7 (include)
C:/projects/spike/testv1/components/lv_port_esp32/CMakeLists.txt:3 (include)
C:/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:60 (include)
C:/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:76 (__component_get_requirements)

Call Stack (most recent call first):
C:/esp/esp-idf/tools/cmake/build.cmake:404 (__component_get_requirements)
C:/esp/esp-idf/tools/cmake/project.cmake:337 (idf_build_process)
CMakeLists.txt:12 (project)

ili9341 driver backlight

Hello,

In ili9341.c i think there might be a mistake in the ili9341_init() function. I changed the last instruction to gpio_set_level(ILI9341_BCKL, 0) as opposed to gpio_set_level(ILI9341_BCKL, 1). This might be due to the pull-up or pull-down config of the gpio but i am not sure.
Posted this for anybody that might encounter this.

Renaming the project (remove _ili9341)

  • Consider renaming the repository to just lv_port_esp32 since ILI9488 display drivers are already supported and additional drivers are likely to be added in the future.

Keeping the current name might lead to the misconception that only the ili9341 display driver is supported.

  • Consider renaming the folder /components/lvgl_ili9341 to something like /components/lvgl_esp32_drivers

Make it a general start-off project for all ESP32 + LittlevGL projects.

ILI9488 build error

Describe the issue
Error when compiling and ILI9488 is selected.

Code to reproduce the issue
Clone the repository, enter the menuconfig, set ILI9488 as the display driver and 480x320 resolution. Set the bus to HSPI.

Expected Results
The example compiles and runs.

Actual Results
idf.py flash fails.

NOTE: With the same settings, but ILI9341 selected instead of ILI9488, the build succeeds.

ESP32 Chip version
ESP-WROOM-32

ESP-IDF version
4.0

Development machine OS
Fedora 32 and macOS Catalina

Compilation warnings/errors (if available)

[10/72] Building C object esp-idf/lvgl_tft/CMakeFiles/__idf_lvgl_tft.dir/sh1107.c.obj
FAILED: esp-idf/lvgl_tft/CMakeFiles/__idf_lvgl_tft.dir/sh1107.c.obj 
/home/riccardo/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DLV_CONF_INCLUDE_SIMPLE=1 -Iconfig -I../components/lvgl_esp32_drivers/lvgl_tft -I/home/riccardo/esp/esp-idf/components/newlib/platform_include -I/home/riccardo/esp/esp-idf/components/freertos/include -I/home/riccardo/esp/esp-idf/components/freertos/xtensa/include -I/home/riccardo/esp/esp-idf/components/heap/include -I/home/riccardo/esp/esp-idf/components/log/include -I/home/riccardo/esp/esp-idf/components/lwip/include/apps -I/home/riccardo/esp/esp-idf/components/lwip/include/apps/sntp -I/home/riccardo/esp/esp-idf/components/lwip/lwip/src/include -I/home/riccardo/esp/esp-idf/components/lwip/port/esp32/include -I/home/riccardo/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/riccardo/esp/esp-idf/components/soc/src/esp32/. -I/home/riccardo/esp/esp-idf/components/soc/src/esp32/include -I/home/riccardo/esp/esp-idf/components/soc/include -I/home/riccardo/esp/esp-idf/components/esp_rom/include -I/home/riccardo/esp/esp-idf/components/esp_common/include -I/home/riccardo/esp/esp-idf/components/esp_system/include -I/home/riccardo/esp/esp-idf/components/xtensa/include -I/home/riccardo/esp/esp-idf/components/xtensa/esp32/include -I/home/riccardo/esp/esp-idf/components/esp32/include -I/home/riccardo/esp/esp-idf/components/driver/include -I/home/riccardo/esp/esp-idf/components/driver/esp32/include -I/home/riccardo/esp/esp-idf/components/esp_ringbuf/include -I/home/riccardo/esp/esp-idf/components/efuse/include -I/home/riccardo/esp/esp-idf/components/efuse/esp32/include -I/home/riccardo/esp/esp-idf/components/espcoredump/include -I/home/riccardo/esp/esp-idf/components/esp_timer/include -I/home/riccardo/esp/esp-idf/components/soc/soc/esp32/. -I/home/riccardo/esp/esp-idf/components/soc/soc/esp32/include -I/home/riccardo/esp/esp-idf/components/soc/soc/esp32/../include -I/home/riccardo/esp/esp-idf/components/vfs/include -I/home/riccardo/esp/esp-idf/components/esp_wifi/include -I/home/riccardo/esp/esp-idf/components/esp_wifi/esp32/include -I/home/riccardo/esp/esp-idf/components/esp_event/include -I/home/riccardo/esp/esp-idf/components/esp_netif/include -I/home/riccardo/esp/esp-idf/components/esp_eth/include -I/home/riccardo/esp/esp-idf/components/tcpip_adapter/include -I/home/riccardo/esp/esp-idf/components/app_trace/include -I../components/lvgl -I../components/lvgl/lvgl -mlongcalls -Wno-frame-address   -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.2-dev-1206-g741960d5c\" -DESP_PLATFORM -MD -MT esp-idf/lvgl_tft/CMakeFiles/__idf_lvgl_tft.dir/sh1107.c.obj -MF esp-idf/lvgl_tft/CMakeFiles/__idf_lvgl_tft.dir/sh1107.c.obj.d -o esp-idf/lvgl_tft/CMakeFiles/__idf_lvgl_tft.dir/sh1107.c.obj   -c ../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c
../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c: In function 'sh1107_set_px_cb':
../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c:47:27: error: 'byte_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define BIT_SET(a,b) ((a) |= (1U<<(b)))
                           ^~
../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c:121:14: note: 'byte_index' was declared here
     uint16_t byte_index;
              ^~~~~~~~~~
../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c:47:33: error: 'bit_index' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define BIT_SET(a,b) ((a) |= (1U<<(b)))
                                 ^~
../components/lvgl_esp32_drivers/lvgl_tft/sh1107.c:122:14: note: 'bit_index' was declared here
     uint8_t  bit_index;
              ^~~~~~~~~
cc1: some warnings being treated as errors

I attach a log of the build output after running idf.py clean.
log.log

I think it might be related to CONFIG_LVGL_DISPLAY_ORIENTATION_*.

Choosing ESP32 DevKit v4 (38 GPIOS) as board doesn't allow the user to set custom pins for display control

We use GitHub issues for development related discussions.
Please use the forum to ask questions.

Describe the issue
Choosing ESP32 DevKit v4 (38 GPIOS) as board doesn't allow the user to choose custom pins for the connection with the display.

Code to reproduce the issue
Choose ESP32 DevKit v4 (38 GPIOS) as board
imagen

Expected Results
Being able to choose custom pins for the connection between the microcontroller and the display.

Actual Results
The user can't set custom pins for the connection between the microcontroller and the display.

ESP32 Chip version
Any

ESP-IDF version
Any

Development kit used
ESP32 DevKit v4 (38 GPIOS)

Development machine OS
Any

Compilation warnings/errors (if available)

If possible, copy the compilation log into a file and attach it here

Settings via 'menuconfig' for touch panel use are ignored

Changes from #32 do conditionally include/exclude header files used for touch panel use depending on ENABLE_TOUCH_INPUT.
But ENABLE_TOUCH_INPUT is only defied in 'tp_spi.h' with the value from CONFIG_LVGL_ENABLE_TOUCH (set via 'menuconfig'), so it will never be included.
See line 24 in 'main.c' 15a15d0

Problems in SPI driver not setting DC correctly

Just for information, I used your driver to bring my stuff working. Since I rewrote big parts of them (I use the same SPI for touch and display), I found some problems I want to let you know.

In the display driver, there is a problematic condition on fast systems switching the DC pin, before the SPI transfer has been finished, especially in the beginning of the transfer. Since SPI returns after sending the stuff to the spi_device_queue, the pin might become toggled before the SPI transfer has been finished. Before triggering the spi ttuff inside ili9341_send_* a while(spi_trans_in_progress); is needed.

config dosent working

Something wrong with config

$ ls -la
-rw-rw-r-- 1 appz appz 15843 Mar 2 22:57 sdkconfig
-rw-rw-r-- 1 appz appz 27199 Mar 2 22:55 sdkconfig.old

$ make menuconfig

I cant see items menu connected with Sample Littlevgl. Therefore compilation is fail:

In file included from /home/appz/esp/lv_port_esp32/components/lvgl/lvgl/lvgl.h:26:0,
from /home/appz/esp/lv_port_esp32/components/lv_examples/lv_examples/lv_apps/benchmark/benchmark_bg.c:1:
/home/appz/esp/lv_port_esp32/components/lvgl/lvgl/src/lv_core/lv_obj.h:39:2: error: #error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
#error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
^
CC build/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.o
In file included from /home/appz/esp/lv_port_esp32/components/lvgl/lvgl/src/lv_core/lv_disp.h:17:0,
from /home/appz/esp/lv_port_esp32/components/lvgl/lvgl/src/lv_core/lv_disp.c:9:
/home/appz/esp/lv_port_esp32/components/lvgl/lvgl/src/lv_core/lv_obj.h:39:2: error: #error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
#error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"

Touchscreen calibration

I guess this example should include a touchscreen calibration procedure. There is one in tpcal.c, I am trying to integrate it into the example, but formulas seem to be wrong. I get negative values using them.

- A simple equation to adjust the coordinates: x_cal = ((x_act - x1_saved) * lcd_hor_res) / (x2_saved - x1_saved);
       - x_cal: the calibrated X coordinate
       - x_act: the currently measured X coordinate
       - x1_saved, x2_saved: The raw X coordinates saved as calibration data

So, if I have after calibration:

static lv_point_t point[4]; /*Calibration points: [0]: top-left; [1]: top-right, [2]: bottom-right, [3]: bottom-left */

Which of them is x1_saved and x2_saved? And for Y?

lvgl as a esp32-idf component

Hi,

Is it possible to add lvgl as a component (in the esp32 idf argon)? here is an example on how (see components directory).

The lvgl directory should be added into a directory named components, the same goes for the drv directory. The component.mk file that goes into the drv directory may look like this example:

COMPONENT_SRCDIRS := .
COMPONENT_ADD_INCLUDEDIRS := $(COMPONENT_SRCDIRS) ..

The component.mk file that goes into the lvgl directory may look like this example:

CFLAGS += -DLV_CONF_INCLUDE_SIMPLE

COMPONENT_SRCDIRS := . \
	./src/lv_core \
	./src/lv_draw \
	./src/lv_objx \
	./src/lv_hal \
	./src/lv_misc \
	./src/lv_misc/lv_fonts \
	./src/lv_themes \
	./src/lv_fonts
COMPONENT_ADD_INCLUDEDIRS := $(COMPONENT_SRCDIRS) ..

Add driver for monochrome display

To use OLED or any other kind of monochrome display we need to edit the lv_conf.h file and set LV_COLOR_DEPTH to 1. Also edit the disp_flush function.

Support ILI9488

Is it possible to support the IL9488? As far as I understand, the differences are quite minimal. Thanks

cannot build disp_driver.c

Describe the issue

Cannot build

Compilation warnings/errors (if available)
../components/lvgl_esp32_drivers/lvgl_tft/disp_driver.c:20:5: error: implicit declaration of function 'ili9341_init';

It looks it is adding this file and it shouldn't? because disp_driver.c is inline included in lvgl_driver.c

Failed make

I followed the example project - esp32_ili9341
connection and all the things are correct but I get compile error when I do make

Error -
Toolchain path: /home/User/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: esp32-2019r1
Compiler version: 8.2.0
Python requirements from /home/User/esp/esp-idf/requirements.txt are satisfied.

App "hello-world" version: 5c0a45c-dirty
LD build/hello-world.elf
/home/User/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/User/esp/projects/esp32_ili9341/build/main/libmain.a(main.o):(.literal.app_main+0x18): undefined reference to demo_create' /home/User/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/User/esp/projects/esp32_ili9341/build/main/libmain.a(main.o): in function app_main':
/home/User/esp/projects/esp32_ili9341/main/main.c:44: undefined reference to `demo_create'
collect2: error: ld returned 1 exit status
/home/User/esp/esp-idf/make/project.mk:522: recipe for target '/home/User/esp/projects/esp32_ili9341/build/hello-world.elf' failed
make: *** [/home/User/esp/projects/esp32_ili9341/build/hello-world.elf] Error

Thanks in advance !

Touch works only with the tpcal example

I imported this library in a platform underesp-idf environment.
All the graphic functions on the display work correctly, but unfortunately the touch in none of the examples works.
Only by calling the "tpcal_create ()" function for touch adjustment, the device receives the signal that the screen has been pressed. It is as if only the "touch" event is called in this function. How is it possible that only in this example does the touch work correctly?

Thanks, and congratulations for the great work you have done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.