Eeprom put causing Boron SOS

Hi All,

I am using a button to put our borons into safemode. Before entering safe mode an int is saved to eeprom to know that the button caused the safemode event. However the below code is causing the system to enter SOS. Do i need some sort of a delay between the eeprom put and the enter safemode?

Thanks,

void ButtonPin(){
    Serial.print("BUTTON PRESSED");
    resetLocation = 99;
    EEPROM.put(300, resetLocation);
    System.enterSafeMode();
}

Could it be that this function is called as ISR?
If so, this would be a big No-No!!!

  • no Serial.print() inside an ISR
  • no EEPROM.put() inside an ISR
  • no System.enterSafeMode() inside an ISR

and don’t even think of putting a delay() inside an ISR :wink:

2 Likes

Hey @ScruffR

Thanks for the heads up.
At the moment its called from an Attachinterrupt(). Are the above warnings also applicable for Attachinterrupt()?

attachInterrupt() is not calling that function but only hooks it up as interrupt service routine (ISR) which will be called when the respective interrupt is triggered.

So yes, this does apply.

1 Like

Perfect, OK thanks for the heads up @ScruffR

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.