esp-idf: SmartConfig not working (IDFGH-3247)
I’ve tried as many things as I can but still can’t get SmartConfig to work. Are there any known issues I should be aware of?
IDF v4.2 Latest ESPTOUCH from Google Play store. ESP32 WROOM.
It appears to find the app ok and tries to retrieve the SSID and password (it’s a 2.4G network), but the debug is not helpful. Should I be seeing the individual characters of the SSID and password coming in?
Here’s the log of a few attempts:
D (00:00:00.890) WIFI: WIFI_EVENT_STA_START
I (2141) smartconfig: SC version: V2.9.0
I (5281) wifi:ic_enable_sniffer
I (5291) smartconfig: Start to find channel...
I (10171) smartconfig: T|once 1 80
I (10171) smartconfig: save rssi:-77 ,bssid:1c:b7:2c:c1:0a:60
I (10171) smartconfig: iCh lock
I (10731) smartconfig: confirm rssi:-77, bssid:1c:b7:2c:c1:0a:60
I (10731) smartconfig: TYPE: ESPTOUCH
I (10741) smartconfig: T|sniffer on ch:2,width:0
I (10741) smartconfig: T|AP MAC: 1c:b7:2c:c1:0a:60
I (10741) smartconfig: T|Head Len:80
I (10741) smartconfig: Found channel on 2-0. Start to get ssid and password...
I (10751) smartconfig: T|SYNC STATUS
I (12251) smartconfig: T|1-7
I (13481) smartconfig: T|32-3
I (13861) smartconfig: T|
-38
I (14461) smartconfig: T|--30
I (19671) smartconfig: T|I-9
I (44551) smartconfig: T|n-24
I (51021) smartconfig: T|:-70
I (56741) wifi:ic_disable_sniffer
I (56741) smartconfig: smartconfig restart
I (56791) smartconfig: SC version: V2.9.0
I (59931) wifi:ic_enable_sniffer
I (59941) smartconfig: Start to find channel...
I (103881) smartconfig: T|once 1 80
I (103881) smartconfig: save rssi:-75 ,bssid:1c:b7:2c:c1:0a:60
I (103881) smartconfig: confirm rssi:-75, bssid:1c:b7:2c:c1:0a:60
I (103881) smartconfig: TYPE: ESPTOUCH
I (103891) smartconfig: T|sniffer on ch:2,width:0
I (103891) smartconfig: T|AP MAC: 1c:b7:2c:c1:0a:60
I (103891) smartconfig: T|Head Len:80
I (103901) smartconfig: Found channel on 2-0. Start to get ssid and password...
I (103901) smartconfig: T|SYNC STATUS
I (119161) smartconfig: T|1-7
I (120691) smartconfig: T|e-15
I (130831) smartconfig: T|-34
I (149891) wifi:ic_disable_sniffer
I (149891) smartconfig: smartconfig restart
I (149941) smartconfig: SC version: V2.9.0
I (153081) wifi:ic_enable_sniffer
I (153091) smartconfig: Start to find channel...
I (176011) smartconfig: T|once 1 80
I (176011) smartconfig: save rssi:-84 ,bssid:1c:b7:2c:c1:0a:60
I (176011) smartconfig: confirm rssi:-84, bssid:1c:b7:2c:c1:0a:60
I (176011) smartconfig: TYPE: ESPTOUCH
I (176011) smartconfig: T|sniffer on ch:2,width:0
I (176021) smartconfig: T|AP MAC: 1c:b7:2c:c1:0a:60
I (176021) smartconfig: T|Head Len:80
I (176031) smartconfig: Found channel on 2-0. Start to get ssid and password...
I (176031) smartconfig: T|SYNC STATUS
I (179131) smartconfig: T|�-42
I (192881) smartconfig: T|1-7
I (210391) smartconfig: T|I-9
I (222011) wifi:ic_disable_sniffer
I (222011) smartconfig: smartconfig restart
I (222061) smartconfig: SC version: V2.9.0
I (225201) wifi:ic_enable_sniffer
I (225211) smartconfig: Start to find channel...
I (227981) smartconfig: T|once 1 80
I (227981) smartconfig: save rssi:-83 ,bssid:1c:b7:2c:c1:0a:60
I (227981) smartconfig: confirm rssi:-83, bssid:1c:b7:2c:c1:0a:60
I (227981) smartconfig: TYPE: ESPTOUCH
I (227981) smartconfig: T|sniffer on ch:2,width:0
I (227991) smartconfig: T|AP MAC: 1c:b7:2c:c1:0a:60
I (227991) smartconfig: T|Head Len:80
I (228001) smartconfig: Found channel on 2-0. Start to get ssid and password...
I (228001) smartconfig: T|SYNC STATUS
I (255571) smartconfig: T|L-28
I (256231) smartconfig: T|8-1
I (257701) smartconfig: T|162-8
I (260821) smartconfig: T|a-24
I (262001) smartconfig: T|1-7
I (266641) smartconfig: T|-31
I (269981) smartconfig: T|,-33
I (273981) wifi:ic_disable_sniffer
I (273981) smartconfig: smartconfig restart
I (274031) smartconfig: SC version: V2.9.0
I (277171) wifi:ic_enable_sniffer
I (277181) smartconfig: Start to find channel...
And this is my callback, which never gets called:
esp_event_handler_register(SC_EVENT, SC_EVENT_GOT_SSID_PSWD, _sc_event_handler, NULL);
void Wifi::_sc_event_handler(void *arg, esp_event_base_t base, int32_t event_id, void *data)
{
smartconfig_event_got_ssid_pswd_t *evt = (smartconfig_event_got_ssid_pswd_t *)data;
uint8_t ssid[33] = { 0 };
uint8_t password[65] = { 0 };
uint8_t cellphone_ip[4];
esp_err_t err = ESP_OK;
memcpy(ssid, evt->ssid, sizeof(evt->ssid));
memcpy(password, evt->password, sizeof(evt->password));
memcpy(cellphone_ip, evt->cellphone_ip, sizeof(evt->cellphone_ip));
ESP_LOGD(LOG_TAG, "SSID:%s", ssid);
ESP_LOGD(LOG_TAG, "PASSWORD:%s", password);
ESP_LOGD(LOG_TAG, "Phone ip: %d.%d.%d.%d\n", cellphone_ip[0], cellphone_ip[1], cellphone_ip[2], cellphone_ip[3]);
err = sc_send_ack_start(evt->type, evt->token, evt->cellphone_ip);
if (err != ESP_OK) {
ESP_LOGE(LOG_TAG, "Send smartconfig ACK error: %d", err);
}
memcpy(wifi_config.sta.ssid, ssid, sizeof(ssid));
memcpy(wifi_config.sta.password, password, sizeof(password));
xEventGroupSetBits(event_group, WIFI_SC_DONE_BIT);
}
Note, if I don’t use smartconfig, and hard code the SSID and password, the ESP32 connects and works as expected.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 32 (18 by maintainers)
DONE IT!!! Oh my gosh…
Mode MUST be set to
LEGACY.AutoandN Onlydo not work, at least not for me. Would be interested if that is the same for you, or whether I just got lucky then?I know this is closed, but there are still isolated cases of this that occur.
I had an Apple Airport Extreme router which worked fine all the with a Smartconfig app I found called IOT Config. The Airport did not work with ESP8266 Smartconfig because that tool auto-selects the SSID and always chose the 5GHz SSID of the router, and won’t let you change it. I recently replaced the Apple with a TP-Link AC4000 wireless router and suddenly my IOT Config app stopped working. There are no settings for TP-Link router that say “legacy” for wireless mode. I was going to start playing with various settings, but then on a lark, decided to try the ESP8266 Smartconfig app again). In this case, the ESP8266, luckily, selected the 2.4G SSID of my new router and it performed the smartconfig successfully. So it worked… in this special case under these special circumstances.
I suppose there are particular wireless settings to use and/or avoid for smart config to work properly. Although it is odd that the ESP8266 Smartconfig worked but the IOT Config app did not using the same router settings.
And, @howroyd just want to say, I love your YT ESP32 videos!
Yes, my setting is
legacy. Yesterday I always failed to upload pictures, so I did not provide the configuration here.Correct! I will analyze the captures tomorrow, thanks !
@howroyd I did another test using Android phone and the same app you mentioned above and it worked. Then tried “ESP8266 SmartConfig” (also from Play Store) and it worked as well.
Hi @howroyd to troubleshoot the same code, have you tried to run unmodified smart_config example? It works for me and SSID / password are reterived. The difference is that I am using “EspTouch” App on iPhone.