ESP32 crashing after deep sleep wake-up

timoteofm
Posts: 1
Joined: Tue Jul 21, 2020 12:04 am

ESP32 crashing after deep sleep wake-up

Postby timoteofm » Tue Jul 21, 2020 12:22 am

Hi all,
I'm really struggling with deep sleep and touch wake-up.
I need to wake up if water is detected and perform several activities. Found that a threshold of 60 works fine.

Problem #1
Since the wire is in the bottom the water is always activating the touch and I'm getting constant reboots. To circumvent, placed these two lines on the callback function:

touch_pad_intr_disable();
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);

After all activities the touch and deep sleep wake-up needs to be activated again. Is this the right direction? Maybe this is causing the crash?

Problem #2
Inside the above callback (after disabling everything) I'm reading water temperature. After line "Serial.print(temperatureC);" ESP32 is crashing. Check quote.

Thanks for the all the help.

Tim.

Code: Select all

#define Threshold 60

RTC_DATA_ATTR int bootCount = 0;
touch_pad_t touchPin;

#include <OneWire.h>
#include <DallasTemperature.h>

const int oneWireBus = 14;     
OneWire oneWire(oneWireBus);
DallasTemperature sensors(&oneWire);

void callback(){
  Serial.begin(115200);
  Serial.println("WATER!");
  
  touch_pad_intr_disable();
  esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);

  Serial.println("WATER2");

  delay(3000);

  sensors.begin();

  sensors.requestTemperatures(); 
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print(temperatureC); //<-- crashes here
  Serial.println("ºC"); 

  //touchAttachInterrupt(T0, callback, Threshold);
  //esp_sleep_enable_touchpad_wakeup();

  //Serial.println("Going to sleep now");
  //delay(1000);
  //esp_deep_sleep_start();
  
}

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

  //Increment boot number and print it every reboot
  ++bootCount;
  Serial.println("Boot number: " + String(bootCount));

  // Touch0, T0, is on GPIO4
  touchAttachInterrupt(T0, callback, Threshold);

  //Configure Touchpad as wakeup source
  esp_sleep_enable_touchpad_wakeup();

  //Go to sleep now
  Serial.println("Going to sleep now");
  delay(1000);
  esp_deep_sleep_start();
  Serial.println("This will never be printed");
}

void loop(){}
1:14:04.779 -> Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
01:14:04.779 -> Core 1 register dump:
01:14:04.779 -> PC : 0x400825a0 PS : 0x00060634 A0 : 0x800811ea A1 : 0x3ffbe690
01:14:04.779 -> A2 : 0x00147050 A3 : 0x00000000 A4 : 0x00000050 A5 : 0x08000000
01:14:04.814 -> A6 : 0x00000000 A7 : 0x00000000 A8 : 0x8008259a A9 : 0x3ffbe670
01:14:04.814 -> A10 : 0x00147050 A11 : 0x00000000 A12 : 0x00000050 A13 : 0x3ffbc0e8
01:14:04.814 -> A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000012 EXCCAUSE: 0x00000006
01:14:04.814 -> EXCVADDR: 0x00000000 LBEG : 0x400eaa11 LEND : 0x400eaa16 LCOUNT : 0x00000000
01:14:04.849 -> Core 1 was running in ISR context:
01:14:04.849 -> EPC1 : 0x4008194b EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x400825a0
01:14:04.849 ->
01:14:04.849 -> Backtrace: 0x400825a0:0x3ffbe690 0x400811e7:0x3ffbe6b0 0x4008120b:0x3ffbe6d0 0x400d13c9:0x3ffbe6f0 0x400d1999:0x3ffbe720 0x400d19d5:0x3ffbe740 0x400d1a12:0x3ffbe760 0x400d0d10:0x3ffbe780 0x400812a7:0x3ffbe7b0 0x40084ac9:0x3ffbe7d0 0x400eab43:0x3ffbc570 0x400d576f:0x3ffbc590 0x40089be2:0x3ffbc5b0 0x400886f1:0x3ffbc5d0
01:14:04.884 ->
01:14:04.884 -> Core 0 register dump:
01:14:04.884 -> PC : 0x400eab46 PS : 0x00060134 A0 : 0x800d5772 A1 : 0x3ffbbff0
01:14:04.884 -> A2 : 0x00000000 A3 : 0x00000001 A4 : 0x00000000 A5 : 0x00000001
01:14:04.884 -> A6 : 0x00060120 A7 : 0x00000000 A8 : 0x800d4c22 A9 : 0x3ffbbfc0
01:14:04.884 -> A10 : 0x00000000 A11 : 0x40085254 A12 : 0x00060120 A13 : 0x3ffbb6c0
01:14:04.919 -> A14 : 0x00000000 A15 : 0x3ffbbce0 SAR : 0x00000000 EXCCAUSE: 0x00000006
01:14:04.919 -> EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
01:14:04.919 ->
01:14:04.919 -> Backtrace: 0x400eab46:0x3ffbbff0 0x400d576f:0x3ffbc010 0x40089be2:0x3ffbc030 0x400886f1:0x3ffbc050
01:14:04.919 ->
01:14:04.919 -> Rebooting...

Who is online

Users browsing this forum: No registered users and 16 guests