Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Joseph!
#66574 Dear all,

I have to connect an ESP8266 to a WPA2 enterprise network with EAP TLS authentication. I used the Arduino IDE several months ago, but I have some doubts on it.

First, I had a link in the File > Preferences > Board Manager URL that seems not to work:

http://arduino.esp8266.com/package_esp8 ... index.json

And I updated to this one:

http://arduino.esp8266.com/versions/2.3 ... index.json

I don't think my problem comes from that, but I comment it before explaining my problem.

My problem is that I have seen that there are new versions of the libraries, and in the latest ones I have to include this:
Code: Select allextern "C" {
#include "wpa2_enterprise.h"
}

In order to use this:
Code: Select allwifi_station_set_enterprise_username()
wifi_station_set_enterprise_cert_key()


Which I think I should use. Now I am using the deprecated functions wifi_station_set_username and wifi_station_set_cert_key...

When I try to compile I get an error:

Code: Select all23:29: fatal error: wpa2_enterprise.h: No such file or directory

 #include "wpa2_enterprise.h"

                             

compilation terminated.

exit status 1
Error compilación en tarjeta Generic ESP8266 Module.


How can I update the library, do I have to download it and include in the Arduino IDE? I thought it was automatically updated with the link I set in the preferences...

I think my error is in the very beginning and is basic, but I don't know and I don't have anybody to ask...

Sorry if it is a very basic issue, but I would appreciate any help.

I had the ESP8266-E12 board connected to the WPA2 Enterprise working, but now I have to install the program in new boards, WT8266-S1, but the guys who sold me them told me that they were an ESP8266-E12 Chip, so I thought it would be just to load the program, but I don't achieve to connect to the Wifi network...

Best regards,
Joseph!
User avatar
By QuickFix
#66608 You'd better get the latest version of the ESP8266 libraries using GitHub; the latest "Board manager release" is from June 2016 and is outdated and missing some features.

Just go to the 8266 core GitHub-page and follow the directions under "•Installing options: Using git version" :idea:
User avatar
By penright
#72040
Joseph! wrote:When I try to compile I get an error:
Code: Select all23:29: fatal error: wpa2_enterprise.h: No such file or directory
 #include "wpa2_enterprise.h"
compilation terminated.



@Joseph! Did you get it to work?

QuickFix wrote:You'd better get the latest version of the ESP8266 libraries using GitHub; the latest "Board manager release" is from June 2016 and is outdated and missing some features.
Just go to the 8266 core GitHub-page and follow the directions under "•Installing options: Using git version" :idea:

I have version 2.3.0.
I found this post https://www.hallgeirholien.no/post/esp8266-eap/.
He has the following steps in linux ...
Code: Select allcd /home/username/.arduino15/packages/esp8266/hardware
mv esp8266 original_esp8266
git clone https://github.com/esp8266/Arduino.git esp8266
cd esp8266
git checkout update_sdk_2.0.0
cd tools
python get.py
cd ../..
cp -r original_esp8266/2.3.0 esp8266/

Looking at his instructions, I guessing the WPA2_Enterprise is in the (update_sdk_2.0.0) branch and that branch has not been merged into the master (2.3.0) yet.

So I am trying to convert them to windows steps
Looking at the steps, looks like he save the ESP2866 lib (C:\Users\UserName\AppData\Local\arduino15\packages\esp8266) to (C:\Users\UserName\AppData\Local\arduino15\packages\original_esp8266).
Then he put's down the (update 2.0.0) and overwrites it with (master 2.3.0).

This is where I am lost ...
Looking at the zip package, I not sure what I need out of it. I have not found a pattern of the zip file to packages directory.

Am I going down the wrong path? Is there an easier way?
User avatar
By penright
#72042 Not sure if there is a easier way, but I was able to compile using https://www.hallgeirholien.no/post/esp8266-eap/ instruction for updated 2.0.0 in a windows environment.
The trick was installing Git for windows. https://git-for-windows.github.io/ When you run that you get a linux terminal.

Once that was done two things. One windows c:\ is /c/ and the home directory is "C:\Users\UserName\AppData\Local" where UserName is your logged on user name.


Once Git is installed you get a linux window. Here is a screen shot of me running it in the git window.....
Code: Select allUserName@penright MINGW64 ~/AppData/Local/arduino15/packages/esp8266
$ cd /c/Users/UserName/AppData/Local/arduino15/packages/esp8266/hardware

UserName@penright MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$ ls
esp8266/

UserName@penright MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$ mv esp8266 original_esp8266

UserName@penright MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$ git clone https://github.com/esp8266/Arduino.git esp8266
Cloning into 'esp8266'...
remote: Counting objects: 15382, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15382 (delta 6), reused 9 (delta 4), pack-reused 15362
Receiving objects: 100% (15382/15382), 39.34 MiB | 659.00 KiB/s, done.
Resolving deltas: 100% (8868/8868), done.

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$ cd esp8266

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware/esp8266 (master)
$ git checkout update_sdk_2.0.0
Switched to a new branch 'update_sdk_2.0.0'
Branch 'update_sdk_2.0.0' set up to track remote branch 'update_sdk_2.0.0' from 'origin'.

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware/esp8266 (update_sdk_2.0.0)
$ cd tools

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/tools (update_sdk_2.0.0)
$ python get.py
Platform: i686-mingw32
Downloading esptool-0.4.9-win32.zip
Done
Extracting dist/esptool-0.4.9-win32.zip
Renaming esptool-0.4.9-win32/ to esptool
Downloading win32-xtensa-lx106-elf-gb404fb9-2.tar.gz
Done
Extracting dist/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz
Downloading mkspiffs-0.1.2-windows.zip
Done
Extracting dist/mkspiffs-0.1.2-windows.zip
Renaming mkspiffs-0.1.2-windows/ to mkspiffs

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/tools (update_sdk_2.0.0)
$ cd ../..

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$ cp -r original_esp8266/2.3.0 esp8266/

UserName@ComputerName MINGW64 ~/AppData/Local/arduino15/packages/esp8266/hardware
$


Now I can compile without errors, but still not connecting.

Here is my code that is NOT working ....
Code: Select allextern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

// SSID to connect to
static const char* ssid = "SSIDName";
// Username for authentification
static const char* username = "UserName";
// Password for authentification
static const char* password = "Password";
const int ledPin = 0;

void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);

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

wifi_station_disconnect();
struct station_config wifi_config;

memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char*)wifi_config.ssid, ssid);
strcpy((char*)wifi_config.password, password);
wifi_station_set_config(&wifi_config);



//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));
wifi_station_connect();


Serial.print("Status: ");
Serial.println(wifi_station_get_connect_status());


// Wait for connection AND IP address from DHCP
while (WiFi.status() != WL_CONNECTED) {
delay(2000);
Serial.println(WiFi.localIP());

}

} // setup



void loop() {

}


It keeps looping in the while (WiFi.status() != WL_CONNECTED) section displaying the IP 0.0.0.0.