Page 1 of 1

Toggle GPIO in esp_wake_deep_sleep()

Posted: Thu Aug 12, 2021 4:36 pm
by dwayne@dforsyth.net
I'm trying to drive the GPIO 27 within the esp_wake_deep_sleep()...
unable to see the toggle on the logic analyse.
Not sure what I'm missing..
Running on 4.1 idf

Code: Select all

void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
    static RTC_RODATA_ATTR const char fmt_str[] = "Hello Seep Sleep Wakeup\n";
    esp_default_wake_deep_sleep();


  const uint32_t pin_27 = 27;
  const uint32_t mask_27 = (1 << pin_27);

  gpio_pad_select_gpio(pin_27);
  gpio_output_set(   0, mask_27, mask_27, 0); //Low
  ets_printf(fmt_str);
  gpio_output_set(   mask_27, 0, mask_27, 0); //High
  ets_printf(fmt_str);
  gpio_output_set(   0, mask_27, mask_27, 0); //Low
  ets_printf(fmt_str);
  gpio_output_set(   mask_27, 0, mask_27, 0); //High
}
I able able to toggle and see the GPIO it in my main loop, and just before I go into deepsleep.

Code: Select all

void app_main( void ) {
    gpio_set_direction(27, GPIO_MODE_OUTPUT); 
    gpio_set_level(27, 0); // Low
    ...
  

Code: Select all

void enterDeepSleep( void ) {

    ESP_LOGW(TAG, "\n\nDS\n");

    gpio_set_level(27, 1); // High
    gpio_set_direction(27, GPIO_MODE_INPUT);

    // isolate all the ULP GPIO lines in case of external pullup/pulldown
    rtc_gpio_isolate(GPIO_NUM_36); //RTC_G00
    rtc_gpio_isolate(GPIO_NUM_39); //RTC_G03
    rtc_gpio_isolate(GPIO_NUM_34); //RTC_G04
    rtc_gpio_isolate(GPIO_NUM_35); //RTC_G05
    rtc_gpio_isolate(GPIO_NUM_25); //RTC_G06
    rtc_gpio_isolate(GPIO_NUM_26); //RTC_G07
    rtc_gpio_isolate(GPIO_NUM_15); //RTC_G13
    rtc_gpio_isolate(GPIO_NUM_12); //RTC_G15
    rtc_gpio_isolate(GPIO_NUM_27); //RTC_G17

    esp_sleep_enable_timer_wakeup( 5 * 60 * USEC_PER_SEC); // Timer power cost 8uA
    esp_deep_sleep_start();
}