Lv_task_handler stops running without crash

Description

I’m using the latest version of the lv_port_esp32.

My Project uses multiple Tasks for WiFi, BLE, MQTT and more. On top of that i have lvgl with the tick_hook, lv_task and an helper task, which changes the for the content on the screen.

Everything works for the first two screens and then the lv_task just stops without error. The lvgl widgets are created, but never displayed after that.

Later the watchdog is triggered, because the lv_task is IDLE.

I tried using lv_tasks instead of freeRTOS tasks, but that didn’t helped and i also tried to use Semaphores around every lv operation, but that didn’t helped either.

What MCU/Processor/Board and compiler are you using?

ESP32-WROVER-B
esp-idf 4.0.1

Code to reproduce

The project is divided in multiple classes. I just give you the important stuff for my problem, but i can also give you the complete code if necessary.

The display_init function is called from app_main.


#define LINE_MAX_LEN 24

static const char *TAG = "Display";

static message_types screen_before = 0;
static display_modes display_mode = MODE_NONE;
static gesture_directions gesture_direction = GES_NONE;
static int first_move = 1;

//Loading Task handle
//static TaskHandle_t loading_task;

static void display_qrcode()
{
	static int first = 1;
	if (first)
	{
		screen_init_tabs();
		first = 0;
	}
	else
	{
		screen_switch_qrcode();
	}
}

static void display_screen_next(int *position)
{
	if (buffer_has_next(position))
	{
		char *rev = buffer_next(position);
		printf("Dump at adress: %.20s\n", rev);
		ESP_LOGI(TAG, "Change left to rev: %s", rev);
		display_revenue(rev);
	}
	else
	{
		ESP_LOGI(TAG, "No Revenue next");
		ESP_LOGI(TAG, "Position %d", *position);
	}
}

static void display_screen_before(int *position)
{
	if (buffer_has_before(position))
	{
		char *rev = buffer_before(position);
		ESP_LOGI(TAG, "Change right to rev: %s", rev);
		display_revenue(rev);
	}
	else
	{
		ESP_LOGI(TAG, "No Revenue before");
	}
}

static void display_rev_save(char *new_rev)
{
#if GESTURE_ENABLE
	buffer_put(new_rev);
	first_move = 1;
#endif
	display_revenue(new_rev);
}

static void display_connect()
{
	screen_connect();
}

static void display_config()
{
	screen_config();
	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_bluetooth(char *passkey)
{
	screen_bluetooth(passkey);

	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_start_screen()
{
	//Print Device id and Firmware version
	uint8_t chipid[6];
	esp_efuse_mac_get_default(chipid);
	char output[23];
	int j = 0;
	for (int i = 0; i < 6; i++)
	{ // Print chipid to readable hex characters
		if (i == 5)
			sprintf(output + j, "%02X", chipid[i]);
		else
			sprintf(output + j, "%02X:", chipid[i]);
		j = j + 3;
	}
	ESP_LOGI(TAG, "MAC Address: %s", output);

	screen_start(output, app_version);

	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_logo()
{
	screen_logo();
}

static void display_controller(lv_task_t * task)
{
	ESP_LOGE(TAG, "Controller task");
	while (1)
	{
		struct display_message msg;
		if (xQueueReceive(display_evt_queue, &msg, portMAX_DELAY))
		{
			ESP_LOGI(TAG, "Event: %d", msg.type);
			if (msg.type != MSG_RESET)
				screen_before = msg.type;
			switch (msg.type)
			{
			case MSG_BLEPAIR:
				display_bluetooth(msg.message);
				break;
			case MSG_CONNECT:
				display_connect();
				break;
			case MSG_REVENUE:
				display_rev_save(msg.message);
				break;
			case MSG_QRCODE:
				display_mode = MODE_PAY;
				display_qrcode();
				break;
			case MSG_LOGO:
				display_logo();
				break;
			case MSG_CONFIG:
				display_config();
				break;
			case MSG_OTAUPDATE:
				display_update();
				break;
			case MSG_RESET:
				display_reset();
				break;
			case MSG_RESTART:
				vTaskDelay(200 / portTICK_PERIOD_MS);
				esp_restart();
			case MSG_ERROR:
				display_mode = MODE_NONE;
				ESP_LOGI(TAG, "Restart: %d", msg.restart);
				display_error(msg.message, msg.restart);
				break;
			case MSG_GESTURE_LEFT:
			case MSG_GESTURE_UP:
			case MSG_GESTURE_DOWN:
			case MSG_GESTURE_RIGHT:
				display_gesture(msg.type & 0x0F);
				break;
			}
		}
		vTaskDelay(100 / portTICK_PERIOD_MS);
	}
}

static void lv_task(void *arg)
{
	while (1)
	{
		lv_task_handler();
		vTaskDelay(5);
	}
}

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

static lv_color_t *buf1;
static lv_color_t *buf2;

void display_init()
{
	esp_err_t ret;
#if GESTURE_ENABLE
	gesture_init();
	buffer_init();
#endif

	lv_init();

	esp_register_freertos_tick_hook(lv_tick_task);

	lvgl_driver_init();

	spiffs_driver_init();
	vTaskDelay(100);

	// Save buffers in heap, stack is to small
	buf1 = calloc(1, DISP_BUF_SIZE);
	buf2 = calloc(1, DISP_BUF_SIZE);
	//__NOINIT_ATTR static lv_color_t buf1[DISP_BUF_SIZE];
	//__NOINIT_ATTR 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);
	
	xTaskCreate(lv_task, "lv_task", 4096, NULL, 1, NULL);

	vTaskDelay(20 / portTICK_PERIOD_MS); 

	//Trigger start seq
	display_start_screen();

	xTaskCreate(display_controller, "display_controller", 8192, NULL, 9, NULL);
	//lv_task_t * task = lv_task_create(display_controller, 500, LV_TASK_PRIO_MID, NULL);
}

In this functions the content of the screen is changed. The display_controller from the code above calls the screen functions. When screen_init_tabs is called, the lv_task stops running.

LV_FONT_DECLARE(circular_black34);
LV_FONT_DECLARE(circular_black25);
LV_FONT_DECLARE(circular_bold22);
LV_FONT_DECLARE(circular_medium14);
LV_FONT_DECLARE(circular_medium17);
LV_IMG_DECLARE(shopdevice_vimpay);
LV_IMG_DECLARE(shopdevice_payment);
LV_IMG_DECLARE(shopdevice_qrcode);

static lv_obj_t *tabview;
static lv_obj_t *tabrev;
static lv_obj_t *tabqr;

static lv_obj_t *rev_amount;
static lv_obj_t *rev_consumer;

static lv_style_t style_black_25;
static lv_style_t style_bold_22;
static lv_style_t style_black_34;
static lv_style_t style_medium_17_light_grey;
static lv_style_t style_medium_17_dark_grey;
static lv_style_t style_medium_14;

//static const char *TAG = "Screens";
static void screen_qrcode(lv_obj_t *parent)
{
    lv_obj_t *scan_mich = lv_label_create(parent, NULL);
    lv_obj_add_style(scan_mich, LV_BTN_PART_MAIN, &style_black_25);
    lv_label_set_text(scan_mich, "SCAN MICH");
    lv_label_set_align(scan_mich, LV_LABEL_ALIGN_CENTER);
    lv_obj_align(scan_mich, NULL, LV_ALIGN_IN_TOP_MID, 0, 23);

    lv_obj_t *qrcode = lv_img_create(parent, NULL);
    lv_img_set_src(qrcode, &shopdevice_qrcode);
    //lv_obj_set_pos(qrcode, 25, 70);

    lv_obj_t *vimpay = lv_img_create(parent, NULL);
    lv_img_set_src(vimpay, &shopdevice_vimpay);
}

void screen_switch_payment(char *amount, char *consumer)
{
    char amount_final[strlen(amount) + 5];
    strcpy(amount_final, amount);
    strcat(amount_final, " \xE2\x82\xAC");

    lv_label_set_text(rev_amount, amount_final);
    lv_obj_align(rev_amount, NULL, LV_ALIGN_IN_TOP_MID, 0, 223);

    lv_label_set_text(rev_consumer, consumer);
    lv_obj_align(rev_consumer, NULL, LV_ALIGN_IN_TOP_MID, 0, 255);

    lv_tabview_set_tab_act(tabview, 1, LV_ANIM_ON);
}

void screen_switch_qrcode()
{
    printf("Switch to qrcode\n");
    lv_tabview_set_tab_act(tabview, 0, LV_ANIM_ON);
}

void screen_init_tabs()
{
    /*Create a Tab view object*/
    lv_obj_t *tabview;
    tabview = lv_tabview_create(lv_scr_act(), NULL);

    /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
    lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1");
    lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2");
    lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3");

    lv_obj_t *tabscreen = lv_obj_create(NULL, NULL);
    lv_obj_set_style_local_bg_color(tabscreen, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

    tabview = lv_tabview_create(lv_scr_act(), NULL);
    tabqr = lv_tabview_add_tab(tabview, "QR Code"); // No text needed for tabs
    tabrev = lv_tabview_add_tab(tabview, "Revenue");
    lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_NONE);
    lv_page_set_scrollbar_mode(tabqr, LV_SCROLLBAR_MODE_OFF);
    lv_page_set_scrollbar_mode(tabrev, LV_SCROLLBAR_MODE_OFF);

    screen_qrcode(tabqr);

    lv_obj_t *rev_heading = lv_label_create(tabrev, NULL);
    lv_obj_add_style(rev_heading, LV_LABEL_PART_MAIN, &style_bold_22);
    lv_label_set_text(rev_heading, "Erfolgreich bezahlt!");
    lv_label_set_align(rev_heading, LV_LABEL_ALIGN_CENTER);
    lv_obj_align(rev_heading, NULL, LV_ALIGN_IN_TOP_MID, 0, 64);

    lv_obj_t *vimpay = lv_img_create(tabrev, NULL);
    lv_img_set_src(vimpay, &shopdevice_payment);
    lv_obj_set_pos(vimpay, 80, 110);

    rev_amount = lv_label_create(tabrev, NULL);
    lv_obj_add_style(rev_amount, LV_LABEL_PART_MAIN, &style_black_34);
    lv_label_set_align(rev_amount, LV_LABEL_ALIGN_CENTER);
    lv_obj_set_width(rev_amount, 240);
    lv_obj_align(rev_amount, NULL, LV_ALIGN_IN_TOP_MID, 0, 223);
    lv_label_set_text(rev_amount, "");

    rev_consumer = lv_label_create(tabrev, NULL);
    lv_obj_add_style(rev_consumer, LV_LABEL_PART_MAIN, &style_medium_17_dark_grey);
    lv_label_set_align(rev_consumer, LV_LABEL_ALIGN_CENTER);
    lv_label_set_long_mode(rev_consumer, LV_LABEL_LONG_BREAK);
    lv_obj_set_width(rev_consumer, 230);
    lv_obj_align(rev_consumer, NULL, LV_ALIGN_IN_TOP_MID, 0, 255);

    lv_disp_load_scr(tabscreen);
}

void screen_connect()
{
    lv_obj_t *connect_screen = lv_obj_create(NULL, NULL);
    lv_obj_set_style_local_bg_color(connect_screen, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

    lv_obj_t *gleich_bereit = lv_label_create(connect_screen, NULL);
    lv_obj_add_style(gleich_bereit, LV_LABEL_PART_MAIN, &style_medium_14);
    lv_label_set_text(gleich_bereit, "bin gleich bereit...");
    lv_obj_align(gleich_bereit, NULL, LV_ALIGN_IN_TOP_MID, 0, 109);

    lv_obj_t *wird_aufgebaut = lv_label_create(connect_screen, NULL);
    lv_obj_add_style(wird_aufgebaut, LV_LABEL_PART_MAIN, &style_medium_17_dark_grey);
    lv_label_set_text(wird_aufgebaut, "Verbindung zum VIMpay\nServer wird aufgebaut...");
    lv_label_set_align(wird_aufgebaut, LV_LABEL_ALIGN_CENTER);
    lv_obj_align(wird_aufgebaut, NULL, LV_ALIGN_IN_TOP_MID, 0, 163);

    lv_obj_t *img_vimpay = lv_img_create(connect_screen, NULL);
    lv_img_set_src(img_vimpay, &shopdevice_vimpay);
    lv_obj_set_pos(img_vimpay, 94, 275);

    lv_scr_load(connect_screen);
}

void screen_start(char *mac, char *app_version)
{
    
    init_styles();
    lv_obj_t *start_screen = lv_obj_create(NULL, NULL);
    lv_obj_set_style_local_bg_color(start_screen, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

    lv_obj_t *img_vimpay_big = lv_img_create(start_screen, NULL);
    lv_img_set_src(img_vimpay_big, IMG_VIMPAY_BIG);
    lv_obj_set_pos(img_vimpay_big, 38, 46);
    
    lv_obj_t *device_id = lv_label_create(start_screen, NULL);
    lv_obj_add_style(device_id, LV_LABEL_PART_MAIN, &style_medium_14);
    lv_label_set_text(device_id, mac);
    lv_obj_align(device_id, NULL, LV_ALIGN_CENTER, 0, 98);

    lv_obj_t *firmware_version = lv_label_create(start_screen, NULL);
    lv_obj_add_style(firmware_version, LV_LABEL_PART_MAIN, &style_medium_14);
    lv_obj_set_y(firmware_version, 290);
    lv_label_set_align(firmware_version, LV_LABEL_ALIGN_CENTER);
    lv_label_set_text(firmware_version, app_version);
    lv_obj_align(firmware_version, NULL, LV_ALIGN_CENTER, 0, 110);

    lv_scr_load(start_screen);
}

void screen_logo()
{
   ...
}

Output log of esp32 monitor with enabled lvgl tracing.

I (78) boot: Chip Revision: 1
I (32) boot: ESP-IDF v4.0.1-197-g94d97499a 2nd stage bootloader
I (32) boot: compile time 08:50:23
I (65) boot: Enabling RNG early entropy source...
I (65) boot: SPI Speed      : 40MHz
I (65) boot: SPI Mode       : DIO
I (67) boot: SPI Flash Size : 4MB
I (72) boot: Partition Table:
I (75) boot: ## Label            Usage          Type ST Offset   Length
I (82) boot:  0 nvs              WiFi data        01 02 0000b000 00006000
I (90) boot:  1 otadata          OTA data         01 00 00011000 00002000
I (97) boot:  2 phy_init         RF data          01 01 00013000 00001000
I (105) boot:  3 ota_0            OTA app          00 10 00020000 00190000
I (112) boot:  4 ota_1            OTA app          00 11 001b0000 00190000
I (120) boot:  5 spiffs           Unknown data     01 82 00340000 0007d000
I (127) boot:  6 nvs_key          NVS keys         01 04 003ff000 00001000
I (135) boot: End of partition table
I (139) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x42340 (271168) map
I (263) esp_image: segment 1: paddr=0x00062368 vaddr=0x3ffbdb60 size=0x03e28 ( 15912) load
I (270) esp_image: segment 2: paddr=0x00066198 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/tobiaskuch/esp/esp-idf/components/freertos/xtensa_vectors.S:1778

I (271) esp_image: segment 3: paddr=0x000665a0 vaddr=0x40080400 size=0x09a70 ( 39536) load
I (297) esp_image: segment 4: paddr=0x00070018 vaddr=0x400d0018 size=0x10bbec (1096684) map
0x400d0018: _stext at ??:?

I (759) esp_image: segment 5: paddr=0x0017bc0c vaddr=0x40089e70 size=0x11c10 ( 72720) load
0x40089e70: btdm_rf_bb_init_phase1 at ??:?

I (811) boot: Loaded app from partition at offset 0x20000
I (812) boot: Checking flash encryption...
I (812) flash_encrypt: flash encryption is enabled (0 plaintext flashes left)
I (819) boot: Disabling RNG early entropy source...
I (825) psram: This chip is ESP32-D0WD
I (829) spiram: Found 32MBit SPI RAM device
I (834) spiram: SPI RAM mode: flash 40m sram 40m
I (839) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (846) cpu_start: Pro cpu up.
I (850) cpu_start: Application information:
I (855) cpu_start: Project name:     shop_device
I (860) cpu_start: App version:      v0.4-7-g0608a62-dirty
I (866) cpu_start: Compile time:     Aug  6 2020 16:37:29
I (872) cpu_start: ELF file SHA256:  9b208da06c6354cf...
I (878) cpu_start: ESP-IDF:          v4.0.1-197-g94d97499a
I (885) cpu_start: Starting app cpu, entry point is 0x40081620
0x40081620: call_start_cpu1 at /home/tobiaskuch/esp/esp-idf/components/esp32/cpu_start.c:271

W (891) flash_encrypt: Flash encryption mode is DEVELOPMENT (not secure)
I (882) cpu_start: App cpu up.
I (1790) spiram: SPI SRAM memory test OK
I (1791) heap_init: Initializing. RAM available for dynamic allocation:
I (1791) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1797) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1803) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1809) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (1815) heap_init: At 3FFD10F0 len 0000EF10 (59 KiB): DRAM
I (1822) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1828) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1835) heap_init: At 4009BA80 len 00004580 (17 KiB): IRAM
I (1841) cpu_start: Pro cpu start user code
I (1846) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1868) spi_flash: detected chip: gd
I (1868) spi_flash: flash io: dio
I (1868) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1876) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (2001) ShopDevice: App version: v0.4-7-g0608a62-dirty
I (2006) ShopDevice: Version numeric 47
Trace: lv_init started  (lv_obj.c #124 lv_init())
Info: lv_init ready     (lv_obj.c #162 lv_init())
Timer 5 portTICK_PERIOD, period 2
I (2016) lvgl_helpers: Display hor size: 320, ver size: 240
I (2021) lvgl_helpers: Display buffer size: 20480
I (2026) lvgl_helpers: Initializing SPI master for display
I (2031) lvgl_helpers: Configuring SPI host HSPI_HOST (1)
I (2041) lvgl_helpers: MISO pin: -1, MOSI pin: 23, SCLK pin: 19
I (2046) lvgl_helpers: Max transfer size: 40960 (bytes)
I (2051) lvgl_helpers: Initializing SPI bus...
I (2056) disp_spi: Adding SPI device
I (2061) disp_spi: Clock speed: 40000000Hz, mode: 0, CS pin: 22
I (2266) ILI9341: Initialization.
I (2466) ILI9341: Enabling backlight.
I (2466) ILI9341: Display orientation: LANDSCAPE
I (2466) ILI9341: 0x36 command value: 0x28
I (2516) SPIFFS-DRIVER: Partition size: total: 463346, used: 73543
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
I (3061) Display: MAC Address: 30:AE:A4:EF:4B:58
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: image create started     (lv_img.c #62 lv_img_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: image created     (lv_img.c #127 lv_img_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Trace: lv_refr_task: ready      (lv_refr.c #305 _lv_disp_refr_task())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: still running 2  (lv_task.c #398 lv_task_exec())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Info: image draw: cache miss, cached to an empty entry  (lv_img_cache.c #122 _lv_img_cache_open())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Trace: image draw: image found in the cache     (lv_img_cache.c #101 _lv_img_cache_open())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Trace: image draw: image found in the cache     (lv_img_cache.c #101 _lv_img_cache_open())
Trace: lv_refr_task: ready      (lv_refr.c #305 _lv_disp_refr_task())
Trace: still running 2  (lv_task.c #398 lv_task_exec())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
E (6151) Display: Controller task
I (6156) Display: Event: 3
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: image create started     (lv_img.c #62 lv_img_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: image created     (lv_img.c #127 lv_img_create())
Info: lv_img_set_src:  `LV_IMG_SRC_VARIABLE` type found         (lv_img.c #180 lv_img_set_src())
I (6266) wifi:wifi driver task: 3ffe3568, prio:23, stack:6656, core=0
I (6266) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
I (6276) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
Trace: lv_refr_task: ready      (lv_refr.c #305 _lv_disp_refr_task())
Trace: still running 2  (lv_task.c #398 lv_task_exec())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (6366) wifi:wifi firmware version: d74ef33
I (6366) wifi:config NVS flash: enabled
I (6371) wifi:config nano formating: disabled
I (6376) wifi:Init dynamic tx buffer num: 32
I (6376) wifi:Init data frame dynamic rx buffer num: 32
I (6381) wifi:Init management frame dynamic rx buffer num: 32
I (6386) wifi:Init management short buffer num: 32
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
I (6391) wifi:Trace: lv_task_handler ready      (lv_task.c #190 lv_task_handler())
Init static tx buffer num: 16
I (6411) wifi:Init static rx buffer size: 1600
I (6411) wifi:Init static rx buffer num: 10
I (6416) wifi:Init dynamic rx buffer num: 32
I (6426) ShopDevice WiFi: start the WIFI SSID:[muenchen.freifunk.net/freising]
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (6541) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0
I (6541) wifi:mode : sta (30:ae:a4:ef:4b:58)
I (6546) ShopDevice WiFi: Waiting for wifi
I (6546) ShopDevice WiFi: SYSTEM_EVENT_STA_START
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler()
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (7281) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (7281) wifi:state: init -> auth (b0)
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (7291) wifi:state: auth -> assoc (0)
I (7301) wifi:state: assoc -> run (10)
I (7301) wifi:connected with muenchen.freifunk.net/freising, aid = 11, channel 6, BW20, bssid = 18:e8:29:e1:13:ea
I (7306) wifi:security: Open Auth, phy: bgn, rssi: -74
I (7311) wifi:pm start, type: 1

Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (8186) tcpip_adapter: sta ip: 10.80.216.58, mask: 255.255.248.0, gw: 10.80.216.3
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (9186) ShopDevice MQTT: User: 30aea4d80490, Password: ZsfT1ouazgxr0UNqObIw8oAuDIBI3PvpnHBUUMMqbjm6KKn0zz4oFdyT8mmQsBFL, Topic: shopdevice/30aea4d80490
I (9191) ShopDevice MQTT: Fill all topics with: shopdevice/30aea4d80490
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
I (9206) ShopDevice MQTT: Topics set: shopdevice/30aea4d80490 shopdevice/30aea4d80490/ota shopdevice/30aea4d80490/version
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (9221) ShopDevice MQTT: [APP] Free memory: 4220904 bytes
I (9231) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (11191) ShopDevice MQTT: MQTT_EVENT_CONNECTED
I (11191) ShopDevice MQTT: Subscribe: shopdevice/30aea4d80490
I (11196) ShopDevice MQTT: subscribe successful, msg_id=49945
I (11201) ShopDevice MQTT: Subscribe: shopdevice/30aea4d80490/ota
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
I (11211) ShopDevice MQTT: subscribe successful, msg_id=28816
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (11231) Display: Event: 2
Trace: tab view create started  (lv_tabview.c #74 lv_tabview_create())
I (11236) ShopDevice MQTT: MQTT_EVENT_SUBSCRIBED, msg_id=49945
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: page create started      (lv_page.c #82 lv_page_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
I (11271) ShopDevice MQTT: MQTT_EVENT_SUBSCRIBED, msg_id=28816
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
Info: container created         (lv_cont.c #118 lv_cont_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Info: page created      (lv_page.c #160 lv_page_create())
Trace: button matrix create started     (lv_btnmatrix.c #73 lv_btnmatrix_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: button matrix created     (lv_btnmatrix.c #121 lv_btnmatrix_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: tab view created  (lv_tabview.c #192 lv_tabview_create())
Trace: page create started      (lv_page.c #82 lv_page_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Info: page created      (lv_page.c #160 lv_page_create())
Trace: page create started      (lv_page.c #82 lv_page_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Info: page created      (lv_page.c #160 lv_page_create())
Trace: page create started      (lv_page.c #82 lv_page_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Trace: container create started         (lv_cont.c #70 lv_cont_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: container created         (lv_cont.c #118 lv_cont_create())
Info: page created      (lv_page.c #160 lv_page_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
E (1285441) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (1285441) task_wdt:  - IDLE1 (CPU 1)
E (1285441) task_wdt: Tasks currently running:
E (1285441) task_wdt: CPU 0: IDLE0
E (1285441) task_wdt: CPU 1: lv_task

Hi,

this was reported a few times in the past and we couldn’t find its root. I thought it’s an issue in the user’s program but I tend to believe it’s an LGL issue.

It’s the best description of the issue so far so I hope we will find what’s going on!

There are some strange lines in the log:

Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())

How could lv_task_handler started during object creation (between "Object create started " and “Object create ready”) if semaphores are used on every LVGL call. It looks like somehow lv_task_started to run during lv_obj_create by FreeRTOS or somehow o nthe other core.

In the lv_port_esp32 repo there is this line. Maybe it’s related somehow.

@Carlos_Diaz can you tell a few words about it?

BTW, how much time does it take the issue to happen?

Thanks for the quick answer.

I restructured my code like the lv_port_esp32 example and used xSemaphore consequently. But the issue is still there. The lv_task with the lv_task_handler stops randomly after some lvgl call.

Here is my updated code.

/*
 * display.c
 *
 *  Created on: 07.03.2019
 *      Author: tobiaskuch
 *  
 */

#include <sys/fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/event_groups.h"

#include "esp_task_wdt.h"
#include <errno.h>
#include "esp_err.h"
#include "esp_log.h"
#include "driver/gpio.h"
#include "gesture.h"

#include "shop_device.h"
#include "mqtts.h"
#include "buffer.h"

#include "lvgl/lvgl.h"
#include "esp_freertos_hooks.h"

#include "disp_spi.h"
#include "disp_driver.h"

#include "tp_spi.h"
#include "xpt2046.h"

#include "spiffs_driver.h"
#include "screens.c"
#include "display.h"

#define LINE_MAX_LEN 24

static const char *TAG = "Display";
xTaskHandle screen_changer_handle;
SemaphoreHandle_t xGuiSemaphore = NULL;

static message_types screen_before = 0;
static display_modes display_mode = MODE_NONE;
static gesture_directions gesture_direction = GES_NONE;
static int first_move = 1;

//Loading Task handle
//static TaskHandle_t loading_task;

static void display_update()
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_update();
	xSemaphoreGive(xGuiSemaphore);
}

static void display_reset()
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_reset();
	xSemaphoreGive(xGuiSemaphore);

	vTaskDelay(7000 / portTICK_RATE_MS);
	//Print Screen Before
	struct display_message msg;
	msg.type = screen_before;
	xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);
}

static int find_near_space(char *str)
{
	for (int i = strlen(str) - 1; i > 0; i--)
	{
		if (str[i] == ' ')
		{
			return i;
		}
	}
	return LINE_MAX_LEN;
}

static void display_revenue(char *new_rev)
{
	char rev_copy[strlen(new_rev)];
	strcpy(rev_copy, new_rev);
	//Split char* at ;
	char *amount = "";
	char *sender = "";
	char *rev_ptr = strtok(rev_copy, ";");
	if (rev_ptr != NULL)
	{
		amount = rev_ptr;
		rev_ptr = strtok(NULL, ";");
		if (rev_ptr != NULL)
			sender = rev_ptr;
	}
	//Lastname cut to first letter
	uint8_t space = find_near_space(sender);
	sender[space + 2] = '.';
	sender[space + 3] = '\0';

	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_switch_payment(amount, sender);
	xSemaphoreGive(xGuiSemaphore);

	vTaskDelay(DISP_REVENUE_DELAY_MS / portTICK_PERIOD_MS);

	//Check if QR-Code already in queue
	struct display_message msg_before;
	xQueuePeek(display_evt_queue, &msg_before, (TickType_t)10);
	if (msg_before.type != MSG_QRCODE)
	{
		//Print QR Code
		struct display_message msg;
		msg.type = MSG_QRCODE;
		xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);
	}
}

static void display_error(char *error_msg, bool restart)
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_error(error_msg);
	xSemaphoreGive(xGuiSemaphore);

	vTaskDelay(5000 / portTICK_PERIOD_MS);
	if (restart)
		esp_restart();
}

static void display_qrcode()
{
	static int first = 1;
	if (first)
	{
		while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
		screen_init_tabs();
		xSemaphoreGive(xGuiSemaphore);
		first = 0;
	}
	else
	{
		while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
		screen_switch_qrcode();
		xSemaphoreGive(xGuiSemaphore);
	}
}

static void display_screen_next(int *position)
{
	if (buffer_has_next(position))
	{
		char *rev = buffer_next(position);
		printf("Dump at adress: %.20s\n", rev);
		ESP_LOGI(TAG, "Change left to rev: %s", rev);
		while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
		display_revenue(rev);
		xSemaphoreGive(xGuiSemaphore);
	}
	else
	{
		ESP_LOGI(TAG, "No Revenue next");
		ESP_LOGI(TAG, "Position %d", *position);
	}
}

static void display_screen_before(int *position)
{
	if (buffer_has_before(position))
	{
		char *rev = buffer_before(position);
		ESP_LOGI(TAG, "Change right to rev: %s", rev);
		display_revenue(rev);
	}
	else
	{
		ESP_LOGI(TAG, "No Revenue before");
	}
}

static void display_rev_save(char *new_rev)
{
#if GESTURE_ENABLE
	buffer_put(new_rev);
	first_move = 1;
#endif
	display_revenue(new_rev);
}

static void display_gesture(uint8_t move)
{
	ESP_LOGI(TAG, "Move %d", move);
	if (display_mode == MODE_PAY)
	{
		static int iterator;
		if (first_move)
		{
			iterator = get_head_position();
			first_move = 0;
		}

		switch (move)
		{
		case DIR_UP:
		case DIR_DOWN:
			iterator = get_head_position();
			screen_switch_qrcode();
			break;
		case DIR_LEFT:
			if (gesture_direction == GES_NONE)
				gesture_direction = GES_LEFT;
			if (gesture_direction == GES_LEFT)
				display_screen_next(&iterator);
			else
				display_screen_before(&iterator);
			break;
		case DIR_RIGHT:
			if (gesture_direction == GES_NONE)
				gesture_direction = GES_RIGHT;
			if (gesture_direction == GES_RIGHT)
				display_screen_next(&iterator);
			else
				display_screen_before(&iterator);
			break;
		default:
			ESP_LOGI(TAG, "NONE");
		}
	}
}

static void display_connect()
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_connect();
	xSemaphoreGive(xGuiSemaphore);
}

static void display_config()
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_config();
	xSemaphoreGive(xGuiSemaphore);
	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_bluetooth(char *passkey)
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_bluetooth(passkey);
	xSemaphoreGive(xGuiSemaphore);

	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_start_screen()
{
	//Print Device id and Firmware version
	uint8_t chipid[6];
	esp_efuse_mac_get_default(chipid);
	char output[23];
	int j = 0;
	for (int i = 0; i < 6; i++)
	{ // Print chipid to readable hex characters
		if (i == 5)
			sprintf(output + j, "%02X", chipid[i]);
		else
			sprintf(output + j, "%02X:", chipid[i]);
		j = j + 3;
	}
	ESP_LOGI(TAG, "MAC Address: %s", output);

	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_start(output, app_version);
	xSemaphoreGive(xGuiSemaphore);

	vTaskDelay(3000 / portTICK_PERIOD_MS);
}

static void display_logo()
{
	while (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdFALSE);
	screen_logo();
	xSemaphoreGive(xGuiSemaphore);
}

static void display_controller(lv_task_t *task)
{
	ESP_LOGI(TAG, "Controller task");
	//Trigger start seq
	display_start_screen();
	while (1)
	{
		struct display_message msg;
		if (xQueueReceive(display_evt_queue, &msg, portMAX_DELAY))
		{
			ESP_LOGI(TAG, "Event: %d", msg.type);
			if (msg.type != MSG_RESET)
				screen_before = msg.type;

			switch (msg.type)
			{
			case MSG_BLEPAIR:
				display_bluetooth(msg.message);
				break;
			case MSG_CONNECT:
				display_connect();
				break;
			case MSG_REVENUE:
				display_rev_save(msg.message);
				break;
			case MSG_QRCODE:
				display_mode = MODE_PAY;
				display_qrcode();
				break;
			case MSG_LOGO:
				display_logo();
				break;
			case MSG_CONFIG:
				display_config();
				break;
			case MSG_OTAUPDATE:
				display_update();
				break;
			case MSG_RESET:
				display_reset();
				break;
			case MSG_RESTART:
				vTaskDelay(200 / portTICK_PERIOD_MS);
				esp_restart();
			case MSG_ERROR:
				display_mode = MODE_NONE;
				ESP_LOGI(TAG, "Restart: %d", msg.restart);
				display_error(msg.message, msg.restart);
				break;
			case MSG_GESTURE_LEFT:
			case MSG_GESTURE_UP:
			case MSG_GESTURE_DOWN:
			case MSG_GESTURE_RIGHT:
				display_gesture(msg.type & 0x0F);
				break;
			}
		}
		vTaskDelay(100 / portTICK_PERIOD_MS);
	}
}

#if SCREEN_CHANGE_ENABLE
static void screen_changer(void *arg)
{
	while (1)
	{
		if (display_mode == MODE_PAY)
		{
#if GESTURE_ENABLE
			if (first_move)
			{
				struct display_message msg;
				msg.type = MSG_QRCODE;
				xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);
				vTaskDelay(5000 / portTICK_PERIOD_MS);
				msg.type = MSG_LOGO;
				xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);
			}
#else
			struct display_message msg;
			msg.type = MSG_QRCODE;
			xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);
			vTaskDelay(5000 / portTICK_PERIOD_MS);
			msg.type = MSG_LOGO;
			xQueueGenericSend(display_evt_queue, &msg, (TickType_t)10, queueSEND_TO_BACK);

#endif
		}
		vTaskDelay(5000 / portTICK_PERIOD_MS);
	}
}
#endif

static void IRAM_ATTR lv_tick_task(void)
{
	//ets_printf("tick\n");
	lv_tick_inc(10);
}

static lv_color_t *buf1;
static lv_color_t *buf2;

static void lv_task(void *arg)
{
	xGuiSemaphore = xSemaphoreCreateMutex();
	xSemaphoreGive(xGuiSemaphore);

	lv_init();

	const esp_timer_create_args_t periodic_timer_args = {
        .callback = &lv_tick_task,
        .name = "periodic_gui"
    };
    esp_timer_handle_t periodic_timer;
    ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
    ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 10 * 1000));

	lvgl_driver_init();

	spiffs_driver_init();
	vTaskDelay(100);

	// Save buffers in heap, stack is to small
	buf1 = calloc(1, DISP_BUF_SIZE);
	buf2 = calloc(1, DISP_BUF_SIZE);
	//__NOINIT_ATTR static lv_color_t buf1[DISP_BUF_SIZE];
	//__NOINIT_ATTR 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);

	vTaskDelay(20 / portTICK_PERIOD_MS);

	xTaskCreatePinnedToCore(display_controller, "display_controller", 8192, NULL, 9, NULL, 1);

	while (1)
	{
		vTaskDelay(1);
		//Try to lock the semaphore, if success, call lvgl stuff
		if (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdTRUE)
		{
			lv_task_handler();
			xSemaphoreGive(xGuiSemaphore);
		}
	}
}

void display_init()
{
	esp_err_t ret;
#if GESTURE_ENABLE
	gesture_init();
	buffer_init();
#endif

	xTaskCreatePinnedToCore(lv_task, "lv_task", 4096, NULL, 0, NULL, 1);

	//lv_task_t * task = lv_task_create(display_controller, 500, LV_TASK_PRIO_MID, NULL);

//Standby task for screen change
#if SCREEN_CHANGE_ENABLE
	xTaskCreate(screen_changer, "screen_changer", 2048, NULL, 9, screen_changer_handle);
#endif
}

Here is the log output.

I (78) boot: Chip Revision: 1
I (32) boot: ESP-IDF v4.0.1-197-g94d97499a 2nd stage bootloader
I (32) boot: compile time 16:02:45
I (65) boot: Enabling RNG early entropy source...
I (65) boot: SPI Speed      : 40MHz
I (65) boot: SPI Mode       : DIO
I (67) boot: SPI Flash Size : 4MB
I (72) boot: Partition Table:
I (75) boot: ## Label            Usage          Type ST Offset   Length
I (82) boot:  0 nvs              WiFi data        01 02 0000b000 00006000
I (90) boot:  1 otadata          OTA data         01 00 00011000 00002000
I (97) boot:  2 phy_init         RF data          01 01 00013000 00001000
I (105) boot:  3 ota_0            OTA app          00 10 00020000 00190000
I (112) boot:  4 ota_1            OTA app          00 11 001b0000 00190000
I (120) boot:  5 spiffs           Unknown data     01 82 00340000 0007d000
I (127) boot:  6 nvs_key          NVS keys         01 04 003ff000 00001000
I (135) boot: End of partition table
I (139) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x55ba0 (351136) map
I (296) esp_image: segment 1: paddr=0x00075bc8 vaddr=0x3ffbdb60 size=0x03e28 ( 15912) load
I (304) esp_image: segment 2: paddr=0x000799f8 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/tobiaskuch/esp/esp-idf/components/freertos/xtensa_vectors.S:1778

I (304) esp_image: segment 3: paddr=0x00079e00 vaddr=0x40080400 size=0x06210 ( 25104) load
I (324) esp_image: segment 4: paddr=0x00080018 vaddr=0x400d0018 size=0x10bfb0 (1097648) map
0x400d0018: _stext at ??:?

I (786) esp_image: segment 5: paddr=0x0018bfd0 vaddr=0x40086610 size=0x15470 ( 87152) load
0x40086610: r_ea_finetimer_isr at ??:?

I (846) boot: Loaded app from partition at offset 0x20000
I (846) boot: Checking flash encryption...
I (846) flash_encrypt: flash encryption is enabled (0 plaintext flashes left)
I (853) boot: Disabling RNG early entropy source...
I (859) psram: This chip is ESP32-D0WD
I (863) spiram: Found 32MBit SPI RAM device
I (868) spiram: SPI RAM mode: flash 40m sram 40m
I (873) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (880) cpu_start: Pro cpu up.
I (884) cpu_start: Application information:
I (889) cpu_start: Project name:     shop_device
I (894) cpu_start: App version:      v0.4-7-g0608a62-dirty
I (900) cpu_start: Compile time:     Aug 10 2020 16:32:25
I (906) cpu_start: ELF file SHA256:  1f076e54f2b70704...
I (912) cpu_start: ESP-IDF:          v4.0.1-197-g94d97499a
I (919) cpu_start: Starting app cpu, entry point is 0x40081620
0x40081620: call_start_cpu1 at /home/tobiaskuch/esp/esp-idf/components/esp32/cpu_start.c:271

W (925) flash_encrypt: Flash encryption mode is DEVELOPMENT (not secure)
I (916) cpu_start: App cpu up.
I (1824) spiram: SPI SRAM memory test OK
I (1824) heap_init: Initializing. RAM available for dynamic allocation:
I (1824) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1830) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1837) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1843) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (1849) heap_init: At 3FFD1100 len 0000EF00 (59 KiB): DRAM
I (1855) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1862) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1868) heap_init: At 4009BA80 len 00004580 (17 KiB): IRAM
I (1874) cpu_start: Pro cpu start user code
I (1879) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1901) spi_flash: detected chip: gd
I (1901) spi_flash: flash io: dio
I (1902) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1909) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1994) ShopDevice: App version: v0.4-7-g0608a62-dirty
I (1994) ShopDevice: Version numeric 47
Trace: lv_init started  (lv_obj.c #124 lv_init())
I (2004) wifi:wifi driver task: 3ffdf8f8, prio:23, stack:6656, core=0
I (2004) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (2014) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
Info: lv_init ready     (lv_obj.c #162 lv_init())
I (2029) lvgl_helpers: Display hor size: 320, ver size: 240
I (2034) lvgl_helpers: Display buffer size: 20480
I (2039) lvgl_helpers: Initializing SPI master for display
I (2044) wifi:wifi firmware version: d74ef33
I (2049) wifi:config NVS flash: enabled
I (2054) wifi:config nano formating: disabled
I (2059) wifi:Init dynamic tx buffer num: 32
I (2059) wifi:Init data frame dynamic rx buffer num: 32
I (2064) wifi:Init management frame dynamic rx buffer num: 32
I (2069) wifi:Init management short buffer num: 32
I (2074) wifi:Init static tx buffer num: 16
I (2079) wifi:Init static rx buffer size: 1600
I (2084) wifi:Init static rx buffer num: 10
I (2089) wifi:Init dynamic rx buffer num: 32
I (2044) lvgl_helpers: Configuring SPI host HSPI_HOST (1)
I (2094) ShopDevice WiFi: start the WIFI SSID:[muenchen.freifunk.net/freising]
I (2099) lvgl_helpers: MISO pin: -1, MOSI pin: 23, SCLK pin: 19
I (2114) lvgl_helpers: Max transfer size: 40960 (bytes)
I (2119) lvgl_helpers: Initializing SPI bus...
I (2124) disp_spi: Adding SPI device
I (2129) disp_spi: Clock speed: 40000000Hz, mode: 0, CS pin: 22
I (2194) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0
I (2199) wifi:mode : sta (30:ae:a4:ef:4b:58)
I (2199) ShopDevice WiFi: Waiting for wifi
I (2199) ShopDevice WiFi: SYSTEM_EVENT_STA_START
I (2334) ILI9341: Initialization.
I (2539) ILI9341: Enabling backlight.
I (2544) ILI9341: Display orientation: LANDSCAPE
I (2544) ILI9341: 0x36 command value: 0x28
I (2934) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (2934) wifi:state: init -> auth (b0)
I (2944) wifi:state: auth -> assoc (0)
I (2949) wifi:state: assoc -> run (10)
I (2949) wifi:connected with muenchen.freifunk.net/freising, aid = 4, channel 6, BW20, bssid = 18:e8:29:e1:13:ea
I (2954) wifi:security: Open Auth, phy: bgn, rssi: -75
I (2959) wifi:pm start, type: 1

I (3024) wifi:AP's beacon interval = 102400 us, DTIM period = 3
I (3179) SPIFFS-DRIVER: Partition size: total: 463346, used: 73543
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
I (3734) Display: Controller task
I (3734) Display: MAC Address: 30:AE:A4:EF:4B:58
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: image create started     (lv_img.c #62 lv_img_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: image created     (lv_img.c #127 lv_img_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Info: image draw: cache miss, cached to an empty entry  (lv_img_cache.c #122 _lv_img_cache_open())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Trace: image draw: image found in the cache     (lv_img_cache.c #101 _lv_img_cache_open())
Trace: lv_img_design: start to draw image       (lv_img.c #660 lv_img_design())
Trace: image draw: image found in the cache     (lv_img_cache.c #101 _lv_img_cache_open())
Trace: lv_refr_task: ready      (lv_refr.c #305 _lv_disp_refr_task())
Trace: still running 2  (lv_task.c #398 lv_task_exec())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (5004) tcpip_adapter: sta ip: 10.80.216.58, mask: 255.255.248.0, gw: 10.80.216.3
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (6009) ShopDevice MQTT: User: 30aea4d80490, Password: ZsfT1ouazgxr0UNqObIw8oAuDIBI3PvpnHBUUMMqbjm6KKn0zz4oFdyT8mmQsBFL, Topic: shopdevice/30aea4d80490
I (6029) ShopDevice MQTT: Fill all topics with: shopdevice/30aea4d80490
I (6034) ShopDevice MQTT: Topics set: shopdevice/30aea4d80490 shopdevice/30aea4d80490/ota shopdevice/30aea4d80490/version
I (6049) ShopDevice MQTT: [APP] Free memory: 4220728 bytes
I (6054) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: lv_task_handler ready    (lv_task.c #190 lv_task_handler())
I (6804) Display: Event: 3
Trace: Screen create started    (lv_obj.c #204 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: label create started     (lv_label.c #79 lv_label_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: label created     (lv_label.c #167 lv_label_create())
Trace: image create started     (lv_img.c #62 lv_img_create())
Trace: Object create started    (lv_obj.c #236 lv_obj_create())
Info: Object create ready       (lv_obj.c #391 lv_obj_create())
Info: image created     (lv_img.c #127 lv_img_create())
Info: lv_img_set_src:  `LV_IMG_SRC_VARIABLE` type found         (lv_img.c #180 lv_img_set_src())
Trace: lv_task_handler started  (lv_task.c #74 lv_task_handler())
Trace: still running 1  (lv_task.c #396 lv_task_exec())
Trace: lv_refr_task: started    (lv_refr.c #177 _lv_disp_refr_task())
I (7304) ShopDevice MQTT: MQTT_EVENT_CONNECTED
I (7304) ShopDevice MQTT: Subscribe: shopdevice/30aea4d80490
I (7309) ShopDevice MQTT: subscribe successful, msg_id=27249
I (7309) ShopDevice MQTT: Subscribe: shopdevice/30aea4d80490/ota
I (7319) ShopDevice MQTT: subscribe successful, msg_id=21140
I (7334) Display: Event: 2
I (7344) ShopDevice MQTT: MQTT_EVENT_SUBSCRIBED, msg_id=27249
I (7364) ShopDevice MQTT: MQTT_EVENT_SUBSCRIBED, msg_id=21140
E (12324) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (12324) task_wdt:  - IDLE1 (CPU 1)
E (12324) task_wdt: Tasks currently running:
E (12324) task_wdt: CPU 0: IDLE0
E (12324) task_wdt: CPU 1: lv_task
E (17324) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (17324) task_wdt:  - IDLE1 (CPU 1)
E (17324) task_wdt: Tasks currently running:
E (17324) task_wdt: CPU 0: IDLE0
E (17324) task_wdt: CPU 1: lv_task

I will try to replicate it, I no longer own the Wrover Kit but have another ESP32 and ili9341 display available.

I forgot to say, that i have this issue since lvgl 7.0. In 6.1 it was working without problems.

Furthermore I’ve done some gdb debugging and put some trace outputs in the lvgl code. It looks like the lv_task_handler stops here https://github.com/lvgl/lvgl/blob/08684b31eed30f7dc896f5309acd82c7acd88dda/src/lv_misc/lv_task.c#L409

I don’t really understand why this is possibly, but maybe it helps you.

1 Like

Trace: lv_refr_task: started (lv_refr.c #177 _lv_disp_refr_task())

The log indicates that it has frozen during rendering or flushing.

Can you try this:

  • Enable all LV_USE_ASSERT_... in lv_conf.h
  • Add LV_ASSERT_MEM_INTEGRITY(); before and after if(task->task_cb) task->task_cb(task);
  • Add logs to the beginning and end (and other relevant places) of your disp_flush_cb
  • If you use 2 display buffers try using only one

I tried the proposed things, but they doesn’t helped:

Enable all LV_USE_ASSERT_... in lv_conf.h

No errors messages were showed

Add LV_ASSERT_MEM_INTEGRITY(); before and after if(task->task_cb) task->task_cb(task);

Doesn’t show any error messages.

Add logs to the beginning and end (and other relevant places) of your disp_flush_cb

The log messages in disp_flush at begin and ending are booth shown at the moment of freeze, so there can not be the problem

If you use 2 display buffers try using only one

Changes nothing.

Thanks for testing. Now we can exclude a lot of stuff.

Now please try to simplify your UI as much as possible and add back widgets to see when the issue happens. Does it stop with only an empty screen too?

I can’t point out a exact widget creating that’s breaking the task. It stops at various points. But not on an empty screen.
My first page with pictures and text is always working. The second page (picture and text) does work the most of the time too. But then i want to create a tabview and that breaks it most of the time. All widgets are created, but they are never showed.

So there is no difference in first and second screen (both images and text) but the second sometimes breaks.

Does the second screen breaks with images or text only?

I haven’t been able to take a look at this. Will make some room for it this weekend.

1 Like

That’s hard to say. I tested it with only text and it breaks sometimes, then i tested it with only images and got the same.

Ah, an important stuff: does the issue happen even if you don’t touch the screen and nothing is refreshing?

I think not. Only if i want to change something on the screen, the task stops.

I see. Another idea to check: try to pin the task to the other core of ESP32. Do you see the issue on both cores?