ESP8266 - nondeterministic IO state after deep sleep

Hello, I have learned that ESP8266 has undefined GPIO state after deep sleep. I use ESP8266 to wake up Arduino with external interrupt.

This is my Arduino code:

#include <LowPower.h>
int interruptPin = 2;
int val = 0;


void setup() {
  Serial.begin(9600);
}

void wakeUp(){
}

void loop() {
  delay(1000);
  Serial.println("Going to sleep");
  delay(500);
  attachInterrupt(digitalPinToInterrupt(interruptPin), wakeUp, LOW);
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);  
  delay(100);
  detachInterrupt(digitalPinToInterrupt(interruptPin));
  Serial.println("Woke up!");
}

And this is my ESP code:

const int interruptPin = 4;
 
void setup() {
  pinMode(interruptPin, OUTPUT);
  digitalWrite(interruptPin,HIGH);
}
 
void loop() {
  delay(10000);
  //  ESP.deepSleep(10e6);
  digitalWrite(interruptPin,LOW);
  delay(1000);
  digitalWrite(interruptPin,HIGH);

}

When using delay() on the ESP, everything works as intended, waking the Arduino up as it should. However, when I switch to the deepSleep() it suddenly becomes undeterministic and it seems like the pins dont follow the value set by digitalWrite(), its just random (i.e. the pins stay LOW, constantly waking arduino up, even when I set them to HIGH).

Do you have any experience with this issue?
Thanks

pull up and pull down resistors might interest you. The hardware you are using does not have an issue.

I am new to all this, could you please explain to me briefly how these resistors would help me?

do a inet search on words "how do pull up pull down resistors work"

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