littlefs
littlefs copied to clipboard
Crash during write
I have the following code where I try to write some data, unfortunately by writing the data to ESP it crashes
some pieces of code
` void writeFile(fs::FS& fs, const char* path, const char* message) { Serial.printf("Writing file: %s\r\n", path);
File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("- failed to open file for writing");
return;
}
if (file.print(message)) {
Serial.println("- file written");
}
else {
Serial.println("- write failed");
}
file.close();
}
......
array.add(Data0); //SensorNummer
array.add(Data1); // Temp
array.add(Data2); // Luftfeuchtigkeit
array.add(Data3); // Höhe
array.add(Data4); // Druck
array.add(Data5); // VCC
array.add(Data6); // Übertragungen
array.add(Data7); // chksum
array.add(timeStringBuffSuperShort);
array.add(String(S6_tempmax, 2));
array.add(String(S6_tempmin, 2));
array.add(String(fSignalStrength, 1)); //SignalSrength
array.add(String(DataCounter[6]));
serializeJson(doc, dataValues);
DBG_OUTPUT_PORT.print("+++ Data for Sensor 6 to write: ");
DBG_OUTPUT_PORT.println(String(dataValues).c_str());
writeFile(LITTLEFS, SENSOR6DATA, String(dataValues).c_str());
......
`
+++ Data for Sensor 6 to write: ["6","20.0","59.67","1007.13","468.16","880.00","1851","4.22","05.08.2021 18:48","20.00","20.00","-69.0","1850"]
Writing file: /sensor6data.csv
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
Core 1 register dump:
PC : 0x40087695 PS : 0x00060a36 A0 : 0x00060a30 A1 : 0x3ffb0070
A2 : 0x3ff000e0 A3 : 0x00000001 A4 : 0x3ffbea48 A5 : 0x00000001
A6 : 0x00060823 A7 : 0x00000000 A8 : 0x80085c46 A9 : 0x3ffb0110
A10 : 0x00000000 A11 : 0x3ffb8058 A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060a20 A15 : 0x00000000 SAR : 0x00000008 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0xffffffff
ELF file SHA256: 0000000000000000
Backtrace: 0x40087695:0x3ffb0070 0x00060a2d:0x3ffb0150 0x4008a115:0x3ffb0170 0x4016bc7f:0x3ffb01b0 0x4016bd56:0x3ffb01d0 0x40087fde:0x3ffb01f0 0x400884e1:0x3ffb0210 0x4017391b:0x3ffb0280 0x400f73ec:0x3ffb02b0 0x400f4071:0x3ffb02e0 0x400f458f:0x3ffb0310 0x400f4a81:0x3ffb03b0 0x400f6f55:0x3ffb0410 0x400f31e5:0x3ffb0460 0x400f3313:0x3ffb0490 0x4016976d:0x3ffb05c0 0x4000bcdd:0x3ffb05e0 0x40059140:0x3ffb0600 0x40058d62:0x3ffb0660 0x4005896a:0x3ffb0680 0x4011f5e5:0x3ffb06b0 0x4011f631:0x3ffb06f0 0x400f23a2:0x3ffb0710 0x400f1fd7:0x3ffb0730 0x401005de:0x3ffb0750 0x401006d5:0x3ffb0770 0x400e00e1:0x3ffb0790 0x400e37a9:0x3ffb07d0 0x400e5a32:0x3ffb1e60 0x400e73d8:0x3ffb1f70 0x400e7400:0x3ffb1f90 0x401004c5:0x3ffb1fb0 0x4008a2ce:0x3ffb1fd0
Rebooting... ets Jun 8 2016 00:22:57
any idea whats wrong?
Debug exception reason: Stack canary watchpoint triggered (loopTask)
Thats a classic stack overflow of the corresponding task. Try to increase the stack for this task. printf alone may need massive amounts of stack and result in a stack overflow for the esp.