Closed zekageri closed 2 years ago
I have exactly the same issue. This was also the case in 4.1.0. When setting the platform fixed at 3.5.0, everything works well:
[env:esp32dev]
platform = espressif32@3.5.0
board = esp32dev
framework = arduino
board_build.partitions = 16MB.csv
board_build.f_flash = 80000000L
board_build.flash_mode = qio
build_flags =
-DBOARD_HAS_PSRAM
-DCORE_DEBUG_LEVEL=5
; Serial Monitor options
monitor_speed = 115200
upload_port = COM7
upload_speed = 921600
First of all, let's verify that this behavior has nothing to do with the framework itself? Any chance you could try Arduino IDE with your custom partition table?
Don't have to use custom partition table, just the default_16mb.csv. On arduinoIDE, there is no option for 16mb SPIFFS or LITTLEFS
I have exactly the same issue. This was also the case in 4.1.0. When setting the platform fixed at 3.5.0, everything works well:
[env:esp32dev] platform = espressif32@3.5.0 board = esp32dev framework = arduino board_build.partitions = 16MB.csv board_build.f_flash = 80000000L board_build.flash_mode = qio build_flags = -DBOARD_HAS_PSRAM -DCORE_DEBUG_LEVEL=5 ; Serial Monitor options monitor_speed = 115200 upload_port = COM7 upload_speed = 921600
But you can not use board_build.filesystem = littlefs
with 3.5.0 and there is no built in LittleFS library. :|
On arduinoIDE, there is no option for 16mb SPIFFS or LITTLEFS
Could you please simply back up the original default_16mb.csv
and replace that default partition file with your custom one?
I could do that, but none of them works. I tested with the following csv files:
My custom csv looks like this
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x280000,
app1, app, ota_1, 0x290000,0x280000,
spiffs, data, spiffs, 0x510000,0xAF0000,
None of them works. But if i comment out entierly the board_build.partitions
option so pio will use the default_4mb.csv both of my chips boots up fine. Just there is not enough space for my stuffs. But everything works with the same setup.
But if i comment out entierly the board_build.partitions option so pio will use the default_4mb.csv
I was hoping you could try your custom partition in Arduino IDE.
Oh sorry. i will try that.
I've build the sketch in Arduino IDE 1.8.16 and it works fine.
Tried the same in the new IDE 2.0.0 RC6 and also there it's working.
(I'm not using LittleFS right now)
Nah, iam struggeling with this stupid partitioning in Arduino IDE. I replaced my custom csv with the default csv, put new sizes into the boards.txt and my flash is still 1.5mb. god...
oh fine, it works in Arduino IDE.
Sketch i tried with on both PIO and Arduino IDE:
#include "FS.h"
#include <LittleFS.h>
long lastInfoCheckMS = 0;
boolean hasPSRAM = false;
boolean fsMounted = false;
void printInfos() {
Serial.println("\n********* INFOS *********");
if( fsMounted ){
Serial.printf("FS - USED: %d - byte\n", LittleFS.usedBytes());
Serial.printf("FS - TOTAL: %d - byte\n", LittleFS.totalBytes());
}else{
Serial.println("File system is not mounted. No info");
}
if ( hasPSRAM ) {
Serial.printf("ESP - PS RAM: %d - byte\n", ESP.getPsramSize());
Serial.printf("ESP - FREE PS RAM: %d - byte\n", ESP.getFreePsram());
}else{
Serial.println("There is no external ram information.");
}
Serial.printf("ESP - RAM: %d - byte\n", ESP.getHeapSize());
Serial.printf("ESP - FREE RAM: %d - byte\n", ESP.getFreeHeap() );
}
void periodicInfoPrint(){
if ( millis() - lastInfoCheckMS >= 10000 ) {
lastInfoCheckMS = millis();
printInfos();
}
}
void littleFsBegin() {
if (!LittleFS.begin()) {
Serial.println("FS - Failed to mount the filesystem");
fsMounted = false;
} else {
Serial.println("FS - Filesystem mounted");
fsMounted = true;
}
}
void checkPS_RAM() {
char * psRam = (char *) ps_malloc (500 * sizeof (char));
if (psRam == NULL) {
Serial.println ("PS_RAM: ERROR");
hasPSRAM = false;
} else {
Serial.println ("PS_RAM: OK");
free(psRam);
hasPSRAM = true;
}
}
void setup() {
Serial.begin(115200);
vTaskDelay(1000);
Serial.println("Hello from ARDUINO IDE!");
checkPS_RAM();
littleFsBegin();
printInfos();
}
void loop() {
periodicInfoPrint();
}
Serial output on Arduino IDE:
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_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:1
load:0x3fff0030,len:1344
load:0x40078000,len:13516
load:0x40080400,len:3604
entry 0x400805f0
Hello from ARDUINO IDE!
PS_RAM: OK
FS - Filesystem mounted
********* INFOS *********
FS - USED BYTES: 1617920
FS - TOTAL BYTES: 11468800
ESP - HEAP SIZE: 364592
ESP - PS RAM SIZE: 4192139
ESP - FREE PS RAM SIZE: 4192139
********* INFOS *********
FS - USED BYTES: 1617920
FS - TOTAL BYTES: 11468800
ESP - HEAP SIZE: 364592
ESP - PS RAM SIZE: 4192139
ESP - FREE PS RAM SIZE: 4192139
Custom Partition table used:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x280000,
app1, app, ota_1, 0x290000,0x280000,
spiffs, data, spiffs, 0x510000,0xAF0000,
Default large spiffs partition table:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x480000,
app1, app, ota_1, 0x490000,0x480000,
spiffs, data, spiffs, 0x910000,0x6F0000,
@zekageri could you please compile your sketch in Arduino IDE in verbose mode and upload the log to https://pastebin.com ?
Yes, in a minute.
Verbose sketch upload with compile logs:
Verbose sketch upload with compile logs:
I see you're using 2.0.3-RC in Arduino IDE, while PlatformIO uses the latest stable 2.0.2.
Anyway, could you please also upload to https://pastebin.com/ two verbose logs from PlatformIO?
Yes. I don't know how, i assume i can set -DCORE_DEBUG_LEVEL to 4 or 5?
nvm i found it. pio run --verbose
Ah sorry it is in the Project tasks. But PIO verbose build does not fit into my terminal. It is tooo long.
Please upload your app in verbose mode as well. To redirect the output, just open the IDE terminal and run the following command:
pio run -e esp-wrover-kit -t upload --verbose > upload-log.txt
okay, thanks
Try to attach it to your comment on Github
https://drive.google.com/drive/folders/1FdsFFuFN_0Q7Qb00IG0dGz6FMi1nHqpX?usp=sharing
is it ok on google drive?
OK, thanks. First of all, I see that you're still using different configurations. In PlatformIO you use 4MB and the QIO
flash mode, while in Arduino it's 16MB and DIO
. Please adjust your PlatformIO project so it's fully consistent with the Arduino project.
What do you mean by 4mb? This is my pio thingy
Flash mode is qio, yes, but i configured qio on arduino ide too. In fact i have tried with dio and qio too.
I have tried with every possible scenario. 40mhz flash, qio/dio, slower uploads, different boards, pio built in little fs compiler and extra scripts one, with empty data folder.
In my PIO ini there is 16mb flash setup.
I can adjust flash mode to dio however
Can it be the problem? No matter what board i define, and what flash_size i set up, when compile, the HARDWARE will always be 4mb flash.
;[env:esp-wrover-kit]
[env:arduino-esp32]
platform = espressif32
board = esp32dev ;esp-wrover-kit
framework = arduino
board_build.filesystem = littlefs
board_build.f_cpu = 240000000L
upload_port = COM8
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.flash_size = 16MB
board_build.flash_mode = qio
board_build.partitions = large_spiffs_16MB.csv ;./hsh_Partition.csv
board_build.f_flash = 80000000L
build_flags = -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-mfix-esp32-psram-cache-strategy=memw
-DCORE_DEBUG_LEVEL=5
;-D CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
;-D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
;extra_scripts = mklittlefs/replace_fs.py
COMPILE:
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (4.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, 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-arduinoespressif32 3.20002.0 (2.0.2)
- tool-esptoolpy 1.30300.0 (3.3.0)
- toolchain-xtensa-esp32 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
Result of (esp32dev board) pio run -e arduino-esp32 -t upload --verbose > upload-log.txt
is:
upload-log.txt
With the following PIO INI:
;[env:esp-wrover-kit]
[env:arduino-esp32]
platform = espressif32
board = esp32dev ;esp-wrover-kit
framework = arduino
board_build.filesystem = littlefs
board_build.f_cpu = 240000000L
upload_port = COM8
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.flash_size = 16MB
board_build.flash_mode = dio
board_build.partitions = large_spiffs_16MB.csv ;./hsh_Partition.csv
board_build.f_flash = 80000000L
build_flags = -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-mfix-esp32-psram-cache-strategy=memw
-DCORE_DEBUG_LEVEL=5
;-D CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
;-D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
;extra_scripts = mklittlefs/replace_fs.py
Result of (esp-wrover-kit board) pio run -e esp-wrover-kit -t upload --verbose > upload-log.txt
is:
upload-log.txt
With the same PIO INI which is 16MB
configuration and dio
mode. With large_spiffs_16mb.csv
I can see that on PIO the HARDWARE is always this: HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
but on my ini file it is obvious that i configured 16mb and picked large flash table
No matter what board i define, and what flash_size i set up, when compile, the HARDWARE will always be 4mb flash.
Actually, it's an error in your project configuration, as it should be board_upload.flash_size = 16MB
instead of board_build.flash_size = 16MB
[env:esp-wrover-kit]
;[env:arduino-esp32]
platform = espressif32
board = esp-wrover-kit ;esp32dev
framework = arduino
board_build.filesystem = littlefs
board_build.f_cpu = 240000000L
upload_port = COM8
upload_speed = 921600
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_upload.flash_size = 16MB
board_build.flash_mode = dio
board_build.partitions = large_spiffs_16MB.csv ;./hsh_Partition.csv
board_build.f_flash = 80000000L
build_flags = -DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-mfix-esp32-psram-cache-strategy=memw
-DCORE_DEBUG_LEVEL=5
;-D CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
;-D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
;extra_scripts = mklittlefs/replace_fs.py
The hardware is still the same: upload-log.txt
But the boot loop is gone.
So, does it work as expected now?
Yes, it looks like the problem was that it should be board_upload.flash_size = 16MB
instead of board_build.flash_size = 16MB
.
Thank you @valeros, i really appreciate your help. I wonder why did it work before. I have always used this option.
Sorry for my stupidness.
Closing this.
I had a particular project which failed with this bootloop when switched to newest 2.0.3 framework. I've been doing cleaning, restarting, whatever and still had bootloop. Switched to 2.0.2 and it started working.
But the other project with 2.0.3 were fine, I realized only in this one I was using 16MB flash store some pictures in SPIFFS.
So I googled and found this issue.
With 2.0.2 and below, just this line was enough: board_build.partitions = large_spiffs_16MB.csv
With 2.0.3 using these lines the bootloop is gone, so the fix is indeed confirmed!
board_upload.flash_size = 16MB
board_build.flash_mode = dio
board_build.partitions = large_spiffs_16MB.csv
board_build.f_flash = 80000000L
I upgraded to
Espressif 4.2.0
using PIO. My chip is ESP32_WROVER_E ( 16 mb flash and 8mb external ram )My sketch worked fine with custom partition table before. I used this platform and package:
Now with this INI:
Now my ESP bootloops with the following message:
If i comment out the
board_build.partitions = default_16MB.csv
so the compiler use the default csv file, my board is working fine.I have tried with different flash_mode, flash frequency and board. Tried to erase the flash, upload empty data folder. Deleted .platformio folder. Nothing helps. If i use default_16MB.csv ( or maybe if it is bigger than 4mb?? ) my esp boot loops.
Tested with two ESP32_WROVER-E boards. Both with external ram and 16mb flash size. The upload monitor confirms that these chips has 16mb flash. ( and i know that for sure because i used the exact same sketch and partition before )
Uploading output:
Here is my platform update output:
Minimal example:
Platformio Latest Espressif 4.2.0 . Created data folder.
Pio Ini:
Main.cpp: