ESP8266 not getting DHCP IP Address from Cisco AP
Posted: Thu Sep 21, 2017 9:38 am
We have been using the ESP8266 for an IoT product for some time but recently we have one customer who has a Cisco AIR-LAP1142N-A-K9 Aironet 1142 Controller-based AP. When my device tries to connect, it succeeds in connecting but does not get an IP address. The same program can connect to other APs in the same location but different models - non Cisco. We tried to connect to all 3 of the Cisco routers in the building on different channels with the same results. I only have access to the router settings if I have a specific question (I can't get a dump of the settings). I do have one of the same model of routers on order to try to duplicate the problem. I have searched for hours and tried everything I found to try with no good results.
I have two questions.
* Any ideas what might be causing it that I can try or questions I can ask to help narrow it down?
* Where can I find what the little details in the debug output mean like state: 0 -> 2 (b0). See below. I am digging into the source code now but some direction would be helpful.
I am compiling this with the Arduino Genuino IDE version 1.6.12 and ESP8266 Community version 2.3.0.
Module: Generic ESP8266 Module
Flash Size: 4MB/1MB
CPU Frequency: 80Mhz
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: ck
The security on the routers is WPA2
Here is the debug and log output:
Connecting to CiscoAP
..scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 14
cnt
connected with CiscoAP, channel 1
dhcp client start...
wifi evt: 0
WIFI_EVENT_STAMODE_CONNECTED
........state: 5 -> 0 (0)
rm 0
wifi evt: 1
STA disconnect: 8
WiFi lost connection
f r0, ..scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 14
cnt
connected with CiscoAP, channel 1
dhcp client start...
wifi evt: 0
WIFI_EVENT_STAMODE_CONNECTED
..........pm open,type:2 0
.........................
Which is generated from a very simplified program I created to make sure I was not doing something in the larger program to cause it:
#include <ESP8266WiFi.h>
const char* ssid = "CiscoAP";
const char* password = "xxxxxx";
#define DEBUG_PRINT(x) Serial.println(x)
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.onEvent(WiFiEvent);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
}
int value = 0;
void loop() {
delay(500);
++value;
if (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
else{
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
if(value==10)
{
WiFi.disconnect();
delay(1000);
WiFi.begin(ssid, password);
}
}
void WiFiEvent(WiFiEvent_t event) {
IPAddress ip_addr;
switch(event) {
case WIFI_EVENT_STAMODE_CONNECTED:
DEBUG_PRINT("WIFI_EVENT_STAMODE_CONNECTED");
break;
case WIFI_EVENT_STAMODE_DISCONNECTED:
DEBUG_PRINT("WiFi lost connection");
break;
case WIFI_EVENT_STAMODE_AUTHMODE_CHANGE:
DEBUG_PRINT("WIFI_EVENT_STAMODE_AUTHMODE_CHANGE");
break;
case WIFI_EVENT_STAMODE_GOT_IP:
DEBUG_PRINT("WiFi connected GOTIP");
break;
default:
DEBUG_PRINT("[WiFi-event] can not recognize event: " + String(event));
break;
}
}
Thanks!
I have two questions.
* Any ideas what might be causing it that I can try or questions I can ask to help narrow it down?
* Where can I find what the little details in the debug output mean like state: 0 -> 2 (b0). See below. I am digging into the source code now but some direction would be helpful.
I am compiling this with the Arduino Genuino IDE version 1.6.12 and ESP8266 Community version 2.3.0.
Module: Generic ESP8266 Module
Flash Size: 4MB/1MB
CPU Frequency: 80Mhz
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: ck
The security on the routers is WPA2
Here is the debug and log output:
Connecting to CiscoAP
..scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 14
cnt
connected with CiscoAP, channel 1
dhcp client start...
wifi evt: 0
WIFI_EVENT_STAMODE_CONNECTED
........state: 5 -> 0 (0)
rm 0
wifi evt: 1
STA disconnect: 8
WiFi lost connection
f r0, ..scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 14
cnt
connected with CiscoAP, channel 1
dhcp client start...
wifi evt: 0
WIFI_EVENT_STAMODE_CONNECTED
..........pm open,type:2 0
.........................
Which is generated from a very simplified program I created to make sure I was not doing something in the larger program to cause it:
#include <ESP8266WiFi.h>
const char* ssid = "CiscoAP";
const char* password = "xxxxxx";
#define DEBUG_PRINT(x) Serial.println(x)
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.onEvent(WiFiEvent);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
}
int value = 0;
void loop() {
delay(500);
++value;
if (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
else{
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
if(value==10)
{
WiFi.disconnect();
delay(1000);
WiFi.begin(ssid, password);
}
}
void WiFiEvent(WiFiEvent_t event) {
IPAddress ip_addr;
switch(event) {
case WIFI_EVENT_STAMODE_CONNECTED:
DEBUG_PRINT("WIFI_EVENT_STAMODE_CONNECTED");
break;
case WIFI_EVENT_STAMODE_DISCONNECTED:
DEBUG_PRINT("WiFi lost connection");
break;
case WIFI_EVENT_STAMODE_AUTHMODE_CHANGE:
DEBUG_PRINT("WIFI_EVENT_STAMODE_AUTHMODE_CHANGE");
break;
case WIFI_EVENT_STAMODE_GOT_IP:
DEBUG_PRINT("WiFi connected GOTIP");
break;
default:
DEBUG_PRINT("[WiFi-event] can not recognize event: " + String(event));
break;
}
}
Thanks!