T-Display-S3: Can't flash large example projects
-
I cloned https://github.com/Xinyuan-LilyGO/T-Display-S3 and uploaded example projects from the example subdirectory.
Small example projects as example/tft using only TFT_eSPI works as expected.
Large example projects as example/factory using lvgl fails during the flash process.I use vscode and platformio and haven't changed anything in the code.
Sometimes example/factory fails just at the beginning
Processing ESP32-S3-DevKitC-1 (platform: espressif32; board: esp32-s3-devkitc-1; framework: arduino) [...] PACKAGES: - framework-arduinoespressif32 @ 2.0.5+sha.2d6ca35 - tool-esptoolpy @ 1.40400.0 (4.4.0) - tool-mkfatfs @ 2.0.1 - tool-mklittlefs @ 1.203.210628 (2.3) - tool-mkspiffs @ 2.230.0 (2.30) - toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch3 LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 39 compatible libraries Scanning dependencies... Dependency Graph |-- lvgl @ 8.3.0-dev |-- OneButton @ 2.0.3 |-- TouchLib @ 0.0.1 | |-- Wire @ 2.0.0 |-- WiFi @ 2.0.0 |-- Wire @ 2.0.0 Building in release mode Retrieving maximum program size .pio\build\ESP32-S3-DevKitC-1\firmware.elf Checking size .pio\build\ESP32-S3-DevKitC-1\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [= ] 12.5% (used 41092 bytes from 327680 bytes) Flash: [==== ] 41.4% (used 1384341 bytes from 3342336 bytes) Configuring upload protocol... AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: COM3 Uploading .pio\build\ESP32-S3-DevKitC-1\firmware.bin esptool.py v4.4 Serial port COM3 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: f4:12:fa:cf:0a:e4 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00162fff... Flash params set to 0x023f Compressed 15008 bytes to 10328... Writing at 0x00000000... (100 %) Wrote 15008 bytes (10328 compressed) at 0x00000000 in 0.2 seconds (effective 487.4 kbit/s)... Hash of data verified. Compressed 3072 bytes to 129... Writing at 0x00008000... (100 %) Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 402.1 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) A fatal error occurred: Packet content transfer stopped (received 1 bytes) *** [upload] Error 2
Sometimes example/factory flashes part of it but fails after a while (with 1'384'784 bytes):
RAM: [= ] 12.5% (used 41092 bytes from 327680 bytes) Flash: [==== ] 41.4% (used 1384341 bytes from 3342336 bytes) Configuring upload protocol... AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: COM3 Uploading .pio\build\ESP32-S3-DevKitC-1\firmware.bin esptool.py v4.4 Serial port COM3 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: f4:12:fa:cf:0a:e4 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00162fff... Flash params set to 0x023f Compressed 15008 bytes to 10328... Writing at 0x00000000... (100 %) Wrote 15008 bytes (10328 compressed) at 0x00000000 in 0.2 seconds (effective 492.4 kbit/s)... Hash of data verified. Compressed 3072 bytes to 129... Writing at 0x00008000... (100 %) Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 423.7 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 602.4 kbit/s)... Hash of data verified. Compressed 1384784 bytes to 1057728... Writing at 0x00010000... (1 %) Writing at 0x0001a846... (3 %) Writing at 0x0001f5cc... (4 %) Writing at 0x000235d9... (6 %) Writing at 0x000275e3... (7 %) Writing at 0x0002b5ef... (9 %) Writing at 0x0002f605... (10 %) Writing at 0x00033629... (12 %) Writing at 0x00037645... (13 %) Writing at 0x0003b66f... (15 %) Writing at 0x0003f68c... (16 %) Writing at 0x00043693... (18 %) Writing at 0x000476a1... (20 %) Writing at 0x0004b6b8... (21 %) Writing at 0x0004f6c4... (23 %) Writing at 0x000536e8... (24 %) Writing at 0x00057706... (26 %) Writing at 0x0005b70c... (27 %) Writing at 0x0005f721... (29 %) Writing at 0x00063730... (30 %) Writing at 0x0006773b... (32 %) Writing at 0x0006b76a... (33 %) Writing at 0x0006f76c... (35 %) Traceback (most recent call last): File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool.py", line 34, in <module> esptool._main() File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\__init__.py", line 1026, in _main main() File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\__init__.py", line 826, in main operation_func(esp, args) File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\cmds.py", line 556, in write_flash esp.flash_defl_block(block, seq, timeout=timeout) File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\loader.py", line 109, in inner return func(*args, **kwargs) File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\loader.py", line 991, in flash_defl_block self.check_command( File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\loader.py", line 407, in check_command val, data = self.command(op, data, chk, timeout=timeout) File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\loader.py", line 376, in command p = self.read() File "C:\Users\bacr\.platformio\packages\tool-esptoolpy\esptool\loader.py", line 308, in read return next(self._slip_reader) StopIteration *** [upload] Error 1
Small projects like example/tft with 401'552 bytes are correctly flashed:
[...] RAM: [ ] 4.6% (used 15204 bytes from 327680 bytes) Flash: [= ] 12.0% (used 401169 bytes from 3342336 bytes) Configuring upload protocol... AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa CURRENT: upload_protocol = esptool Looking for upload port... Auto-detected: COM3 Uploading .pio\build\ESP32-S3-DevKitC-1\firmware.bin esptool.py v4.4 Serial port COM3 Connecting... Chip is ESP32-S3 (revision v0.1) Features: WiFi, BLE Crystal is 40MHz MAC: f4:12:fa:cf:0a:e4 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00072fff... Flash params set to 0x023f Compressed 15008 bytes to 10328... Writing at 0x00000000... (100 %) Wrote 15008 bytes (10328 compressed) at 0x00000000 in 0.2 seconds (effective 483.8 kbit/s)... Hash of data verified. Compressed 3072 bytes to 129... Writing at 0x00008000... (100 %) Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 393.6 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 575.3 kbit/s)... Hash of data verified. Compressed 401552 bytes to 200483... Writing at 0x00010000... (7 %) Writing at 0x00019ec8... (15 %) Writing at 0x0002339a... (23 %) Writing at 0x00031210... (30 %) Writing at 0x0003edb4... (38 %) Writing at 0x00044869... (46 %) Writing at 0x0004a211... (53 %) Writing at 0x0004f7b6... (61 %) Writing at 0x00054cc1... (69 %) Writing at 0x0005d050... (76 %) Writing at 0x00065790... (84 %) Writing at 0x0006acf1... (92 %) Writing at 0x000707ee... (100 %) Wrote 401552 bytes (200483 compressed) at 0x00010000 in 2.9 seconds (effective 1105.2 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
I use different computers (always Windows 10) and different USB cables (USB A-USB C, USB C-USB C), but it always fails.
Do you know why large example projects fail?
The flash chip is a winbond W25Q128JV with 128Mbits resp. 16MBytes... a lot of space available! -
@tebachi
Hmmm... I use Arduino Ver 1.8.19 and it is stable, I can load all the projects.
I had a lot of trouble with the T-Display S3 initially with no support from LilyGO, so I made my own "New User" help desk Repository:
https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples
Let me know if it helps!
-TerryP.S.
The S3 chips sometime (!) need the Boot Button GPIO0 to be pressed, while holding press the tiny black Reset button on the back and release only the Reset, then release the Boot.
(You may still have to unplug from USB and re-plug before it loads.)
very persnickety -
@teastain It's funny, but with Arduino IDE (I use Arduino IDE 2.0.3), it works.
I checked the differences.
Arduino IDE uses the following packagesDownloading packages esp32:riscv32-esp-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32s2-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32s3-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:esptool_py@4.2.1 esp32:openocd-esp32@v0.11.0-esp32-20220706 esp32:mkspiffs@0.2.3 esp32:mklittlefs@3.0.0-gnu12-dc7f933 esp32:esp32@2.0.6 Installing esp32:riscv32-esp-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:riscv32-esp-elf-gcc@gcc8_4_0-esp-2021r2-patch5 installed Installing esp32:xtensa-esp32-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32-elf-gcc@gcc8_4_0-esp-2021r2-patch5 installed Installing esp32:xtensa-esp32s2-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32s2-elf-gcc@gcc8_4_0-esp-2021r2-patch5 installed Installing esp32:xtensa-esp32s3-elf-gcc@gcc8_4_0-esp-2021r2-patch5 esp32:xtensa-esp32s3-elf-gcc@gcc8_4_0-esp-2021r2-patch5 installed Installing esp32:esptool_py@4.2.1 esp32:esptool_py@4.2.1 installed Installing esp32:openocd-esp32@v0.11.0-esp32-20220706 esp32:openocd-esp32@v0.11.0-esp32-20220706 installed Installing esp32:mkspiffs@0.2.3 esp32:mkspiffs@0.2.3 installed Installing esp32:mklittlefs@3.0.0-gnu12-dc7f933 esp32:mklittlefs@3.0.0-gnu12-dc7f933 installed Installing platform esp32:esp32@2.0.6 Configuring platform. Platform esp32:esp32@2.0.6 installed
The version of esptool used in Arduino IDE is 4.2.1, not 4.4 used in platformio
Maybe other packages differ, but esptool is a candidate.
In platformio it uses esp32@2.0.5, in Arduino IDE is already uses esp32@2.0.6The baud rate to flash the sketch is also different. It uses 921600 rather than 460800 as in platformio.
Sketch uses 1396825 bytes (44%) of program storage space. Maximum is 3145728 bytes. Global variables use 46804 bytes (14%) of dynamic memory, leaving 280876 bytes for local variables. Maximum is 327680 bytes. "C:\Users\bacr\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.2.1/esptool.exe" --chip esp32s3 --port "COM3" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 "C:\Users\bacr\AppData\Local\Temp\arduino-sketch-182FE61000D7B596E9DA0DE6E0716CBE/factory.ino.bootloader.bin" 0x8000 "C:\Users\bacr\AppData\Local\Temp\arduino-sketch-182FE61000D7B596E9DA0DE6E0716CBE/factory.ino.partitions.bin" 0xe000 "C:\Users\bacr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.6/tools/partitions/boot_app0.bin" 0x10000 "C:\Users\bacr\AppData\Local\Temp\arduino-sketch-182FE61000D7B596E9DA0DE6E0716CBE/factory.ino.bin" esptool.py v4.2.1 Serial port COM3 Connecting... Chip is ESP32-S3 Features: WiFi, BLE Crystal is 40MHz MAC: f4:12:fa:cf:0a:e4 Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00000000 to 0x00003fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00165fff... Compressed 14768 bytes to 10148... Writing at 0x00000000... (100 %) Wrote 14768 bytes (10148 compressed) at 0x00000000 in 0.3 seconds (effective 355.6 kbit/s)... Hash of data verified. Compressed 3072 bytes to 137... Writing at 0x00008000... (100 %) Wrote 3072 bytes (137 compressed) at 0x00008000 in 0.1 seconds (effective 348.6 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 480.1 kbit/s)... Hash of data verified. Compressed 1397264 bytes to 1067094... Writing at 0x00010000... (1 %) Writing at 0x0001a823... (3 %) Writing at 0x0001f5e7... (4 %) Writing at 0x000235f3... (6 %) Writing at 0x000275fe... (7 %) Writing at 0x0002b609... (9 %) Writing at 0x0002f61f... (10 %) Writing at 0x00033642... (12 %) Writing at 0x0003765f... (13 %) Writing at 0x0003b687... (15 %) Writing at 0x0003f6a6... (16 %) Writing at 0x000436aa... (18 %) Writing at 0x000476b7... (19 %) Writing at 0x0004b6cb... (21 %) Writing at 0x0004f6d6... (22 %) Writing at 0x000536fd... (24 %) Writing at 0x0005771c... (25 %) Writing at 0x0005b721... (27 %) Writing at 0x0005f726... (28 %) Writing at 0x00063745... (30 %) Writing at 0x00067751... (31 %) Writing at 0x0006b781... (33 %) Writing at 0x0006f782... (34 %) Writing at 0x0007378d... (36 %) Writing at 0x000777a0... (37 %) Writing at 0x0007b7bc... (39 %) Writing at 0x0007f7d5... (40 %) Writing at 0x00083758... (42 %) Writing at 0x0008bf46... (43 %) Writing at 0x000970ef... (45 %) Writing at 0x000a25d4... (46 %) Writing at 0x000a7b79... (48 %) Writing at 0x000accf7... (50 %) Writing at 0x000b1c18... (51 %) Writing at 0x000b726c... (53 %) Writing at 0x000bc4bc... (54 %) Writing at 0x000c16d0... (56 %) Writing at 0x000c68aa... (57 %) Writing at 0x000cbde7... (59 %) Writing at 0x000d1a0c... (60 %) Writing at 0x000d7237... (62 %) Writing at 0x000dc4c0... (63 %) Writing at 0x000e1b54... (65 %) Writing at 0x000e686b... (66 %) Writing at 0x000eb809... (68 %) Writing at 0x000f066a... (69 %) Writing at 0x000f55d8... (71 %) Writing at 0x000fa9e6... (72 %) Writing at 0x000ffaa2... (74 %) Writing at 0x001055a9... (75 %) Writing at 0x0010a741... (77 %) Writing at 0x0010f6a7... (78 %) Writing at 0x00114733... (80 %) Writing at 0x001199e7... (81 %) Writing at 0x0011ee6f... (83 %) Writing at 0x00124341... (84 %) Writing at 0x00129d90... (86 %) Writing at 0x0012f426... (87 %) Writing at 0x00134a79... (89 %) Writing at 0x0013b31a... (90 %) Writing at 0x001436f6... (92 %) Writing at 0x0014b159... (93 %) Writing at 0x001538e1... (95 %) Writing at 0x00158d85... (96 %) Writing at 0x0015e631... (98 %) Writing at 0x00164539... (100 %) Wrote 1397264 bytes (1067094 compressed) at 0x00010000 in 18.1 seconds (effective 616.1 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
At the moment, platformio is not functional and I have to use Arduino IDE.
I will create an issue in github.com/Xinyuan-LilyGO/T-Display-S3/ so LilyGO knows about this. -
@tebachi
As a hobbyist/maker I find Arduino a piece-of-cake and meets all of my needs.
PlatformIO and ESP-IDF looks like a huge pain in the ass!
Cheers, tho'! -
@teastain
When you only use a single simple sketch, Arduino IDE is ok.
When you use many files, many classes, many self-maintained libraries, platformio is a better choice.