PlatformIO with ESP32 Qualia S3 - RGB66 board. Flash Size

Hello,

I’m very pleased that PlatformIO recognize AdaFruit ESP32 Qualia S3 - RGB66 board. And I’ve transferred my Arduino Coded project to VSCode/PlatformIO. But I had an error about Flash Size.
Before I’ve opened the menuconfig, It was set to 2MB. And it gives this warning.

Warning! Flash memory size mismatch detected. Expected 16MB, found 2MB!
Please select a proper value in your sdkconfig.defaults or via the menuconfig target!
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation

I’ve upload the project without problem, and I could not get calloc functions to run. So I’ve changed the flash size to 16MB in menuconfig and warning disappeared. Did I do it right? Am I missing something ?

calloc() allocates from RAM or PSRAM (if configured), that is independent of Flash size (ROM).

A pure framework = arduino project does not have the menuconfig available. Are you using espidf or espidf, arduino as your framework?

my PlatformIO.ini ->>>

[env:adafruit_qualia_s3_rgb666]
platform = espressif32
board = adafruit_qualia_s3_rgb666
framework = espidf

CMakeLists.txt ->>>>

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/.)

#idf_component_register(SRCS ${app_sources})
idf_component_register(SRCS “main.c”
INCLUDE_DIRS “.”)

And Code part is -->>>>

void create_lcd_panel(esp_lcd_panel_handle_t *panel_handle) {
esp_lcd_rgb_panel_config_t panel_config;

memset(&panel_config, 0, sizeof(esp_lcd_rgb_panel_config_t));

panel_config.data_width = 16; // RGB565 in parallel mode, thus 16bit in width
panel_config.psram_trans_align = 64;
panel_config.clk_src = LCD_CLK_SRC_PLL160M;
panel_config.disp_gpio_num = GPIO_NUM_NC;
panel_config.pclk_gpio_num = TFT_PCLK;
panel_config.vsync_gpio_num = TFT_VSYNC;
panel_config.hsync_gpio_num = TFT_HSYNC;
panel_config.de_gpio_num = TFT_DE;
panel_config.data_gpio_nums[0] = TFT_B1;
panel_config.data_gpio_nums[1] = TFT_B2;
panel_config.data_gpio_nums[2] = TFT_B3;
panel_config.data_gpio_nums[3] = TFT_B4;
panel_config.data_gpio_nums[4] = TFT_B5;
panel_config.data_gpio_nums[5] = TFT_G0;
panel_config.data_gpio_nums[6] = TFT_G1;
panel_config.data_gpio_nums[7] = TFT_G2;
panel_config.data_gpio_nums[8] = TFT_G3;
panel_config.data_gpio_nums[9] = TFT_G4;
panel_config.data_gpio_nums[10] = TFT_G5;
panel_config.data_gpio_nums[11] = TFT_R1;
panel_config.data_gpio_nums[12] = TFT_R2;
panel_config.data_gpio_nums[13] = TFT_R3;
panel_config.data_gpio_nums[14] = TFT_R4;
panel_config.data_gpio_nums[15] = TFT_R5;

panel_config.timings.pclk_hz = 30000000; //16000000;
panel_config.timings.h_res = WIDTH;
panel_config.timings.v_res = HEIGHT;
panel_config.timings.hsync_back_porch = 44;
panel_config.timings.hsync_front_porch = 50;//46;
panel_config.timings.hsync_pulse_width = 2;
panel_config.timings.vsync_back_porch = 18;//16;
panel_config.timings.vsync_front_porch = 16;//50;
panel_config.timings.vsync_pulse_width = 2;//16;
panel_config.timings.flags.pclk_active_neg = 0;

panel_config.timings.flags.vsync_idle_low = (1 == 0) ? 1 : 0 ;
panel_config.timings.flags.hsync_idle_low = (1 == 0) ? 1 : 0 ;

panel_config.num_fbs = 2;
panel_config.flags.fb_in_psram = true;

ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&panel_config, panel_handle));

esp_lcd_rgb_panel_event_callbacks_t callbacks;
memset(&callbacks, 0, sizeof(esp_lcd_rgb_panel_event_callbacks_t));
callbacks.on_vsync = on_vsync;
ESP_ERROR_CHECK(esp_lcd_rgb_panel_register_event_callbacks(*panel_handle, &callbacks, NULL));

ESP_ERROR_CHECK(esp_lcd_panel_reset(*panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_init(*panel_handle));

// Retrieve allocated frame buffers
ESP_ERROR_CHECK(esp_lcd_rgb_panel_get_frame_buffer(*panel_handle, 2, (void **)&frame_buffers[0], (void **)&frame_buffers[1]));

}

Hello again,
I’ve deleted the project and started new again today. Build had no error, but Upload says the Flash Size is mismatch. Here is the Screen data

Processing adafruit_qualia_s3_rgb666 (platform: espressif32; board: adafruit_qualia_s3_rgb666; framework: espidf)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/adafruit_qualia_s3_rgb666.html
PLATFORM: Espressif 32 (6.5.0) > Adafruit Qualia ESP32-S3 RGB666
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf @ 3.50102.0 (5.1.2) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-idf @ 1.0.1 
 - tool-mconf @ 1.4060000.20190628 (406.0.0) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823 
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-riscv32-esp @ 12.2.0+20230208
 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 16MB, found 2MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- MyPCA9554
|-- MyUtils
|-- MyWire
Building in release mode
Retrieving maximum program size .pio\build\adafruit_qualia_s3_rgb666\firmware.elf
Checking size .pio\build\adafruit_qualia_s3_rgb666\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13136 bytes from 327680 bytes)
Flash: [==        ]  23.4% (used 245373 bytes from 1048576 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: COM4

Now, Last time I've used menuconfig. This time I only update the sdkconfig file by hand.

#
# Serial flasher config
#
# CONFIG_ESPTOOLPY_NO_STUB is not set
# CONFIG_ESPTOOLPY_OCT_FLASH is not set
CONFIG_ESPTOOLPY_FLASH_MODE_AUTO_DETECT=y
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y
CONFIG_ESPTOOLPY_FLASHMODE="dio"
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
#CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y # is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"
# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set
CONFIG_ESPTOOLPY_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
CONFIG_ESPTOOLPY_AFTER="hard_reset"
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# end of Serial flasher config
Build is ok. Upload has no error nor warnings. Board seems to run. Because I can get data from serial port wia "Printf" but here is the problem :

Hello world!
my_wire_create
Initialising I2C Master: sda=8 scl=18 freq=1000000
MyWire ready!
PCA9554 found
PCA9554 Setup Done!

Panel Create 
e[0;31mE (1079) lcd_panel.rgb: lcd_rgb_panel_alloc_frame_buffers(156): no mem for frame buffere[0m
e[0;31mE (1079) lcd_panel.rgb: esp_lcd_new_rgb_panel(285): alloc frame buffers failede[0m
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x420034f5  PS      : 0x00060730  A0      : 0x82003afe  A1      : 0x3fc9a560  
A2      : 0x3fc9bdc8  A3      : 0x3c020604  A4      : 0x3c020b34  A5      : 0x00000437  
A6      : 0x3c020604  A7      : 0x3c020de4  A8      : 0x00000000  A9      : 0x3fc9a500  
A10     : 0x420122b8  A11     : 0x3c020604  A12     : 0x3c020b34  A13     : 0x3fc9a560  
A14     : 0x3fc9a540  A15     : 0x0000000c  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffa  


Backtrace: 0x420034f2:0x3fc9a560 0x42003afb:0x3fc9a580 0x4200188f:0x3fc9a5c0 0x420019b0:0x3fc9a690 0x4037de10:0x3fc9a8a0 0x4037da09:0x3fc9a8d0

" alloc frame buffers failed " caused because Flash size or something else ?

I think I’ve solved the problem I’ve opened the menuconfig and adjusted the PSRAM size and options.


Screenshot 2024-01-17 102422

I wish those options are done with the PlatformIO at first place. Because when I select a board. I assume it was already configured all, and rest is only coding. But anyway, I’m happy now. I’ll start to code asap.