WiFi-Scan does not list stations of all channels

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

WiFi-Scan does not list stations of all channels

Postby marclee » Fri Sep 16, 2022 10:47 pm

Configuration:
ESP32-S2-WROVER (4MB) with ESP-IDF v5.0-dev-4770-gd622bcfd46
WiFi is running in mode WIFI_MODE_APSTA

Problem: WiFi-Scan does not list stations of all channels.

Code: Select all

wifi_config_t wifi_config_ap = \
{
  .ap = \
  {
    .ssid = WIFI_AP_SSID,
    .ssid_len = strlen(WIFI_AP_SSID),
    .channel = 2,
    .password = WIFI_AP_PASSWORD,
    .authmode = WIFI_AUTH_WPA_WPA2_PSK,
    .max_connection = WIFI_MAX_STA_CONN,
  },
};

Code: Select all

wifi_scan_config_t s_scan_config = { 0 };
esp_wifi_scan_start(&s_scan_config, false);
Result e.g.:
If ESP-AP channel is set to 2, scan returns access points on channels 1-7.
If ESP-AP channel is set to 8, scan returns stations on channels 1-8.
If ESP-AP channel is set to 11, scan returns stations on channels 1-7, 11.
If scan is started with s_scan_config.channel = 8, scan returns stations on channel 8.

Function esp_wifi_get_country returns:
.cc = 01
.schan = 1
.schan = 11
.max_tx_power = 20
.policy = WIFI_COUNTRY_POLICY_AUTO

What's wrong? esp_wifi_scan_start should return stations of all channels.

chegewara
Posts: 2333
Joined: Wed Jun 14, 2017 9:00 pm

Re: WiFi-Scan does not list stations of all channels

Postby chegewara » Sat Sep 17, 2022 8:16 am

Hi,
with simple sketch in arduino (esp-idf 4.4) it seems to work:

Code: Select all

 SSID: ESP_7B926D, power: -18, channel: 5
 SSID: roobuck_configurator, power: -25, channel: 7
 SSID: ASUS, power: -52, channel: 1
 SSID: esp32, power: -54, channel: 5
 SSID: DWR-921_308017, power: -55, channel: 11
 SSID: NETIASPOT-2.4GHz-vecB, power: -60, channel: 1
 SSID: JBL Bar 5.1_3642.l025, power: -68, channel: 11
 SSID: NETIASPOT-5EPe, power: -77, channel: 1
 SSID: PATELEC-ELPENA, power: -77, channel: 6
 SSID: NETIASPOT-2.4GHz-Ad9A, power: -78, channel: 1
 SSID: NETIASPOT-h6qG, power: -79, channel: 8
 SSID: HUAWEI-777A, power: -81, channel: 2
 SSID: Lolita, power: -81, channel: 10
 SSID: NETIASPOT-2.4GHz-qwZE, power: -82, channel: 11
As you can see i can search for AP with channels 10 and 11 when esp32 ap channel is 2.

I also tested with ESP-IDF v5.1-dev-437-g5c1044d84d and its fine.

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: WiFi-Scan does not list stations of all channels

Postby marclee » Sat Sep 17, 2022 11:06 pm

Hi,
with simple sketch in arduino (esp-idf 4.4) it seems to work:
Congratulation! So how could this help to solve the mentioned problem? I don't understand.

chegewara
Posts: 2333
Joined: Wed Jun 14, 2017 9:00 pm

Re: WiFi-Scan does not list stations of all channels

Postby chegewara » Sat Sep 17, 2022 11:09 pm

As you can see i can search for AP with channels 10 and 11 when esp32 ap channel is 2.

I also tested with ESP-IDF v5.1-dev-437-g5c1044d84d and its fine.
What problem? Can you post example code to reproduce this, because i could not reproduce it.

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: WiFi-Scan does not list stations of all channels

Postby marclee » Sun Sep 18, 2022 3:37 am

What problem?
Please have a look at my question. Sorry, but your response is not helpful. The scan function may work with your Arduino example. But as I told, it does not work in our case. I'm looking for someone who is interested in helping me localizing and solving the problem. Disclaiming the problem does not help at all.
Can you post example code to reproduce this, because i could not reproduce it.
Which part of code would you like to see? Of course I can't provide the whole application.

- Is there any configuration that could lead to such a behaviour?
- How could I debug the problem?
- Which parameters could I check?

Answers to those questions would be helpful. Thank you.

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: WiFi-Scan does not list stations of all channels

Postby marclee » Mon Sep 19, 2022 8:39 pm

Meanwhile I figured out that the event handler (event_id WIFI_EVENT_SCAN_DONE) returned event status = 1. Which means that scan process terminated unsuccessfully.

This was caused by esp_scan_stop(), accidentally called by application at the wrong time. Scan got stopped prematurely after one second and couldn't finish scanning all channels. The application is complex, so I didn't recognize it before.

skywalkerf34
Posts: 1
Joined: Tue Oct 12, 2021 10:42 am

Re: WiFi-Scan does not list stations of all channels

Postby skywalkerf34 » Wed Oct 26, 2022 5:54 am

@chegewara
I am looking for something similar to the result you give: scan wifi and then select the best channel to set up my system.
Would you be kind to share your sketch?

Who is online

Users browsing this forum: No registered users and 79 guests