Xinyuan-LilyGO / LilyGo-T-RGB

MIT License
78 stars 24 forks source link

How to create PlatformIO Partition file to use all 16MB PSRAM #27

Closed PlastiBots closed 1 year ago

PlastiBots commented 1 year ago

I have a project storing a number of large images directly in PSRAM (not using SPIFFS etc). I am currently using the _max_app8MB.csv partition setting in my platformio.ini as the _default16MB.csv does not work. I have seen the options linked below but am hoping someone can advise on the right partition table configuration that allocates all 16MB PSRAM for internal memory storage (not SPIFFS or LittleFS etc).

https://github.com/euphi/TRGB-BikeComputer/blob/main/partitions.csv and https://github.com/euphi/TRGB-BikeComputer/blob/main/platformio.ini for example.

Here's my current working config (with 8MB): ` [env:esp32-s3-trgb] platform = espressif32 board = esp32-s3-devkitc-1 framework = arduino lib_deps = moononournation/GFX Library for Arduino@^1.3.4 fbiego/ESP32Time@^2.0.0 northernwidget/DS3231@^1.1.2 upload_speed = 921600 ;build_flags = -DBOARD_HAS_PSRAM build_flags = ;-DARDUINO_USB_MODE=1 ;with this removed, device auto reboots after flashing (good) 0=hardware USB-CDC or 1=TinyUSB -DARDUINO_USB_CDC_ON_BOOT=1 ;allows serial monitor to work must also have monitor_speed set -DBOARD_HAS_PSRAM

board_build.arduino.memory_type = qio_opi board_build.f_flash = 80000000L board_build.flash_mode = qio board_build.partitions = max_app_8MB.csv `

lewisxhe commented 1 year ago

Firstly, T-RGB only has PSRAM of 8MB bytes, while Flash only has 16MB bytes If you want to change the partition table, please check the details and instructions here Partition Tables

PlastiBots commented 1 year ago

Thanks for the clarification and link. However, I'm new at this bit and don't understand what needs to be done. Does anyone have a sample file they can share that uses the full 16MB flash?

lewisxhe commented 1 year ago

As esp said, if you want to maximize the use of flash, then directly select the partition table of <Single factory app, no OTA>, and add board_build.partitions = app16M.csv in

Then create the file in the same directory as , and fill in the following example

# Name,   Type, SubType, Offset,  Size,   Flags
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 15M,
PlastiBots commented 1 year ago

Thanks for this. However, it doens't work. Using this scheme builds and uploads correctly but the T-RGB doesn't start but instead goes into a boot loop. Note, this is the same behavior when I try using _default16MB.csv

Checking size .pio\build\esp32-s3-trgb\firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [== ] 19.2% (used 62908 bytes from 327680 bytes) Flash: [===== ] 49.7% (used 7814765 bytes from 15728640 bytes)

mode:DIO, clock div:1 load:0x3fce3808,len:0x44c load:0x403c9700,len:0xbe4 load:0x403cc700,len:0x2a38 entry 0x403c98d4 ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x3 (RTC_SW_SYS_RST),boot:0x2b (SPI_FAST_FLASH_BOOT) Saved PC:0x403cd9f6 SPIWP:0xee

lewisxhe commented 1 year ago

Oh... I now know what your problem is. Please modify the board to

board = esp32s3box

PlastiBots commented 1 year ago

Yes! That works. Using board = esp32s3box and the partition table you provided above solved it. Thanks for helping figure this out.