ESP8266 Developer Zone The Official ESP8266 Forum 2015-09-10T10:25:17+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1037 2015-09-10T10:25:17+08:00 2015-09-10T10:25:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1037&p=3623#p3623 <![CDATA[Re: Fatal exception (29) while switching to SOFTAP mode from Station]]>
Please have a try with this attachment based on esp_iot_sdk_v1.3.0.

Thanks for your interest in ESP8266 !
SDK1.3.0_ChangeMode_patch01.zip

Statistics: Posted by ESP_Faye — Thu Sep 10, 2015 10:25 am


]]>
2015-08-31T16:27:05+08:00 2015-08-31T16:27:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1037&p=3504#p3504 <![CDATA[Fatal exception (29) while switching to SOFTAP mode from Station]]>
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:

#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.

Statistics: Posted by paritosharya007 — Mon Aug 31, 2015 4:27 pm


]]>