Skip to content

WeMos D1 will not connect to WPA2-Enterprise AP and throws IllegalInstructionCause before wdt reset #4132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kfried opened this issue Jan 10, 2018 · 0 comments

Comments

@Kfried
Copy link

Kfried commented Jan 10, 2018

I'm having no luck whatsoever connecting to our WiFi WPA2 Enterprise network. I've tried everything I can think of, I thought it may be an issue with the WDT but I'm not so sure. I have stack trace but I'm not confident in understanding it. Please if anyone can see something that I cannot then let me know. Many thanks

Hardware

Hardware: WeMos D1 Mini
Core Version: 2.4.0

Description

When I run the code the only output I get is :
Attempting connection
Wifi station connect status: ConnectionLost
ConnectionLost
...
Exception (0):
epc1=0x74754120 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3ffffb80 end: 3fffffb0 offset: 01a0

Sketch

#include <ESP8266WiFi.h>
#include "user_interface.h"
#include "wpa2_enterprise.h"

const int RED_LIGHT = 4;
const int GREEN_LIGHT = 5;


void setup() {
  pinMode(LED_BUILTIN, OUTPUT);   
  pinMode(GREEN_LIGHT, OUTPUT); 
  pinMode(RED_LIGHT, OUTPUT);

  Serial.begin(115200);
  

  //Set D1 to station mode
  wifi_set_opmode(0x01);
 
  //connect
  wdt_disable();
  wdt_enable(WDTO_8S);
  
  set_station_config();
  
  bool availableNetworks = CheckNetworksAvailable();
  
  connect_to_network();
  
  int errorTryCount=0;
  String currentStatus ="";
  String statusRecord="";
  
  while(WiFi.status() != WL_CONNECTED){
    wdt_reset();
    Inialising();
    currentStatus = ConnectionStatusString();
    if(statusRecord==""){
     statusRecord = currentStatus;
     Log(currentStatus);
    }
    if(currentStatus==statusRecord){
      LogInline(".");
      errorTryCount++;
      if(errorTryCount==100)
      {
        errorTryCount=0;
        Log("Reconnect Attempt");
        connect_to_network();
      }
    }
    else
      {
        Log(currentStatus);
        statusRecord=currentStatus;
      }
    delay(10);
  }
  
  void set_station_config(void)
{
  char ssid[32]="xxxxxx";
  char username[64] ="xxxxxx";
  static const char* password = "xxxxxx";

  struct station_config stationConf;
  os_memcpy(&stationConf.ssid,  ssid, 32);
  wifi_station_set_config(&stationConf);

  //wifi_station_clear_cert_key();
  //wifi_station_clear_enterprise_ca_cert();

  wifi_station_set_wpa2_enterprise_auth(1);
  wifi_station_set_enterprise_username((uint8*)username, strlen(username));
  wifi_station_set_enterprise_password((uint8*)password, strlen(password));
    
}
 
 void connect_to_network(){
  Log("Attempting connection"); 
  wifi_station_connect();
  Serial.print("Wifi station connect status: ");
  Serial.println(ConnectionStatusString());
}

bool CheckNetworksAvailable()
{
  Log("Scanning for Networks");
  int n = WiFi.scanNetworks();
  if(n==0){
    Log("No networks found");
    return false;
  }
  else{
    Log("Networks are available");
    Log("Networks seen:");
    for(int thisNet = 0; thisNet<n; thisNet++){
      String netCount = String(thisNet);
      String logString =netCount+") Network: "+WiFi.SSID(thisNet);
      Log(logString);

    }
    return true;
  }
 }

Debug Messages

3ffffd20:  2d207974 4b314c20 0000202c 3fff4d46  
3ffffd30:  3fff5187 3fff4d4a 00010030 00000010  
3ffffd40:  00000551 3fff4d4a 3fff651c 4022ac5b  
3ffffd50:  3fff2ac8 00000555 3fff4d46 a4cf820e  
3ffffd60:  40229837 3fff2954 00000000 3ffffdd0  
3ffffd70:  40211f1c 3fff4d46 00000000 00000555  
3ffffd80:  3fff2ac8 0000140e 3fff614e 3fff614a  
3ffffd90:  40229fae 00000016 3fff2954 3ffffdd0  
3ffffda0:  0000146f 00000000 3fff2954 00001420  
3ffffdb0:  3fff4d3c 40228e53 3fff2954 3fff4d3c  
3ffffdc0:  3fff614e 3fff26b8 00000000 40228dec  
3ffffdd0:  00001412 0000064c 00000016 3ffffe30  
3ffffde0:  3ffffe38 00000000 3ffffe34 4022889c  
3ffffdf0:  3ffffe70 3fff2714 3fffff10 00000000  
3ffffe00:  3fff2958 3fff4d3c 3fff2a48 3fff4d27  
3ffffe10:  3fff4d3c 3fff3907 00001417 3fff38b8  
3ffffe20:  00000000 3ffee440 3ffef5c8 40223fb6  
3ffffe30:  00000000 3fff285c 000000dd 3ffffe60  
3ffffe40:  40226bde 4022885c 3fff285c 3fffff10  
3ffffe50:  40226c57 3fff285c 3fff2714 00000100  
3ffffe60:  000000dd 000000dd 3fff37be 00000000  
3ffffe70:  00000000 3ffffec8 40226dca 3fff285c  
3ffffe80:  3fff38ac 013595a5 3fff2714 3ffffec0  
3ffffe90:  0000001d 00000001 00000019 3fff2714  
3ffffea0:  00000000 3ffffec8 40226324 3fff285c  
3ffffeb0:  000000dd 3ffffec8 0000000e ffffffff  
3ffffec0:  000000dd 00000001 00000000 00000000  
3ffffed0:  feefeffe 3fff02e0 3fff02e0 fffffffe  
3ffffee0:  000000fb 3fff1c0c 3fff37be 3fff37b8  
3ffffef0:  0000001d 40224c89 3fff2714 3fff37ac  
3fffff00:  3fff37b8 3ffef5c8 000000e3 3fff37ac  
3fffff10:  00000000 00000003 00000000 00000001  
3fffff20:  00000019 3fff37ac 40224d39 ffffffff  
3fffff30:  3ffeed7c 00000008 ffffffff 3ffeed7c  
3fffff40:  3fff2714 4021c7a3 3ffee440 3fff37ac  
3fffff50:  3ffeb8d0 0000010d 00000000 00000022  
3fffff60:  00000002 0000001a 40230543 3ffee440  
3fffff70:  3ffeb8c4 3fffdcc0 3ffeaa60 3ffeaa60  
3fffff80:  00000080 3ffee440 00000000 3fff0590  
3fffff90:  4022fe1f 3fffdab0 00000000 40203443  
3fffffa0:  3ffeaa60 40000f49 3fffdab0 40000f49 

0x4022ac5b: tls_parse_cert at ?? line ?
0x40229837: tlsv1_client_set_time_checks at ?? line ?
0x40211f1c: crypto_hash_update at ?? line ?
0x40229fae: tlsv1_client_process_handshake at ?? line ?
0x40228e53: tlsv1_client_handshake at ?? line ?
0x40228dec: tlsv1_client_handshake at ?? line ?
0x4022889c: tls_connection_handshake2 at ?? line ?
0x40223fb6: wpabuf_resize at ?? line ?
0x40226bde: eap_peer_tls_derive_session_id at ?? line ?
0x4022885c: tls_connection_handshake at ?? line ?
0x40226c57: eap_peer_tls_derive_session_id at ?? line ?
0x40226dca: eap_peer_tls_process_helper at ?? line ?
0x40226324: wpa2_get_time at ?? line ?
0x40224c89: eap_sm_process_request at ?? line ?
0x40224d39: wpa2_sm_rx_eapol at ?? line ?
0x4021c7a3: sta_input at ?? line ?
0x40230543: pp_tx_idle_timeout at ?? line ?
0x4022fe1f: ppPeocessRxPktHdr at ?? line ?
0x40203443: loop_task 
@d-a-v d-a-v changed the title WeMos D1 will not connect to AP and throws IllegalInstructionCause before wdt reset WeMos D1 will not connect to WPA2-Enterprise AP and throws IllegalInstructionCause before wdt reset Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant