sukesh-ak / ESP32-TUX

ESP32-TUX - ESP32 / ESP32-XX Touch UX Template using LVGL to get you started
https://tux.sukesh.me
MIT License
225 stars 55 forks source link

Error of Makerfabs 16Bit Parallel 3.5" ILI9488 - ESP32-S3 #6

Closed hayschan closed 1 year ago

hayschan commented 1 year ago

Problem

  1. Lots of error showed in serial monitor.
  2. After printing out the errors, the device will reset itself.
  3. The display does not turn on.

Situation

I am using the ESP32-S3 Parallel TFT with Touch 3.5'' ILI9488.

First, I modified the device selection in main.hpp to include only my device, and I did not modify anything else.

/********************DEVICE SELECTION ******************/
/* Enable one of the devices from below (shift to bsp selection later) */
// #include "conf_WT32SCO1.h"              // WT32-SC01 (ESP32)

// WT32-SC01 Plus (ESP32-S3 + 8Bit Parellel) with SD Card, Audio support
// #include "conf_WT32SCO1-Plus.h"         

// Makerfabs ESP32S335D (ESP32-S3 + 16Bit Parellel) with SD Card, Audio support
#include "conf_Makerfabs_S3_PTFT.h"     

// Makerfabs ESP32S335D (ESP32-S3 + SPI) with SD Card, Audio support
// #include "conf_Makerfabs_S3_STFT.h"
/********************************************************/

Then, I followed Flash section of README.md

Flash log

Serial port /dev/cu.usbserial-026DC87A
Connecting....
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
...
Compressed 20832 bytes to 13280...
Writing at 0x00000000... (100 %)
Wrote 20832 bytes (13280 compressed) at 0x00000000 in 0.6 seconds (effective 261.8 kbit/s)...
Hash of data verified.
Compressed 2002688 bytes to 1127053...
Writing at 0x00010000... (1 %)
... 
...
...
Writing at 0x0064e59a... (100 %)
Wrote 524288 bytes (169669 compressed) at 0x00610000 in 5.7 seconds (effective 739.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done

After flashing, I could see LOGs from the board through serial monitor, which indicates the flash is successful.

However, there are the following three problems:

  1. Lots of error showed in serial monitor.
  2. After printing out the errors, the device will reset itself.
  3. The display does not turn on.

Error log

--- idf_monitor on /dev/cu.usbserial-026DC87A 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
5fch (673276)ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0xb (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x1684
load:0x403c9700,len:0xbe8
load:0x403cc700,len:0x2e98
entry 0x403c9904
I (25) boot: ESP-IDF v5.0-dirty 2nd stage bootloader
I (25) boot: compile time 12:10:24
I (25) boot: chip revision: v0.1
I (27) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (34) boot.esp32s3: Boot SPI Speed : 80MHz
I (39) boot.esp32s3: SPI Mode       : DIO
I (43) boot.esp32s3: SPI Flash Size : 8MB
I (48) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (57) boot: ## Label            Usage          Type ST Offset   Length
I (64) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (72) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (79) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (87) boot:  3 factory          factory app      00 00 00010000 00200000
I (94) boot:  4 ota_0            OTA app          00 10 00210000 00200000
I (102) boot:  5 ota_1            OTA app          00 11 00410000 00200000
I (109) boot:  6 storage          Unknown data     01 82 00610000 00080000
I (117) boot: End of partition table
I (121) boot: Defaulting to factory image
I (126) boot_comm: chip revision: 1, min. application chip revision: 0
I (133) esp_image: segment 0: paddr=00010020 vaddr=3c130020 size=a45fch (673276) map
I (262) esp_image: segment 1: paddr=000b4624 vaddr=3fc99100 size=04c5ch ( 19548) load
I (267) esp_image: segment 2: paddr=000b9288 vaddr=40374000 size=06d90h ( 28048) load
I (274) esp_image: segment 3: paddr=000c0020 vaddr=42000020 size=12ac0ch (1223692) map
I (496) esp_image: segment 4: paddr=001eac34 vaddr=4037ad90 size=0e290h ( 58000) load
I (509) esp_image: segment 5: paddr=001f8ecc vaddr=50000000 size=00010h (    16) load
I (518) boot: Loaded app from partition at offset 0x10000
I (519) boot: Disabling RNG early entropy source...
I (530) esp_psram: Found 2MB PSRAM device
I (531) esp_psram: Speed: 40MHz
I (531) cpu_start: Pro cpu up.
I (531) cpu_start: Starting app cpu, entry point is 0x403755e0
0x403755e0: call_start_cpu1 at /Users/hays/esp/esp-idf/components/esp_system/port/cpu_start.c:142

I (0) cpu_start: App cpu up.
I (957) esp_psram: SPI SRAM memory test OK
I (966) cpu_start: Pro cpu start user code
I (966) cpu_start: cpu freq: 160000000 Hz
I (966) cpu_start: Application information:
I (969) cpu_start: Project name:     ESP32-TUX
I (974) cpu_start: App version:      0.16.0
I (979) cpu_start: Compile time:     Dec  5 2022 12:10:09
I (985) cpu_start: ELF file SHA256:  959501bcf6829e98...
I (991) cpu_start: ESP-IDF:          v5.0-dirty
I (996) heap_init: Initializing. RAM available for dynamic allocation:
I (1004) heap_init: At 3FCB0070 len 000396A0 (229 KiB): D/IRAM
I (1010) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (1017) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (1023) heap_init: At 600FE010 len 00001FF0 (7 KiB): RTCRAM
I (1030) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
I (1038) spi_flash: detected chip: gd
I (1042) spi_flash: flash io: dio
W (1045) spi_flash: Detected size(16384k) larger than the size in the binary image header(8192k). Using the size in the binary image header.
I (1061) sleep: Configure to isolate all GPIO pins in sleep state
I (1066) sleep: Enable automatic switching of GPIO sleep configuration
I (1073) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1083) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
E (1093) ESP32-TUX: 
Firmware Ver : 0.16.0
Project Name : ESP32-TUX
IDF Version  : v5.0-dirty

Controller   : esp32s3 Rev.1
CPU Cores    : Dual Core
CPU Speed    : 160Mhz
Flash Size   : 8MB [external]
PSRAM Size   : 2MB [external]
Connectivity : 2.4GHz WIFI/BLE

I (1133) ESP32-TUX: Initializing SPIFFS
I (1183) ESP32-TUX: Partition size: total: 474641, used: 282375
I (1183) ESP32-TUX: Initializing SD card
I (1183) ESP32-TUX: Initializing SPI BUS
I (1183) ESP32-TUX: Mounting filesystem
I (1193) gpio: GPIO[1]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1203) sdspi_transaction: cmd=52, R1 response: command not supported
I (1243) sdspi_transaction: cmd=5, R1 response: command not supported
I (1263) ESP32-TUX: Filesystem mounted
Name: SD16G
Type: SDHC/SDXC
Speed: 20 MHz
Size: 15112MB
CSD: ver=2, sector_size=512, capacity=30949376 read_bl_len=9
SSR: bus_width=1

assert failed: lcd_ll_select_clk_src /IDF/components/hal/esp32s3/include/hal/lcd_ll.h:67 (false)

Backtrace: 0x403761aa:0x3fcf3c80 0x4037ea39:0x3fcf3ca0 0x40385ea9:0x3fcf3cc0 0x42028a02:0x3fcf3de0 0x42028e85:0x3fcf3e20 0x42027f2c:0x3fcf3e50 0x421214a7:0x3fcf3ef0 0x42025a3b:0x3fcf3f10 0x4202424e:0x3fcf3f30 0x4200ef7f:0x3fcf3f50 0x4212a90b:0x3fcf3fb0 0x40381c71:0x3fcf3fe0
0x403761aa: panic_abort at /Users/hays/esp/esp-idf/components/esp_system/panic.c:412

0x4037ea39: esp_system_abort at /Users/hays/esp/esp-idf/components/esp_system/esp_system.c:135

0x40385ea9: __assert_func at /Users/hays/esp/esp-idf/components/newlib/assert.c:78

0x42028a02: lcd_ll_select_clk_src at /Users/hays/esp/esp-idf/components/hal/esp32s3/include/hal/lcd_ll.h:67
 (inlined by) lcd_i80_select_periph_clock at /Users/hays/esp/esp-idf/components/esp_lcd/src/esp_lcd_panel_io_i80.c:475

0x42028e85: esp_lcd_new_i80_bus at /Users/hays/esp/esp-idf/components/esp_lcd/src/esp_lcd_panel_io_i80.c:152 (discriminator 2)

0x42027f2c: lgfx::v1::Bus_Parallel16::init() at /Users/hays/Github/ESP32-TUX/components/LovyanGFX/src/lgfx/v1/platforms/esp32s3/Bus_Parallel16.cpp:96

0x421214a7: lgfx::v1::Panel_Device::init(bool) at /Users/hays/Github/ESP32-TUX/components/LovyanGFX/src/lgfx/v1/panel/Panel_Device.cpp:60

0x42025a3b: lgfx::v1::Panel_LCD::init(bool) at /Users/hays/Github/ESP32-TUX/components/LovyanGFX/src/lgfx/v1/panel/Panel_LCD.cpp:31

0x4202424e: lgfx::v1::LGFX_Device::init_impl(bool, bool) at /Users/hays/Github/ESP32-TUX/components/LovyanGFX/src/lgfx/v1/LGFXBase.cpp:3099

0x4200ef7f: lgfx::v1::LGFX_Device::init() at /Users/hays/Github/ESP32-TUX/components/LovyanGFX/src/lgfx/v1/LGFXBase.hpp:1138
 (inlined by) app_main at /Users/hays/Github/ESP32-TUX/main/main.cpp:267

0x4212a90b: main_task at /Users/hays/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/port_common.c:131 (discriminator 2)

0x40381c71: vPortTaskWrapper at /Users/hays/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:151

ELF file SHA256: 959501bcf6829e98

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375ad1
0x40375ad1: esp_restart_noos_dig at /Users/hays/esp/esp-idf/components/esp_system/esp_system.c:46 (discriminator 1)

At the last 5 lines, the device starts to reboot and the Error-Reboot loop continues on and on.

sukesh-ak commented 1 year ago

@hayschan I just upgraded the project to IDF 5.0 which also needs develop branch of LovyanGFX. LovyanGFX for Parallel TFT is broken for now and you can follow the issue here

SPI devices are working fine for now.

sukesh-ak commented 1 year ago

If you are on IDF 4.4.3 you can use this version (just before IDF 5.0 upgrade)

If you are planning to do this, copy sdkconfig.defaults.* files from this branch which has the default values set. Or, you can make changes to the settings using idf.py menuconfig

sukesh-ak commented 1 year ago

@hayschan As mentioned in that issue workaround, for now the fix is to add the following just before esp_lcd_new_i80_bus(&bus_config, &_i80_bus);

// add this line
bus_config.clk_src = LCD_CLK_SRC_DEFAULT;

File name for 16bit LovyanGFX\src\lgfx\v1\platforms\esp32s3\Bus_Parallel16.cpp

File name for 8bit LovyanGFX\src\lgfx\v1\platforms\esp32s3\Bus_Parallel8.cpp

hayschan commented 1 year ago

Thanks for the help.

I tried to build again today. Before building, I make sure I download the latest code by:

  1. deleting the original directory
  2. git clone --recursive https://github.com/sukesh-ak/ESP32-TUX.git

I also changed to use ESP-IDF v4.4.3. But this time, the build fails. The error log is attached. It is problem related to esp_partition.

Error log

Building in: /Users/hays/eclipse-workspace/ESP32-TUX/build
Configuring in: /Users/hays/eclipse-workspace/ESP32-TUX/build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=/Users/hays/esp/esp-idf/tools/cmake/toolchain-esp32s3.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCCACHE_ENABLE=1 -DIDF_TARGET=esp32s3 /Users/hays/eclipse-workspace/ESP32-TUX
-- Found Git: /usr/bin/git (found version "2.32.1 (Apple Git-133)") 
-- Component directory /Users/hays/eclipse-workspace/ESP32-TUX/components/ConfigBase does not contain a CMakeLists.txt file. No component will be added
CMake Warning at /Users/hays/esp/esp-idf/tools/cmake/project.cmake:291 (message):
  enabled ccache in build but ccache program not found
Call Stack (most recent call first):
  CMakeLists.txt:24 (project)

-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/hays/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/hays/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/hays/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s3
-- Checking Python dependencies...
Python requirements from /Users/hays/esp/esp-idf/requirements.txt are satisfied.
Processing 2 dependencies:
[1/2] espressif/fmt (9.1.0)
[2/2] idf (4.4.3)
-- LovyanGFX use components = nvs_flash;efuse;esp_lcd
CMake Error at /Users/hays/esp/esp-idf/tools/cmake/build.cmake:201 (message):
  Failed to resolve component 'esp_partition'.
Call Stack (most recent call first):
  /Users/hays/esp/esp-idf/tools/cmake/build.cmake:227 (__build_resolve_and_add_req)
  /Users/hays/esp/esp-idf/tools/cmake/build.cmake:507 (__build_expand_requirements)
  /Users/hays/esp/esp-idf/tools/cmake/project.cmake:384 (idf_build_process)
  CMakeLists.txt:24 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/hays/eclipse-workspace/ESP32-TUX/build/CMakeFiles/CMakeOutput.log".

cmake --build . -- -v
ninja: error: loading 'build.ninja': No such file or directory
Build complete (0 errors, 0 warnings): /Users/hays/eclipse-workspace/ESP32-TUX/build
Total time taken to build the project: 6,545 ms

This is weird. As far as I know, the esp_partition problem should only relate to projects that need migration to v5.0, as listed by Espressif in their document.

hayschan commented 1 year ago

If you are on IDF 4.4.3 you can use this version (just before IDF 5.0 upgrade)

If you are planning to do this, copy sdkconfig.defaults.* files from this branch which has the default values set. Or, you can make changes to the settings using idf.py menuconfig

Sorry, I just found out this comment. I will try this method. Thx

sukesh-ak commented 1 year ago

If you are on IDF 4.4.3 you can use this version (just before IDF 5.0 upgrade) If you are planning to do this, copy sdkconfig.defaults.* files from this branch which has the default values set. Or, you can make changes to the settings using idf.py menuconfig

Sorry, I just found out this comment. I will try this method. Thx

Parallel related bug is fixed today by LovyanGFX. Will update the repo later today with the the fix.

hayschan commented 1 year ago

Is it this one ? https://github.com/lovyan03/LovyanGFX/commit/e8baed4f71d6975a9aea552ef9581fc780d42420

sukesh-ak commented 1 year ago

Is it this one ? lovyan03/LovyanGFX@e8baed4

Yes.

sukesh-ak commented 1 year ago

@hayschan Project is updated with LovyanGFX fix. Also check the readme for updated instructions including the link for Wi-Fi provisioning app.

Closing this issue since the bug is fixed and readme is updated with required instructions.