WPA2 Enterprise connection

User avatar
RavenHawk
Posts: 2
Joined: Tue Nov 14, 2017 10:30 pm

Re: WPA2 Enterprise connection

Postby RavenHawk » Wed Feb 21, 2018 10:24 pm

Oh, I might know why some got it to work. Those that have it working, could you please confirm that instead of Arduino IDE https://github.com/espressif/arduino-esp32, you use the official ESP-IDF https://github.com/espressif/esp-idf?
"That engineer guy"

averri
Posts: 1
Joined: Fri May 04, 2018 10:56 am

Re: WPA2 Enterprise connection

Postby averri » Fri May 04, 2018 11:40 am

I have the same issue to connect the ESP32 to the WiFi using WPA2 Enterprise (PEAP). This connection does not use certificates, it just need the identity and password. The code I'm using is the one bellow:

Code: Select all

/*
 *  This example shows how to use WPA2 enterprise
 *  Written by: Jeroen Beemster
 *  12 July 2017
 *  Version 1.00
 */
#include "esp_wpa2.h"
#include <WiFi.h>

const char *ssid = "MySSID"; // The SSID
#define EAP_ID "MyID"  // This is the identity, the email address in my network.
#define EAP_USERNAME "myUsername" // Tried with or without it, without success.
#define EAP_PASSWORD "MyPassword"

void setup()
{
    Serial.begin(9600);
    delay(10);

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

    // WPA2 enterprise magic starts here
    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_wifi_sta_wpa2_ent_enable(&config);
    // WPA2 enterprise magic ends here
   
    delay(100);

    WiFi.begin(ssid);

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

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

int value = 0;
const char *host = "lora.beemster.biz";

void loop()
{
    delay(5000);
    ++value;

    Serial.print("connecting to ");
    Serial.println(host);

    WiFiClient client;
    if (!client.connect(host, 80))
    {
        Serial.println("connection failed");
        return;
    }

    // We now create a URI for the request
    String url = "/wpa2successmesage.php";

    Serial.print("Requesting URL: ");
    Serial.println(url);

    // This will send the request to the server
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Connection: close\r\n\r\n");
    unsigned long timeout = millis();
    while (client.available() == 0)
    {
        if (millis() - timeout > 5000)
        {
            Serial.println(">>> Client Timeout !");
            client.stop();
            return;
        }
    }

    // Read all the lines of the reply from server and print them to Serial
    while (client.available())
    {
        String line = client.readStringUntil('\r');
        Serial.print(line);
    }

    Serial.println();
    Serial.println("closing connection");
}



The ESP32 gives the following error:

Code: Select all

(1155) wpa: Method private structure allocated failure

Who is online

Users browsing this forum: No registered users and 4 guests