Description
Hardware:
Board: Heltec ESP32 LoRa V2 Module
Core Installation version: 1.0.3-rc3
IDE name: Arduino IDE 1.8.10
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 8.1
Description:
After a lot of hours spent to try to figure out what is wrong in my original source code, I've isolated the problem that causes the strange reboot.
I'm using esp32/1.0.3-rc3 - Heltec WiFi LoRa 32(v2) hardware board and I've edited the default partition table to simplify the tests:
I've the ESP32 64Mbit version and this is the partition table that I've used for 8MB version:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x200000,
app1, app, ota_1, 0x210000,0x200000,
eeprom, data, 0x99, 0x410000,0x1000,
ffat, data, fat, 0x411000,0x3EF000,`
I've also created another partition table for 4MB version, but the result is the same:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x200000,
ffat, data, fat, 0x210000,0x1F0000,
Sketch:
This is my simple code extracted from FFAT example in esp32_fatfsimage-master library.
#include "FS.h"
#include "FFat.h"
#include "BluetoothSerial.h"
void setup(){
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println("Start");
if(!FFat.begin()){
Serial.println("FFat Mount Failed");
FFat.format();
Serial.println("Formatted");
if(!FFat.begin()){
Serial.println("FFat Re-Mount Failed");
return;
}
}
Serial.printf("Total space: %10lu\n", FFat.totalBytes());
Serial.printf("Free space: %10lu\n", FFat.freeBytes());
Serial.println( "Test complete" );
}
void loop(){
}
As you can see, the included library "BluetoothSerial.h" isn't really used in this example, but is sufficient include it to cause the issue.
The problem happen only if the FFAT partition isn't already formatted...but if it's formatted, the software don't crash, but I'm unable to format it again to wipe data in runtime, and format function always fail.
Debug Messages:
Output copied from serial monitor when the software crashes:
22:50:20.814 -> Start
22:50:20.848 -> [E][FFat.cpp:56] begin(): Mounting FFat partition failed! Error: -1
22:50:20.848 -> FFat Mount Failed
22:50:21.120 -> /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/queue.c:1796 (vQueueDelete)- assert failed!
22:50:21.120 -> abort() was called at PC 0x4008860f on core 1
22:50:21.120 ->
22:50:21.120 -> Backtrace: 0x4008b54c:0x3ffc3620 0x4008b779:0x3ffc3640 0x4008860f:0x3ffc3660 0x400d7fdd:0x3ffc3680 0x400d652a:0x3ffc36a0 0x400d8247:0x3ffc36e0 0x400d1d22:0x3ffc3720 0x400d0f84:0x3ffc3750 0x400d312f:0x3ffc3780 0x400877bd:0x3ffc37a0
22:50:21.155 ->
22:50:21.155 -> Rebooting...
22:50:21.155 -> ets Jun 8 2016 00:22:57
22:50:21.155 ->
22:50:21.155 -> rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
22:50:21.155 -> configsip: 0, SPIWP:0xee
22:50:21.155 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
22:50:21.155 -> mode:DIO, clock div:1
22:50:21.155 -> load:0x3fff0018,len:4
22:50:21.155 -> load:0x3fff001c,len:1100
22:50:21.189 -> load:0x40078000,len:9564
22:50:21.189 -> ho 0 tail 12 room 4
22:50:21.189 -> load:0x40080400,len:6320
22:50:21.189 -> entry 0x400806a8
Output from serial monitor when it works well without BluetoothSerial.h #include line:
22:51:17.591 -> Start
22:51:17.591 -> [E][FFat.cpp:56] begin(): Mounting FFat partition failed! Error: -1
22:51:17.625 -> FFat Mount Failed
22:51:18.265 -> Formatted
22:51:18.299 -> Total space: 1982464
22:51:18.299 -> Free space: 1982464
22:51:18.299 -> Test complete
This is the command line that I've used to clear and re-initialize the ESP32 flash:
python esptool.py --port COM7 erase_flash