espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.3k stars 1.57k forks source link

Do not get IP address after call esp_wifi_connect() (GIT8266O-841) #1264

Open ictu-dungnt98 opened 8 months ago

ictu-dungnt98 commented 8 months ago

Environment

Problem Description

I have 2 devices use esp8266 (ESP-12F module). Both of them running same firmware and connect to same wi-fi AP. The application is simple touch switch: button, relay, connect wifi, connect mqtt and get control command from mobie app. Two device running same firmware, working at the same time and monitoring same time on terminal.

The problem is that one of my device do not connect wi-fi AP and do not get IP address but other one work well. I will attach log message bellow. The Red-boundary (I will call as Red) is log message of device got error. The Green-boundary(I will call as Green) is log message of device that work normally, connected wi-fi, get IP address.

I had check device list on router's web manager and saw that both device was allocated IP address. But the "Red" do not get event wi-fi connected like "Green".

WeChat Photo Editor_20240102135700

Expected Behavior

After call esp_wifi_connect(); device connected to wifi AP and got IP address and print message lines:

I (3334) wifi:state: 0 -> 2 (b0) I (3338) wifi:state: 2 -> 3 (0) I (3346) wifi:state: 3 -> 5 (10) I (3382) wifi:connected with Dungnt98 Test, aid = 3, channel 2, HT20, bssid = 14:eb:b6:bf:c7:13 image

Actual Behavior

After call esp_wifi_connect(); device do not get wifi connected and do not get IP address but all other task still work normally.

image

Steps to repropduce

I can not reproduce that error, because after 1 hour my device do connected to Wi-fi and work well.

ictu-dungnt98 commented 8 months ago

I think this issue come from error of Wifi Dirver. It does not success on scan/connection process as describe in document. image