Can not start ULP after DEEPSLEEP_RESET
Posted: Fri Jun 21, 2019 10:49 am
I have a setup where we use the ULP to poll the power supply every 1ms in order to get an early warning for taking the ESP32 into deepsleep. This works just fine with code along the lines of:
When this condition is detected we wait for the GPIO to go below logical "1" and goes to deepsleep, guarded by the GPIO:
The problem is that I can not repeat this after the wakeup (cause: DEEPSLEEP_RESET). The ULP simply never statrts, no matter how many times I run the code above. Also, it exhibits the same behaviour after a short deepsleep via esp_deep_sleep();
I have to do a hardware reset on CHIP_PU, and then it works again until the next DEEPSLEEP_RESET
Any clues to bits / registers / whatever to rummage through?
/Flemming
Code: Select all
ulp_set_wakeup_period(0, 1000); // Set ULP wake up period to 1ms
ulp_threshold = ref * 95 / 100;
adc1_ulp_enable(); // Give it back to the ULP
ulp_run(&ulp_entry - RTC_SLOW_MEM);
Code: Select all
ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(LG_GPIO_PSDOWN, 1));
esp_deep_sleep_start();
I have to do a hardware reset on CHIP_PU, and then it works again until the next DEEPSLEEP_RESET
Any clues to bits / registers / whatever to rummage through?
/Flemming