Fatal exception (29) while switching to SOFTAP mode from Station

paritosharya007
Posts: 10
Joined: Sat May 23, 2015 1:24 pm

Fatal exception (29) while switching to SOFTAP mode from Station

Postby paritosharya007 » Mon Aug 31, 2015 4:27 pm

I have run into an strange problem where my ESP throws Fatal Exception(29) error while switching the mode from station to softap when the user provides wrong password during connection.

My logic is that the ESP would try connecting to an Access Point as station for 5 times. It 5 connection attempts fail (wrong password or any other reason), it would switch over to SoftAP mode. Here's my code:

Code: Select all

#define WIFI_STATUS_NAME(status)                                    \
   (STATION_IDLE          == status ?  "STATION_IDLE"            :          \
   (STATION_CONNECTING    == status ?  "STATION_CONNECTING"      :          \
   (STATION_WRONG_PASSWORD == status ?  "STATION_WRONG_PASSWORD"   :          \
   (STATION_NO_AP_FOUND    == status ?  "STATION_NO_AP_FOUND"      :          \
   (STATION_CONNECT_FAIL    == status ?  "STATION_CONNECT_FAIL"      :          \
   (STATION_GOT_IP       == status ?  "STATION_GOT_IP"         : "Unknown"    ))))))
   
   
/******************************************************************************
 * FunctionName : wifi_event_handler
 * Description  : handles the event of wifi connection state change
 * Parameters   : System_Event_t
 * Returns      : none
 *******************************************************************************/
void ICACHE_FLASH_ATTR
wifi_event_handler(System_Event_t *evt) {

   uint8 wifi_status = wifi_station_get_connect_status();

   switch (evt->event) {
      case EVENT_STAMODE_DISCONNECTED: {

         os_printf("-> wifi status : (%d) - ", wifi_status );

         switch (wifi_status) {
            case STATION_CONNECTING: {
               wifi_connect_tries++;
               if ( wifi_connect_tries >= wifi_connect_max_tries ) {
                  os_printf("STATION_CONNECTING..timeout!!!\n");
                  if (wifi_get_opmode()==STATION_MODE) {
                     wifi_set_opmode(SOFTAP_MODE);
                     wifi_connect_tries = 0;
                  }
                  else if (wifi_get_opmode()==STATIONAP_MODE) {

                  }
               }
               else
                  os_printf("STATION_CONNECTING..%d\n", wifi_connect_tries);
               break;
            }
            default: {
               os_printf("-> %s\n",WIFI_STATUS_NAME(wifi_status));
               wifi_connect_tries = 0;
               wifi_set_opmode(SOFTAP_MODE);
               break;
            }
         }
         break;
      }   // end EVENT_STAMODE_DISCONNECTED

      case EVENT_STAMODE_GOT_IP: {
         if (wifi_get_opmode() != STATION_MODE) {      // get current mode, if not station
            wifi_set_opmode(STATION_MODE);             // set current mode to station and save to flash

            wifi_connect_tries = 0;
         }
         break;
      }
   }


The error I get is

mode : sta(18:fe:34:9d:2b:b3) + softAP(1a:fe:34:9d:2b:b3)
add if1
pm close 7 0 0/175059131
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
f 0, beacon timeout
state: 5 -> 0 (1)
-> wifi status : (4) - -> STATION_CONNECT_FAIL
scandone
del if0
mode : softAP(1a:fe:34:9d:2b:b3)
Fatal exception (29):
epc1=0x4025ca65, epc2=0x00000000, epc3=0x400043e6, excvaddr=0x000000b8, depc=0x00000000

ets Jan 8 2013,rst cause:1, boot mode:(1,7)


ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset


The same code works on my home wifi network, but throws exception on other wifi networks.



Any pointers or clue will be much appreciated.

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Fatal exception (29) while switching to SOFTAP mode from Station

Postby ESP_Faye » Thu Sep 10, 2015 10:25 am

Hi,

Please have a try with this attachment based on esp_iot_sdk_v1.3.0.

Thanks for your interest in ESP8266 !
Attachments
SDK1.3.0_ChangeMode_patch01.zip
(166.01 KiB) Downloaded 440 times

Who is online

Users browsing this forum: No registered users and 38 guests