WPA2 Enterprise connection

hesseltjeerdsma
Posts: 3
Joined: Fri Sep 22, 2017 2:27 pm

WPA2 Enterprise connection

Postby hesseltjeerdsma » Fri Sep 22, 2017 2:37 pm

Hello!

I am trying to connect my esp32 to a WPA enterprise network (eduroam), but cannot get it to work. I am using the arduino IDE version 1.8.4 and the code below:
*
* 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 = "eduroam"; // your ssid
#define EAP_ID "youruserid"
#define EAP_USERNAME "youruserid" //removed for obvious reasons
#define EAP_PASSWORD "yourpassword"

void setup() {
Serial.begin(115200);
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_wifi_sta_wpa2_ent_enable();
// WPA2 enterprise magic ends here


WiFi.begin(ssid);

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

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

}



/*
* everyhting below this, in loop(), is just a standard request to a webserver and nothing else than an example to show that is works.
*
*/

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");
}

I get these errors:

C:\Users\s161743\Documents\Arduino\sketch_sep22a\sketch_sep22a.ino: In function 'void setup()':

sketch_sep22a:29: error: too few arguments to function 'esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t*)'

esp_wifi_sta_wpa2_ent_enable();

^

In file included from C:\Users\s161743\Documents\Arduino\sketch_sep22a\sketch_sep22a.ino:8:0:

C:\Users\s161743\Documents\Arduino\hardware\espressif\esp32/tools/sdk/include/esp32/esp_wpa2.h:45:11: note: declared here

esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t *config);

^

Multiple libraries were found for "WiFi.h"
Used: C:\Users\s161743\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Using library WiFi at version 1.0 in folder: C:\Users\s161743\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
exit status 1
too few arguments to function 'esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t*)'


Can somebody please help me fix this?

Thanks!

vash993
Posts: 1
Joined: Mon Sep 25, 2017 7:10 am

Re: WPA2 Enterprise connection

Postby vash993 » Mon Sep 25, 2017 7:14 am

If you have multiple libraries installed, the compiler doesn't know which one to choose.

A definite fix is removing the other libraries and keep only the esp32 (I tried it and your code compiling fine on my system).

But if there are any ways to keep all libraries I would like to know how too.

hesseltjeerdsma
Posts: 3
Joined: Fri Sep 22, 2017 2:27 pm

Re: WPA2 Enterprise connection

Postby hesseltjeerdsma » Mon Sep 25, 2017 8:51 am

Hello,

I tried removing the wifi-library but was not able to compile the code. I still got the error:

sketch_sep25a:29: error: too few arguments to function 'esp_err_t esp_wifi_sta_wpa2_ent_enable(const esp_wpa2_config_t*)'

What versions of each libraries are you using? Could you also please send a link where I can find your version?

Thanks!

hesseltjeerdsma
Posts: 3
Joined: Fri Sep 22, 2017 2:27 pm

Re: WPA2 Enterprise connection

Postby hesseltjeerdsma » Mon Sep 25, 2017 9:09 am

I solved it by replacing:

esp_wifi_sta_wpa2_ent_enable();

with:
esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT();
esp_wifi_sta_wpa2_ent_enable(&config);

I also added my university email as EAP id, then I was able to connect.

andrew.from.pretoria
Posts: 2
Joined: Tue Oct 24, 2017 10:01 am

Re: WPA2 Enterprise connection

Postby andrew.from.pretoria » Tue Oct 24, 2017 10:06 am

This worked for me too. Thank you!
I set my email address for both EUP_ID and EAP_USERNAME.
I also had to reset the ESP32 devboard a number of times to get a successful association....

gwhizz
Posts: 2
Joined: Tue Nov 14, 2017 1:41 pm

Re: WPA2 Enterprise connection

Postby gwhizz » Tue Nov 14, 2017 2:17 pm

Hello

I'm struggling to connect to my university eduroam network with the code provided. I see my esp32 devices rebooting constantly with the error:

Guru Meditation Error of type LoadProhibited occurred on core 1. Exception was unhandled.
Register dump: blah blah blah etc

Rebooting...

Just in case the looping was a power issues, I've tried using a 2A power supply and it still does the boot loop.

Usually the reboot occurs after 2 dots during while (WiFi.status() != WL_CONNECTED) loop - meaning after 1 second.
But occasionally I see three dots. That's why I suspected something like power issues...

My laptop and phone both connect fine, the connection details say that eduroam authentication is Tunnelled TLS and inner authentication is MSCHAPv2, and that no CA certificate is required.

Any ideas what I'm doing wrong? Why the constant rebooting?

Thanks!

Bradders
Posts: 1
Joined: Wed Jan 10, 2018 1:59 pm

Re: WPA2 Enterprise connection

Postby Bradders » Wed Jan 10, 2018 2:01 pm

I'm having the same problems as gWhizz. Any help would be GREAT!!!

Thanks,
Bradders

asad786r
Posts: 3
Joined: Tue Jan 09, 2018 8:35 pm

Re: WPA2 Enterprise connection

Postby asad786r » Thu Jan 11, 2018 2:28 pm

i am having the same problem as gwizz also, any help would be appriciated

gwhizz
Posts: 2
Joined: Tue Nov 14, 2017 1:41 pm

Re: WPA2 Enterprise connection

Postby gwhizz » Mon Feb 05, 2018 11:45 am

Just to say that I've struggled again with this, but still no joy.

What am I doing differently to those who have got a connection?!?

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

Re: WPA2 Enterprise connection

Postby RavenHawk » Thu Feb 15, 2018 8:14 am

Same problem as gwhizz. Core Debug Level: "Verbose". Serial reads:

Code: Select all

Connecting to ssid-example
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 2 - STA_START
.Guru Meditation Error: Core  1 panic'ed (LoadProhibited)
. Exception was unhandled.
Register dump:
PC      : 0x4012b75d  PS      : 0x00060530  A0      : 0x8012c4c4  A1      : 0x3ffdbaa0  
A2      : 0x3ffcccac  A3      : 0x00000001  A4      : 0x3ffdf6fc  A5      : 0x3ffdf6fb  
A6      : 0x00000002  A7      : 0x00000005  A8      : 0x8012b75b  A9      : 0x3ffdba80  
A10     : 0x00000000  A11     : 0x00000008  A12     : 0x3ffcccac  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000010  SAR     : 0x00000018  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000001  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  

Backtrace: 0x4012b75d:0x3ffdbaa0 0x4012c4c1:0x3ffdbac0 0x40127a3a:0x3ffdbae0 0x400dcf6d:0x3ffdbb10 0x400dd153:0x3ffdbbc0 0x400d9f66:0x3ffdbc90 0x400da34d:0x3ffdbcd0 0x400d95f1:0x3ffdbd50 0x400d9078:0x3ffdbda0 0x400d90d1:0x3ffdbde0 0x400d77d4:0x3ffdbe00 0x400d6f72:0x3ffdbe40 0x400d55b5:0x3ffdbea0 0x400d590d:0x3ffdbee0

Rebooting...
Arduino 1.8.5, WiFi 1.2.7, newest espressif libraries (i think). Trying to connect to a normal WPA2 doesn't crash it.

Found something in parallel to the topic, perhaps a working alternative:
https://github.com/espressif/esp-idf/bl ... ise_main.c

Tried commenting out:

Code: Select all

//wifi_config_t wifi_config = ...

Code: Select all

//ESP_ERROR_CHECK( esp_wifi_set_config(...

Code: Select all

//ESP_LOGI(TAG, ...


but got stuck with:

Code: Select all

In function 'void wpa2_enterprise_example_task(void*)':

PEAPtest4:133: error: cannot convert 'esp_interface_t' to 'tcpip_adapter_if_t' for argument '1' to 'esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t, tcpip_adapter_ip_info_t*)'

         if (tcpip_adapter_get_ip_info(ESP_IF_WIFI_STA, &ip) == 0) {

                                                           ^

exit status 1
cannot convert 'esp_interface_t' to 'tcpip_adapter_if_t' for argument '1' to 'esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t, tcpip_adapter_ip_info_t*)'
"Ukranian computer engineer"

Who is online

Users browsing this forum: No registered users and 96 guests