On the ESP8266, we have found that specifying the access point BSSID in the station_config before calling wifi_station_set_config_current() accelerates the connection by about 50%. Further, if we additionally set the channel via wifi_set_channel() after calling wifi_station_set_config_current(), the connection speed is further reduced. We have tested this against multiple access points where we know the BSSID and channel.
When we try the same on ESP32, we don't experience any reduction in connection speed when setting the BSSID and/or channel. And if we set the channel in the wifi_config_t structure, we are unable to connect at all. The Wi-Fi setup and connection code we use on ESP32 is roughly as follows:
- memcpy(config.sta.bssid, bssid, sizeof(config.sta.bssid));
- config.sta.bssid_set = 1;
- memcpy(config.sta.ssid, ssid, strlen(ssid));
- memcpy(config.sta.password, password, strlen(password));
- esp_wifi_set_mode(WIFI_MODE_STA);
- esp_wifi_set_config(WIFI_IF_STA, &config);
- esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
- esp_wifi_connect();
Regards,
Brian