ESP32 EEPROM issues - not saving or not reading values

hi all,

I have switched my project to ESP32 board (wroom32 38 pins) from MEGA2560 and managed to adjust anything that was arduino specific but having issues with EEPROM.
I am aware that ESP3 does not have EEPROM but uses flash to store values, and even though i have followed basic tutorials online, i did not manage to make it to work.

So the idea is, if i keep the button presses i enter "encoder_alarm" loop, there i can change values of 8 digits, split into groups, "hours start_, minutest start, hours end and minutes end, basically setting up sleep/wake time for the LED display.

So, i have 4 addresses for EEPROM where i would like to store time set (each address has to store 2 digit number), so first address stores hours alarm starts at, second address stores minutes...

Sketch bellow worked on MEGA2560 and for ESP32 i have added "commit();" and EEPROM.begin but still no luck.

The problem is, every time i restart the board, set values are lost.

/*
 * Works beautifully on NANO V3!!!
 */
#include <EEPROM.h>
#include <ezButton.h>
#include <LedControl.h>
#include <TimeLib.h>
#include <RTClib.h>
#include <OneWire.h>
#include <DS1307RTC.h>
#include <SPI.h>


#define MAXIMCCLD 25         // output - CS/LOAD
#define MAXIMCCCLK 26        // output - CLOCK
#define MAXIMCCDATA 33       // output - DATA    

ezButton button(13);  // create ezButton object that attach to pin 7;
LedControl MaximCC=LedControl(MAXIMCCDATA, MAXIMCCCLK, MAXIMCCLD, 1); 
// LEDs not used at the moment
int LED = 555;
int LED2 = 119;


//---------------------------------------------------------------------------------

 int counter_hour_start = EEPROM.get(0, counter_hour_start);
 int counter_minute_start = EEPROM.get(1, counter_minute_start);
 int counter_hour_end = EEPROM.get(2, counter_hour_end);
 int counter_minute_end = EEPROM.get(3, counter_minute_end);
 int brightness_count;
 int counter;


// usually the rotary encoders three pins have the ground pin in the middle
enum PinAssignments {
  encoderPinA = 19,   // right DT
  encoderPinB = 18,   // left CLK
};

  // a counter for the dial
signed int lastReportedPos_hour_start = 1;   // change management
signed int lastReportedPos_minute_start = 1;   // change management
signed int lastReportedPos_hour_end = 1;   // change management
signed int lastReportedPos_minute_end = 1;   // change management
signed int lastReportedPos_brightness_count = 1;   // change management

// interrupt service routine vars
boolean A_set = false;
boolean B_set = false;

int previousSecond = 0;
int tensofhours, singlehours, tensofminutes, singleminutes,tensofhours1, singlehours1, tensofminutes1, singleminutes1,singlecounts,tensofcounts;

const int SHORT_PRESS_TIME = 1000; // 1000 milliseconds
const int LONG_PRESS_TIME  = 1000; // 1000 milliseconds

unsigned long pressedTime  = 0;
unsigned long releasedTime = 0;
bool isPressing = false;
bool isLongDetected = false;

int period = 20;
unsigned long time_now = 0;

signed int lastReportedPos_setupMenuCounter = 1;
signed int setupMenuCounter = 1; // counter goes from 1 to 3 or whatever the number of menu items is. Counter cycles so after 3 we get 1 or if we go to less than 1 we get 3
signed int lastReportedPos_sleepWakeCounter = 1;
signed int sleepWakeCounter = 1;

int oldEncoderButtonState = LOW;
int encoderButtonState = LOW;

bool selectVar = false;
bool count0 = true;

//==============================================================================
// ENCODER INTERRUP ROUTINE
//==============================================================================
void IRAM_ATTR isr(){

   if ( digitalRead(encoderPinA) != A_set ) { // debounce once more
    A_set = !A_set;
    // adjust counter + if A leads B
    if ( A_set && !B_set )
    if (count0 == true)
        brightness_count +=1;
      else if (selectVar == true)
        sleepWakeCounter ++;
      else if ((sleepWakeCounter == 0) && (selectVar == false))
        counter_hour_start +=1; 
      else if ((sleepWakeCounter == 1) && (selectVar == false))
        counter_minute_start +=1;
      else if ((sleepWakeCounter == 2) && (selectVar == false))
        counter_hour_end +=1;
      else if ((sleepWakeCounter == 3) && (selectVar == false))
        counter_minute_end +=1;
    }
    
  if ( digitalRead(encoderPinB) != B_set ) {
    B_set = !B_set;
    //  adjust counter - 1 if B leads A
    if ( B_set && !A_set )
      if (count0 == true)
        brightness_count -=1;
      else if (selectVar == true)
        sleepWakeCounter --;
      else if ((sleepWakeCounter == 0) && (selectVar == false))
        counter_hour_start -=1;
      else if ((sleepWakeCounter == 1) && (selectVar == false))
        counter_minute_start -=1;
      else if ((sleepWakeCounter == 2) && (selectVar == false))
        counter_hour_end -=1;
      else if ((sleepWakeCounter == 3) && (selectVar == false))
        counter_minute_end -=1;
  }

}
//==============================================================================
// SETUP
//==============================================================================

void setup() {
  Serial.begin(115200);

  pinMode(LED, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(encoderPinA, INPUT);
  pinMode(encoderPinB, INPUT);

  EEPROM.begin(4194304);

  attachInterrupt(encoderPinA, isr, CHANGE);
  attachInterrupt(encoderPinB, isr, CHANGE);

  // Initialize RTC and set as SyncProvider.
  // Later RTC will be synced with DCF time
  setSyncProvider(RTC.get); // the function to get the time from the RTC
  // check if RTC has set the system time
  if (timeStatus() != timeSet)
  { // Unable to sync with the RTC
  }
  
  MaximCC.shutdown(0,false);
  MaximCC.setIntensity(0,15);
  MaximCC.clearDisplay(0);
  button.setDebounceTime(10); // set debounce time to 50 milliseconds
  button.setCountMode(COUNT_FALLING);

  tensofhours = counter_hour_start / 10;
  singlehours = counter_hour_start % 10;
  tensofminutes = counter_minute_start / 10;
  singleminutes = counter_minute_start % 10;
  tensofhours1 = counter_hour_end / 10;
  singlehours1 = counter_hour_end % 10;
  tensofminutes1 = counter_minute_end / 10;
  singleminutes1 = counter_minute_end % 10; 
}

//==============================================================================
// LOOP
//==============================================================================

void loop() {

  displayRtcTime();
  // check if there was a short or a long press of a bottom // 
  button.loop(); // MUST call the loop() function first

  if(button.isPressed()){
    pressedTime = millis();
    isPressing = true;
    isLongDetected = false;
  }

  if(button.isReleased()) {
    isPressing = false;
    releasedTime = millis();

    long pressDuration = releasedTime - pressedTime;
    
    if( pressDuration < SHORT_PRESS_TIME ) // on short button press, keep resetting the counter to zero so it does not count before long press
      if (count0 == true){
      button.resetCount();
      }
  }

  if(isPressing == true && isLongDetected == false) {
    long pressDuration = millis() - pressedTime;
    if( pressDuration > LONG_PRESS_TIME ) {
      isLongDetected = true;
    }
  }
   
  if (count0 == true){ 
    if(millis() > time_now + period){
        time_now = millis();
    manual_brightness_control();
    } 
  } else {
    if(millis() > time_now + period){
        time_now = millis();
    encoder_alarm();
  }
  }
  
  if (isLongDetected == true){
    button_press();
  }
}

//==============================================================================
// button_press
//==============================================================================
void button_press (){

  unsigned long count = button.getCount();
  
  if (count == 0) {
    count0 = true;
    } else {
      count0 = false;
    }  
}


//==============================================================================
// ENCODER ALARM
//==============================================================================

void encoder_alarm(){

  
  // toggle boolean state to choose between cycling the setup positions and changing the values
  encoderButtonState = digitalRead(13);
  if (( encoderButtonState != oldEncoderButtonState ) && (encoderButtonState == HIGH) ) {
     selectVar = !selectVar;
    }
    oldEncoderButtonState = encoderButtonState;

  //--------------------- sleepWakeCounter ------------------------//

    if (lastReportedPos_sleepWakeCounter != sleepWakeCounter) {
      if (sleepWakeCounter>4) {(sleepWakeCounter = 0);}
       if (sleepWakeCounter<0) {(sleepWakeCounter = 4);}
    
       lastReportedPos_sleepWakeCounter = sleepWakeCounter;
    }

  //--------------------- HOURS alarm STARTS at ------------------------//
  
    if (lastReportedPos_hour_start != counter_hour_start) {
      if (counter_hour_start>23) {(counter_hour_start = 0);}
      if (counter_hour_start<0) {(counter_hour_start = 23);}

      tensofhours = counter_hour_start / 10;
      singlehours = counter_hour_start % 10; 

      lastReportedPos_hour_start = counter_hour_start;
  }

      

  //--------------------- MINUTES alarm STARTS at ------------------------//

    if (lastReportedPos_minute_start != counter_minute_start) {
      if (counter_minute_start>59) {(counter_minute_start = 0);}
       if (counter_minute_start<0) {(counter_minute_start = 59);}

       tensofminutes = counter_minute_start / 10;
       singleminutes = counter_minute_start % 10; 

      lastReportedPos_minute_start = counter_minute_start;

       

  } 
  
  //--------------------- HOURS alarm ENDS at ------------------------// 

    if (lastReportedPos_hour_end != counter_hour_end) {
      if (counter_hour_end>23) {(counter_hour_end = 0);}
      if (counter_hour_end<0) {(counter_hour_end = 23);}

      tensofhours1 = counter_hour_end / 10;
      singlehours1 = counter_hour_end % 10; 

      lastReportedPos_hour_end = counter_hour_end;
  }
      


  
  //--------------------- MINUTES alarm ENDS at ------------------------//
  
    if (lastReportedPos_minute_end != counter_minute_end) {
      if (counter_minute_end>59) {(counter_minute_end = 0);}
       if (counter_minute_end<0) {(counter_minute_end = 59);}

       tensofminutes1 = counter_minute_end / 10;
       singleminutes1 = counter_minute_end % 10; 

      lastReportedPos_minute_end = counter_minute_end;

       
       
  } 

  
  //--------------------- 7 Segment display  ------------------------//

    EEPROM.put(0,counter_hour_start);
    EEPROM.put(1,counter_minute_start);
    EEPROM.put(2,counter_hour_end);
    EEPROM.put(3,counter_minute_end);
    EEPROM.commit();
    EEPROM.end();


    // display current alarm times
    MaximCC.setChar(0,7,tensofhours,false);
    MaximCC.setChar(0,6,singlehours,false);
    MaximCC.setChar(0,5,tensofminutes,false);
    MaximCC.setChar(0,4,singleminutes,false);
    MaximCC.setChar(0,3,tensofhours1,false);
    MaximCC.setChar(0,2,singlehours1,false);
    MaximCC.setChar(0,1,tensofminutes1,false);
    MaximCC.setChar(0,0,singleminutes1,false);
 
  if (sleepWakeCounter == 4) {
    digitalWrite(LED, HIGH);
    if(selectVar == false) {
      digitalWrite(LED, LOW);
      count0 = true;
      } 
  } else {
    digitalWrite(LED, LOW);
  }
   
  
  if (sleepWakeCounter == 0) {
    MaximCC.setChar(0,7,tensofhours,false);
    MaximCC.setChar(0,6,singlehours,true); 
  } else {
    MaximCC.setChar(0,6,singlehours,false); 
  }

  if (sleepWakeCounter == 1) {
    MaximCC.setChar(0,5,tensofminutes,false);
    MaximCC.setChar(0,4,singleminutes,true); 
  } else {
    MaximCC.setChar(0,4,singleminutes,false); 
  }

  if (sleepWakeCounter == 2) {
    MaximCC.setChar(0,3,tensofhours1,false);
    MaximCC.setChar(0,2,singlehours1,true); 
  } else {
    MaximCC.setChar(0,2,singlehours1,false); 
  }

  if (sleepWakeCounter == 3) {
    MaximCC.setChar(0,1,tensofminutes1,false);
    MaximCC.setChar(0,0,singleminutes1,true); 
  } else {
    MaximCC.setChar(0,0,singleminutes1,false); 
  }
}

//==============================================================================
// manual_brightness_control
//==============================================================================

void manual_brightness_control()
{
  
  if (lastReportedPos_brightness_count != brightness_count) {
      if (brightness_count>15) {(brightness_count = 15);}
       if (brightness_count<0) {(brightness_count = 0);}

       singlecounts = brightness_count / 10;
       singlecounts = brightness_count % 10; 

      lastReportedPos_brightness_count = brightness_count;
      MaximCC.setIntensity(0,brightness_count);
  }  
}
//==============================================================================
// displayRtcTime
//==============================================================================

void displayRtcTime()
{
  if (count0 == true){
  MaximCC.setChar(0, 7, (hour() / 10), false);
  MaximCC.setChar(0, 6, (hour() % 10), false);
  
  MaximCC.setChar(0, 5, '-', false);
  MaximCC.setChar(0, 4, (minute() / 10), false);
  MaximCC.setChar(0, 3, (minute() % 10), false);

  MaximCC.setChar(0, 2, '-', false);
  MaximCC.setChar(0, 1, (second() / 10), false);
  MaximCC.setChar(0, 0, (second() % 10), false);
  
  }
  
}

//==============================================================================
// ledTest
//==============================================================================
void ledTest(){
  int midnight;
  int powersaving;
  int startTime = counter_hour_start * 100 + counter_minute_start;
  int endTime = counter_hour_end * 100 + counter_minute_end;
  int timeNow = hour() * 100 + minute();
  

  if (endTime == 0000 && startTime != 0000){
    endTime = 2359;
  }
  
    
   if (timeNow >= startTime && timeNow < endTime)  {
    powersaving = true;
   } else {
    powersaving = false;
   }
  
  if (powersaving == true){
    digitalWrite(LED2, HIGH);
  } else {
    digitalWrite(LED2, LOW);
  }
}

Many thanks for any tips,
Alek

[code]
  EEPROM.begin(4194304);
[/code]

How did you arrive that that number and what is the maximum EEPROM size on the ESP32 ?

a number i've found somewhere, shoukd be 4mb flash size... anyway, nothing less than 40000 works at all, if i put 512, 64, 1024, 32... nothing works, i just get onboard LED light up and the board doesnt boot.

many thanks,
alek

Perform the eeprom read in the setup, not during variable definition

If you use EEPROM.end(); you can’t use the EEPROM again unless you call begin again..

nope, still no go.

setup

EEPROM.begin(4194304);
  int counter_hour_start = EEPROM.read(0);
  int counter_minute_start = EEPROM.read(10);
  int counter_hour_end = EEPROM.read(20);
  int counter_minute_end = EEPROM.read(30);

also removed EEPROM.end();
no luck
p.s. changed address locations just to test it out, no difference

Once i set up the sleep/wake time and exit "encoder_alarm" loop, if i enter it again i can see the
values i've set, its only if i restart the board that everything is lost.
many thanks,
Alek

Hi,
The EEPROM.put () and EEPROM.get () function identify the byte size of the variable and save the values ​​in spaces of the size of the variables.
That is :
If the variable is of type "int", the values ​​will be saved, (read), using two addresses from the EEPROM, if it is long, the values ​​will be saved, (read), using 4 addresses from the EEPROM, and so on,

In your sketch, you defined:
int counter_hour_start = EEPROM.get (0, counter_hour_start); 2 bytes of space;
int counter_minute_start = EEPROM.get (1, counter_minute_start); 2 bytes of space;
int counter_hour_end = EEPROM.get (2, counter_hour_end); 2 bytes of space;
int counter_minute_end = EEPROM.get (3, counter_minute_end); 2 bytes of space;

When recording you used:
EEPROM.put (0, counter_hour_start); address 0;
EEPROM.put (1, counter_minute_start); Address 1;
EEPROM.put (2, counter_hour_end); address 2;
EEPROM.put (3, counter_minute_end); address 3;

There is a data overlap here, as the data is 2 bytes in length.

The correct thing would be:
EEPROM.put (0, counter_hour_start); address 0;
EEPROM.put (2 counter_minute_start); address 2;
EEPROM.put (4, counter_hour_end); address 4;
EEPROM.put (6, counter_minute_end); address 6;

When reading there is also the problem:

int counter_hour_start = EEPROM.get (0, counter_hour_start);
int counter_minute_start = EEPROM.get (1, counter_minute_start);
int counter_hour_end = EEPROM.get (2, counter_hour_end);
int counter_minute_end = EEPROM.get (3, counter_minute_end);

Right:
int counter_hour_start = EEPROM.get (0, counter_hour_start);
int counter_minute_start = EEPROM.get (2, counter_minute_start);
int counter_hour_end = EEPROM.get (4, counter_hour_end);
int counter_minute_end = EEPROM.get (6, counter_minute_end);

RV mineirin

thanks ruilviana,

Already tried all that , still no luck.

many thanks,
Alek

Let's start with something basic. Try this

#include <EEPROM.h>

void setup()
{
  Serial.begin(115200);
  while (!Serial);
  if (!EEPROM.begin(512))
  {
    Serial.println("EEPROM failed to initialise");
    while (true);
  }
  else
  {
    Serial.println("EEPROM initialised");
  }
  EEPROM.write(0, 1);
  for (int x = 0; x < 8; x++)
  {
    byte inByte = EEPROM.read(0);
    Serial.print("read ");
    Serial.println(inByte);
    EEPROM.write(0, inByte * 2);
  }
}

void loop()
{
}

What does it print ?

it prints the following... doesnt seem correct to me:

Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC      : 0x400835a2  PS      : 0x00060334  A0      : 0x800e5ba0  A1      : 0x3ffbb950  
A2      : 0x3ffbd57c  A3      : 0x00000011  A4      : 0x3ffbd594  A5      : 0x00000011  
A6      : 0x003fffff  A7      : 0x00000000  A8      : 0x800e52f3  A9      : 0x3ffbb920  
A10     : 0x00000000  A11     : 0x00000011  A12     : 0x00000010  A13     : 0x00000000  
A14     : 0xffffffff  A15     : 0x00000000  SAR     : 0x0000001e  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

ELF file SHA256: 0000000000000000

Backtrace: 0x400835a2:0x3ffbb950 0x400e5b9d:0x3ffbb9a0 0x400e5e96:0x3ffbba20 0x400e6477:0x3ffbba70 0x400e3dbd:0x3ffbbae0 0x400e36cd:0x3ffbbb40 0x400e377f:0x3ffbbb60 0x400e37ca:0x3ffbbb80 0x400d1652:0x3ffbbba0 0x400d2030:0x3ffbbbc0 0x400e198e:0x3ffbbbf0 0x400860ed:0x3ffbbc10

Core 1 register dump:
PC      : 0x400eaaa6  PS      : 0x00060c34  A0      : 0x800e185a  A1      : 0x3ffbc6b0  
A2      : 0x00000000  A3      : 0x80000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060c20  A7      : 0x00000000  A8      : 0x80086f54  A9      : 0x3ffbc6a0  
A10     : 0x00000003  A11     : 0x00060c23  A12     : 0x00060c20  A13     : 0x3ffbd680  
A14     : 0x400e271c  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400eaaa6:0x3ffbc6b0 0x400e1857:0x3ffbc6d0 0x40087582:0x3ffbc6f0 0x400860ed:0x3ffbc710

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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4000c271  PS      : 0x00060034  A0      : 0x80086a04  A1      : 0x3ffb1c80  
A2      : 0x3ffb0058  A3      : 0x3f404cd8  A4      : 0x00000014  A5      : 0x3ffbeb00  
A6      : 0x3ffbeb48  A7      : 0x00000001  A8      : 0x00000001  A9      : 0x3f404cd9  
A10     : 0x000000a5  A11     : 0x00000000  A12     : 0x80087593  A13     : 0x3ffbead0  
A14     : 0x00000008  A15     : 0x00000001  SAR     : 0x00000011  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x4000c271:0x3ffb1c80 0x40086a01:0x3ffb1ca0 0x4008837c:0x3ffb1cc0 0x40088332:0x3ffb1ce0 0x40083ff2:0x3ffbd57c

Core 0 register dump:
PC      : 0x400eaaa6  PS      : 0x00060f34  A0      : 0x800e185a  A1      : 0x3ffbc130  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060f20  A7      : 0x00000000  A8      : 0x800e154e  A9      : 0x3ffbc100  
A10     : 0x00000000  A11     : 0x400831d8  A12     : 0x00060f20  A13     : 0x3ffbb7c0  
A14     : 0x00000000  A15     : 0x3ffbbe20  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400eaaa6:0x3ffbc130 0x400e1857:0x3ffbc150 0x40087582:0x3ffbc170 0x400860ed:0x3ffbc190

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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC      : 0x400835a2  PS      : 0x00060334  A0      : 0x800e5ba0  A1      : 0x3ffbb950  
A2      : 0x3ffbd57c  A3      : 0x00000022  A4      : 0x3ffbd594  A5      : 0x00000011  
A6      : 0x003fffff  A7      : 0x00000000  A8      : 0x800e52f3  A9      : 0x3ffbb920  
A10     : 0x00000000  A11     : 0x00000022  A12     : 0x00000021  A13     : 0x00000000  
A14     : 0xffffffff  A15     : 0x00000000  SAR     : 0x0000001c  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

ELF file SHA256: 0000000000000000

Backtrace: 0x400835a2:0x3ffbb950 0x400e5b9d:0x3ffbb9a0 0x400e5e96:0x3ffbba20 0x400e6477:0x3ffbba70 0x400e3dbd:0x3ffbbae0 0x400e36cd:0x3ffbbb40 0x400e377f:0x3ffbbb60 0x400e37ca:0x3ffbbb80 0x400d1652:0x3ffbbba0 0x400d2030:0x3ffbbbc0 0x400e198e:0x3ffbbbf0 0x400860ed:0x3ffbbc10

Core 1 register dump:
PC      : 0x400eaaa6  PS      : 0x00060c34  A0      : 0x800e185a  A1      : 0x3ffbc6b0  
A2      : 0x00000000  A3      : 0x80000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060c20  A7      : 0x00000000  A8      : 0x80086f54  A9      : 0x3ffbc6a0  
A10     : 0x00000003  A11     : 0x00060c23  A12     : 0x00060c20  A13     : 0x3ffbd680  
A14     : 0x400e271c  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400eaaa6:0x3ffbc6b0 0x400e1857:0x3ffbc6d0 0x40087582:0x3ffbc6f0 0x400860ed:0x3ffbc710

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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4000c271  PS      : 0x00060034  A0      : 0x80086a04  A1      : 0x3ffb1c80  
A2      : 0x3ffb0058  A3      : 0x3f404cd8  A4      : 0x00000014  A5      : 0x3ffbeb00  
A6      : 0x3ffbeb48  A7      : 0x00000001  A8      : 0x00000001  A9      : 0x3f404cd9  
A10     : 0x000000a5  A11     : 0x00000000  A12     : 0x80087593  A13     : 0x3ffbead0  
A14     : 0x00000008  A15     : 0x00000001  SAR     : 0x00000011  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x4000c271:0x3ffb1c80 0x40086a01:0x3ffb1ca0 0x4008837c:0x3ffb1cc0 0x40088332:0x3ffb1ce0 0x40083ff2:0x3ffbd57c

Core 0 register dump:
PC      : 0x400eaaa6  PS      : 0x00060f34  A0      : 0x800e185a  A1      : 0x3ffbc130  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x00000001  
A6      : 0x00060f20  A7      : 0x00000000  A8      : 0x800e154e  A9      : 0x3ffbc100  
A10     : 0x00000000  A11     : 0x400831d8  A12     : 0x00060f20  A13     : 0x3ffbba70  
A14     : 0x00000000  A15     : 0x3ffbbe20  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400eaaa6:0x3ffbc130 0x400e1857:0x3ffbc150 0x40087582:0x3ffbc170 0x400860ed:0x3ffbc190

Rebooting...
...
...
...

many thanks,
Alek

That certainly isn't right

Here it prints what I expect it too, ie

EEPROM initialised
read 1
read 2
read 4
read 8
read 16
read 32
read 64
read 128

So something is wrong with your ESP board. Is anything connected to the board ?

yes,

  • one max7219 with 8 digit display
  • DS3231 on SCL/SDA
  • one encoder with button

i just did a test with another board and it worked:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_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:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
EEPROM initialised
read 1
read 2
read 4
read 8
read 16
read 32
read 64
read 128

could it be that i have something connected on a wrong pin...
I have used only GPIOs from 13 to 30, which are safe to use for both INPUT and OUTPUT

very strange...

ok, as soon as i disconnected max led display, it worked

#define MAXIMCCLD 25         // output - CS/LOAD
#define MAXIMCCCLK 26        // output - CLOCK
#define MAXIMCCDATA 33       // output - DATA    

so this was the issue, but why? these pins should be ok to use.

According to my notes, all of those pins should be OK on a wroom module but you might have something connected wrongly

could be. will try to connect everything again and led display on other pins (even though i really need every single pin i can use)

thanks,
Alek

The SS pin is usually defined in ESP32 as pin 5, so using it would conflict with SPIFFS, EEPROM, etc.
You don’t use it, do you?

Which esp32 do you have?

nope, i use pins from. 13 to 33.

its esp32 wroom32 with 38 pins

many thanks,
alek

Are you referring to gpio numbers or arduino pins?

GPIO

one more thing, i am using max7219 SPI lines without level shifter, and powering it from ESP32 3.3v pin... could this be the issue?

Changing pins now and testing again

made it, finally!
It works now. Not sure what the issue was but this GPIO mess is giving me headache.
I've used ESP boards in the past sporadically and now pretty much replacing all AVR/arduino boards as ESP is amazing in every sense, but hate the pinout and pin philosophy.

This one is to replace MEGA2560 so i will be some 2 pins short :laughing: considering i will be able to actually use 29 pins marked as OK to use.

Many thanks once again guys!
Alek