Code: Select all
static void ICACHE_FLASH_ATTR prSleepTimerCb(void *arg) {
os_printf("Sleep!\n");
os_delay_us(600); // time for "Sleep!" to be printed at 115200 baud
int8_t err = wifi_fpm_do_sleep(1000*1000);
if (err != 0) os_printf("Sleep error: %d\n", err);
os_printf("Back!\n");
}
void user_init(void) {
...
os_timer_disarm(&prHeapTimer);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
os_timer_disarm(&prHeapTimer);
os_timer_setfn(&prHeapTimer, prSleepTimerCb, NULL);
os_timer_arm(&prHeapTimer, 20000, 0);
...
}
Some of the os_printf output:
Code: Select all
141> force slp enable,type: 1
141> fpm open,type:1 0
...
8831> connected with tve-home, channel 1
8831> dhcp client start...
11605> ip:192.168.0.114,mask:255.255.255.0,gw:192.168.0.1
15125> Wifi check: mode=STA status=5
17948> fpm close 3
17948> pm open phy_2,type:2 0 0
20141> Sleep!
20142> pm2 684
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
Ooops, that's a crash! (The number at the left shows milliseconds since boot.)
The crash info is: Reset cause: 3=soft wdt , exccause=4 epc1=0x40221ac6 epc2=0x0 epc3=0x0 excvaddr=0x0 depc=0x0
The crash location is near the beginning of fpm_do_sleep:
Code: Select all
40221aa8 <fpm_do_sleep>:
fpm_do_sleep():
40221aa8: f0c112 addi a1, a1, -16
40221aab: 006122 s32i a2, a1, 0
40221aae: 016102 s32i a0, a1, 4
40221ab1: ff3485 call0 40220dfc <pm_is_open>
40221ab4: 011216 beqz a2, 40221ac9 <fpm_do_sleep+0x21>
40221ab7: fe7721 l32r a2, 40221494 <fpm_attach+0x1e4>
40221aba: fe7731 l32r a3, 40221498 <fpm_attach+0x1e8>
40221abd: aca242 movi a4, 0x2ac
40221ac0: 7d5901 l32r a0, 40201024 <_irom0_text_start+0x14>
40221ac3: 0000c0 callx0 a0
40221ac6: ffff06 j 40221ac6 <fpm_do_sleep+0x1e>
40221ac9: fd7941 l32r a4, 402210b0 <pm_get_idle_wait_time+0x44>
40221acc: 4408 l32i.n a0, a4, 16
40221ace: e27c movi.n a2, -2
40221ad0: 02e0d7 bbsi a0, 13, 40221ad6 <fpm_do_sleep+0x2e>
40221ad3: 0001c6 j 40221ade <fpm_do_sleep+0x36>
...
Help?