Page 1 of 1

Enter Light Sleep Mode cause reset

Posted: Fri Nov 02, 2018 11:42 am
by JacksonLv
I'm trying out to enter light sleep mode in a timer interrupt function,but it will crash and reset as it do sleep sometimes.I found when it is in smart config mode ,it won't crash.If it's in station mode and connected to the AP,it will have this matter.Here is my code and log ,PLS help!! MY SDK version is NONOS 3.0.0

Code: Select all

sleep_time_cnt: 60

enter sleep mode

wifi disconnected

pm close 7
fpm open,type:1 0
fpm 758

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

Code: Select all

   void ICACHE_FLASH_ATTR user_init(){


   os_printf("Firmware Version: 20181101\n");



   if (os_strlen(stationConf.ssid) != 0) {
      //net_status   = 1;
      os_timer_setfn(&check_ip_timer, (os_timer_func_t *) user_check_ip, NULL);
      os_timer_arm(&check_ip_timer, 100, 0);

   } else {

       net_status  = 0;


   os_timer_setfn(&light_status_timer, (os_timer_func_t *)led_status_timer_func , NULL);

   os_timer_setfn(&sleep_timer, (os_timer_func_t *)sleep_timer_func , NULL);

Code: Select all

void sleep_init(void){
   wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);     //set force sleep type, clsoe rf&cpu
   wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); //Set fpm wakeup callback function


Code: Select all

void sleep_start(void )
   os_printf("enter sleep mode\n\n");

   if(wifi_station_get_connect_status() == STATION_GOT_IP){
      os_printf("wifi disconnected\n\n");
   } else {
      os_printf("wifi not connected\n\n");
   wifi_set_opmode(NULL_MODE);               //set wifi mode to null mode.
   wifi_fpm_open();                        //enable force sleep fucntion

   int rst =  wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);      // do sleep
   os_printf("sleep rst : %d",rst);


Code: Select all

sleep_timer_func(void )
   static uint8_t cnt = 0;
   if(sleep_time_cnt < SLEEP_TIME_CNT){
      os_printf("sleep_time_cnt: %d\n\n",sleep_time_cnt);
   }else {//2 min
      sleep_time_cnt = 0;