Page 1 of 1

ets_printf from wake handler not working

Posted: Sat Aug 15, 2020 5:11 pm
by chris1seto
I have the following code (snipped up):

Code: Select all


static RTC_RODATA_ATTR const char wake_msg[] = "Low power up\r\n";
// Deep sleep wake stub
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
  // https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/deep-sleep-stub.html
  esp_default_wake_deep_sleep();
  
  // Enter the full sized wake stub routine
  WakeStub_Run();
}

// Call on fresh bootup
void RTC_IRAM_ATTR WakeStub_Run(void)
{

  // We're up
  ets_printf(wake_msg);

}

I know for sure the wake stub is running (other code is running that I snipped out) but if I do a `make monitor` and put the board to sleep, then wake it up, I see no serial output. I can see the messages from the board as it is going down and as it comes up though, just not my ets_printf in the wake stub.

Any ideas?

Thanks!

Re: ets_printf from wake handler not working

Posted: Sat Aug 15, 2020 9:10 pm
by boarchuz
Try waiting for UART to finish transmitting before the stub returns:

Code: Select all

#include "soc/uart_reg.h"
while (REG_GET_FIELD(UART_STATUS_REG(0), UART_ST_UTX_OUT));
https://gist.github.com/igrr/54f7fbe051 ... d7fbecfeab

Re: ets_printf from wake handler not working

Posted: Sun Aug 16, 2020 1:12 am
by chris1seto
Sadly no luck :( Still no ets_printf output