esp8266 / esp8266/Arduino

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

Open
#4,132 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.