I am programming a miner with esp32 using Arduino as programming language and PlatformIo as compiler, at this moment I am developing the telemetry part (which runs on core 0) since the miner is already programmed on core 1 and the code is giving me some unexpected restarts along with the following error message:
Guru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 0 register dump:
PC : 0x400d41ac PS : 0x00060d30 A0 : 0x80088ba0 A1 : 0x3ffcf4b0
A2 : 0x00000000 A3 : 0x3ffc133c A4 : 0x3ffcf4d8 A5 : 0x3ffc11e4
A6 : 0x00000000 A7 : 0x0000000a A8 : 0x800d41ac A9 : 0x3ffcf470
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3ffc1778 A13 : 0x3ffc1164
A14 : 0x3ffc1164 A15 : 0x3ffcf474 SAR : 0x0000000a EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x400d41ac:0x3ffcf4b0 0x40088b9d:0x3ffcf540
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
WiFi Setup
Below I share a minimal and reproducible example that shows the error (it is not the original code) and I did it in Arduino IDE:
#include <SPIFFS.h>
void setup() {
Serial.begin(115200);
Serial.println("Arrancando telemetria: ");
}
void loop() {
float memory;
float memoryPsram;
float disk;
for (int i = 0; i < 10; i++)
{
memory += 100 - (ESP.getFreeHeap() * 100 / ESP.getHeapSize());
memoryPsram += 100 - (ESP.getFreePsram() * 100 / ESP.getPsramSize());
disk += SPIFFS.usedBytes() * 100 / SPIFFS.totalBytes();
}
Serial.print("Memory: ");
Serial.println(memory/10);
Serial.print("Memory Psram: ");
Serial.println(memoryPsram/10);
Serial.print("Disk: ");
Serial.println(disk/10);
delay(300);
}