-->
Page 1 of 1

ESP8266 not getting DHCP IP Address from Cisco AP

PostPosted: Thu Sep 21, 2017 9:38 am
by EmbeddedBob
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!

Re: ESP8266 not getting DHCP IP Address from Cisco AP

PostPosted: Fri Sep 22, 2017 11:12 am
by tele_player
Use Wireshark or tcpdump to sniff the DHCP transaction.

Re: ESP8266 not getting DHCP IP Address from Cisco AP

PostPosted: Fri Sep 29, 2017 9:13 am
by EmbeddedBob
More information about the problem.

1. The Cisco 1140 is configured in Autonomous mode meaning it is not using a controller as the configuration entity.

2. If you set the security settings on the Cisco 1140 AP for the SSID to be WPA TKIP only (Not WPA AES+TKIP) the problem we are seeing in the field is reproduced. See screenshot attached.

3. I found an online reference to something that sounded similar with a fix but I cannot figure out how to carry out the fix because I cannot get the commands to work in the console. It is like it is a different OS
http://itsnippet.com/2015/09/18/packet-to-client-xxxx-reached-max-retries/

I am in the process of trying to capture all log messages and packets between the ESP8266 and the AP to help diagnose. I noticed a few posts through searching of people having TKIP problems with no solutions or a solution of going back to 2.0.0.0.

Any ideas would be appreciated.

Re: ESP8266 not getting DHCP IP Address from Cisco AP

PostPosted: Fri Mar 09, 2018 4:16 pm
by EmbeddedBob
So the answer was that the chip does not support WPA TKIP. It acts like it will work but it just does not get an IP address. The failure is not very graceful. So the system thinks it is connected when it is not.

It had nothing to do with the Cisco AP. It was how it was configured. The customer we were demoing to did not like it when we pointed out that the security protocol they were using was deprecated 4 years ago. They did update it several weeks later though.

I did not look into a way to identify this protocol and fail more gracefully. If someone has an idea on how I would do that, I have the prefect environment to give it a try to test.

Thanks.