lv_port_esp32: IL3820 (GDEH029A1) crashes when setting to portrait modes
Describe the issue
Looks like the hardware rotation related code are not implemented for IL3820, and it may cause crashes when setting to portrait (or inverted portrait) modes.
I think I know why it crashes with garbage result rendered. Because this register is not set correctly:
I will try fixing it later tonight and submit a PR.
Code to reproduce the issue
-
Use the latest code at this commit: https://github.com/lvgl/lv_port_esp32/commit/9b987457161681a184d9421e960f20f56b22612b
-
Enable IL3820, set to 296x128 resolution, and portrait modes in menuconfig
Expected Results
It should just works
Actual Results
It crashes like this, with some garbage results rendered on the screen:
ELF file SHA256: 3f5709268e81b560
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:0x3fff0030,len:4
load:0x3fff0034,len:7068
load:0x40078000,len:13696
load:0x40080400,len:4000
0x40080400: _init at ??:?
entry 0x40080688
I (29) boot: ESP-IDF v4.2-dev-1660-g7d7521367 2nd stage bootloader
I (29) boot: compile time 12:21:49
I (29) boot: chip revision: 1
I (33) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (40) boot.esp32: SPI Speed : 40MHz
I (45) boot.esp32: SPI Mode : DIO
I (50) boot.esp32: SPI Flash Size : 2MB
I (54) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (63) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (78) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (85) boot: 2 factory factory app 00 00 00010000 00100000
I (93) boot: End of partition table
I (97) boot_comm: chip revision: 1, min. application chip revision: 0
I (104) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0bde0 ( 48608) map
I (132) esp_image: segment 1: paddr=0x0001be08 vaddr=0x3ffb0000 size=0x02358 ( 9048) load
I (136) esp_image: segment 2: paddr=0x0001e168 vaddr=0x40080000 size=0x00404 ( 1028) load
0x40080000: _WindowOverflow4 at /home/hu/esp/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1730
I (139) esp_image: segment 3: paddr=0x0001e574 vaddr=0x40080404 size=0x01aa4 ( 6820) load
I (150) esp_image: segment 4: paddr=0x00020020 vaddr=0x400d0020 size=0x27330 (160560) map
0x400d0020: _stext at ??:?
I (217) esp_image: segment 5: paddr=0x00047358 vaddr=0x40081ea8 size=0x09934 ( 39220) load
0x40081ea8: esp_restart_noos at /home/hu/esp/esp-idf/components/esp32/system_api_esp32.c:98
I (241) boot: Loaded app from partition at offset 0x10000
I (241) boot: Disabling RNG early entropy source...
I (242) cpu_start: Pro cpu up.
I (245) cpu_start: Application information:
I (250) cpu_start: Project name: lvgl-demo
I (255) cpu_start: App version: 9b98745-dirty
I (261) cpu_start: Compile time: Jun 8 2020 14:34:16
I (267) cpu_start: ELF file SHA256: 3f5709268e81b560...
I (273) cpu_start: ESP-IDF: v4.2-dev-1660-g7d7521367
I (279) cpu_start: Starting app cpu, entry point is 0x400816f0
0x400816f0: call_start_cpu1 at /home/hu/esp/esp-idf/components/esp32/cpu_start.c:286
I (271) cpu_start: App cpu up.
I (290) heap_init: Initializing. RAM available for dynamic allocation:
I (297) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (303) heap_init: At 3FFBC308 len 00023CF8 (143 KiB): DRAM
I (309) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (315) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (322) heap_init: At 4008B7DC len 00014824 (82 KiB): IRAM
I (328) cpu_start: Pro cpu start user code
I (346) spi_flash: detected chip: gd
I (347) spi_flash: flash io: dio
W (347) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (357) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (10) lvgl_helpers: Display hor size: 296, ver size: 128
I (10) lvgl_helpers: Display buffer size: 4736
I (10) lvgl_helpers: Initializing SPI master for display
I (20) lvgl_helpers: Configuring SPI host HSPI_HOST (1)
I (30) lvgl_helpers: MISO pin: -1, MOSI pin: 21, SCLK pin: 22
I (30) lvgl_helpers: Max transfer size: 9472 (bytes)
I (40) lvgl_helpers: Initializing SPI bus...
I (50) disp_spi: Adding SPI device
I (50) disp_spi: Clock speed: 40000000Hz, mode: 0, CS pin: 17
I (50) IL3820: init
I (110) IL3820: clear
I (1810) IL3820: clear
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400df29f PS : 0x00060930 A0 : 0x800d6a89 A1 : 0x3ffc1f50
0x400df29f: lv_disp_is_true_double_buf at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_hal/lv_hal_disp.c:400
A2 : 0x00000000 A3 : 0x3ffc1f70 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x3ffb43c4 A7 : 0x00000001 A8 : 0x800d6836 A9 : 0x3ffc1f30
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x400d600c A13 : 0x3ffb43c4
0x400d600c: lv_obj_design at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_core/lv_obj.c:3507
A14 : 0x00000127 A15 : 0x00000000 SAR : 0x00000020 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400013f9 LEND : 0x4000140d LCOUNT : 0xfffffffc
Backtrace:0x400df29c:0x3ffc1f50 0x400d6a86:0x3ffc1f70 0x400d6bdf:0x3ffc1fa0 0x400d6cb9:0x3ffc1fd0 0x400d6d1c:0x3ffc1ff0 0x400e069d:0x3ffc2020 0x400e0788:0x3ffc2040 0x400d33d2:0x3ffc2060 0x40085505:0x3ffc20c0
0x400df29c: lv_disp_is_true_double_buf at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_hal/lv_hal_disp.c:399
0x400d6a86: lv_refr_area_part at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_core/lv_refr.c:507
0x400d6bdf: lv_refr_area at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_core/lv_refr.c:455 (discriminator 2)
0x400d6cb9: lv_refr_areas at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_core/lv_refr.c:377
0x400d6d1c: _lv_disp_refr_task at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_core/lv_refr.c:199
0x400e069d: lv_task_exec at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_misc/lv_task.c:398 (discriminator 1)
0x400e0788: lv_task_handler at /home/hu/Projects/lv_port_esp32/build/../components/lvgl/lvgl/src/lv_misc/lv_task.c:142
0x400d33d2: guiTask at /home/hu/Projects/lv_port_esp32/build/../main/main.c:117
0x40085505: vPortTaskWrapper at /home/hu/esp/esp-idf/components/freertos/xtensa/port.c:143
ELF file SHA256: 3f5709268e81b560
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:0x3fff0030,len:4
load:0x3fff0034,len:7068
load:0x40078000,len:13696
load:0x40080400,len:4000
0x40080400: _init at ??:?
ESP32 Chip version
v1
ESP-IDF version
v4.2-dev-1660-g7d7521367
Development kit used
ESP-32S v1.1
Development machine OS
Ubuntu 20.04
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 40 (21 by maintainers)
Hi Jason,
I’m going to merge #179, this is the first part of fixing the IL3820 driver issues, I removed the portrait inverted and landscape inverted options when selecting this controller. Next week I will add the predefined display configuration for it.
If you want you can open an issue on LVGL main repository with the request you did above and see what is possible to do.
Hello @C47D
Yep, thanks for your efforts too!
Meanwhile, I think LVGL should provide its native support for rotation and better monochrome/greyscale support, preferably in the config, without any conversion callbacks in the display driver. This is for in case some weird panels that:
It would be very helpful for us to port more panels for LVGL, if these two features are implemented.
Regards, Jackson
Nice, I will create a new predefined display configuration so it’s easier to choose the right options. Also this last photos are in landscape mode, not portrait, will fix that as well.
Thanks for testing it so quickly.
Here’s my panel with your original code. It looks perfect!
Jackson
I tried several data entry configurations but couldn’t make it work, so I’m “mirroring” the X pixels in software, it’s ugly but it seems to work, at least it displays
Hello World
properly.Right now it only works on portrait and landscape orientations, none of the inverted options work. You need to set the display width to 128 and height to 296. It’s not production ready code, if you have some free time test it and let me know if it fails or improvements you have in mind.
I pushed the changes to the
fix/il3820_portrait
branch.I will create a new predefined display configuration for this e-paper display once it’s working properly. Will let you know then.
@C47D Congrats!
By the way, maybe it’s a bit off-topic. But I think we can later port a QuickJS JavaScript binding. I’ve just ported a quick & dirty version of QuickJS for ESP32 last night: https://github.com/huming2207/quickjs-esp32
Almost there…
The text is mirrored, I guess we only need to find the right data entry mode.
Hello @C47D and @aircable
Firstly, according to the code at the latest master commit, it does NOT have any rotation support for IL3820. It definitely won’t work.
So far I’ve tried adding the support to get it working, but no luck with these attempts:
EPD_PANEL_WIDTH
andEPD_PANEL_HEIGHT
: won’t work - crasharea->x1
,area->x2
toarea->y1
,area->y2
and some other width/height related macros, it won’t crash any more but the screen will display some random garbage result.Anyway I can’t fix it for now as I have something else need to be done soon. But I’m happy to help if necessary.
By the way, the code should be cleaned up with some sorts of formatter/linter. Some spelling or abbreviations are wrong or weird. The overall code format makes me feels a bit hard to read.
Regards, Jackson