Skip to content

WPA2 Enterprise PEAP-MSCHAPv2 not working #1381

Closed
@averri

Description

@averri

Hardware:

Board: esp32dev
Core Installation/update date: 04/05/2018
IDE name: Platform.io
Flash Frequency: 80Mhz
Upload Speed: 115200

Description:

The ESP32 cannot connect to WiFi using WPA2 Enterprise PEAP/MSCHAPv2. There is an error message reported, please see below.

Error messages when executing the sketch:

.E (3449) wpa: Method private structure allocated failure

..E (7006) wpa: Method private structure allocated failure

..E (10559) wpa: Method private structure allocated failure

Sketch:

#include "esp_wpa2.h"
#include <WiFi.h>

const char *ssid = "mySSID";
#define EAP_ID "myID"
#define EAP_USERNAME ""
#define EAP_PASSWORD "myPassword"

void setup() {

    Serial.begin(9600);
    delay(10);

    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.disconnect(true);
    
    esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_ID, strlen(EAP_ID));
    //esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_USERNAME, strlen(EAP_USERNAME));
    esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD));

    esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT(); 
    esp_err_t code = esp_wifi_sta_wpa2_ent_enable(&config);

    Serial.print("Code: ");
    Serial.println(code);
    
    WiFi.begin(ssid);

    while (WiFi.status() != WL_CONNECTED) {
        delay(2000);
        Serial.print(".");        
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}

void loop() {
    // Your code here.
}

Debug Messages:

Connecting to mySSID
[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 2 - STA_START
Code: 0
.E (3569) wpa: Method private structure allocated failure

.[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:298] _eventCallback(): Reason: 2 - AUTH_EXPIRE
.E (7118) wpa: Method private structure allocated failure

[D][WiFiGeneric.cpp:293] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:298] _eventCallback(): Reason: 2 - AUTH_EXPIRE
..E (10691) wpa: Method private structure allocated failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions