ets_printf from wake handler not working

chris1seto
Posts: 20
Joined: Tue Jun 12, 2018 5:05 pm

ets_printf from wake handler not working

Postby chris1seto » Sat Aug 15, 2020 5:11 pm

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!

boarchuz
Posts: 599
Joined: Tue Aug 21, 2018 5:28 am

Re: ets_printf from wake handler not working

Postby boarchuz » Sat Aug 15, 2020 9:10 pm

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

chris1seto
Posts: 20
Joined: Tue Jun 12, 2018 5:05 pm

Re: ets_printf from wake handler not working

Postby chris1seto » Sun Aug 16, 2020 1:12 am

Sadly no luck :( Still no ets_printf output

Who is online

Users browsing this forum: abuhanzala and 165 guests