softap channel selection
Posted: Wed Sep 12, 2018 9:12 am
I modified this example to change the wifi channel (I am using it to connect two pc with esp as ap/eth bridge)
Without the channel selection, I get about 3 ms of ping between the two pc and iperf to 30 Mbit/s
With the channel selection ping takes a lot longer and iperf does not work
Looking at here, 9 should be valid: it is channel 11 in 802.11n figure (the wifi dongle says 9/13, as explained by that page)
What is the correct code to select the channel?
Code: Select all
static void initialise_wifi(void)
{
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init_internal(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
#ifdef CONFIG_ETH_TO_STATION_MODE
wifi_config_t wifi_config = {
.sta = {
.ssid = CONFIG_DEMO_SSID,
.password = CONFIG_DEMO_PASSWORD,
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));
#else
wifi_config_t wifi_config = {
.ap = {
.ssid = CONFIG_DEMO_SSID,
.password = CONFIG_DEMO_PASSWORD,
.ssid_len = strlen(CONFIG_DEMO_SSID),
.max_connection = 1,
.channel = 9, <<<<<<<<<<< ADDED <<<<<<<<<<<<<<<<<<
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config));
#endif
}
With the channel selection ping takes a lot longer and iperf does not work
Looking at here, 9 should be valid: it is channel 11 in 802.11n figure (the wifi dongle says 9/13, as explained by that page)
What is the correct code to select the channel?