WiFi scan while connected

Does the NCS stack + nRF7002 support scanning while connected? I would expect it could, to support handoff, but getting errors.

Using nRF7002-DK and NCS 2.8.0.

Compile the wifi/shell example for nrf7002dk/nrf5340/cpuapp, no other changes.

*** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
*** Using Zephyr OS v3.7.99-0bc3393fb112 ***
Starting nrf7002dk with CPU frequency: 128 MHz
[00:00:00.532,226] <inf> wifi_supplicant: wpa_supplicant initialized


uart:~$ wifi connect -s Hizzulon <my AP credentials>
Connection requested
Connected
[00:00:19.725,433] <inf> wpa_supp: MBO: Disable MBO/OCE due to misbehaving AP not having enabled PMF
[00:00:19.726,226] <inf> wpa_supp: wlan0: SME: Trying to authenticate with fc:34:97:af:71:54 (SSID='Hizzulon' freq=5220 MHz)
[00:00:20.086,120] <inf> wpa_supp: wlan0: Trying to associate with fc:34:97:af:71:54 (SSID='Hizzulon' freq=5220 MHz)
[00:00:20.102,874] <inf> wpa_supp: wlan0: Associated with fc:34:97:af:71:54
[00:00:20.103,027] <inf> wpa_supp: MBO: Disable MBO/OCE due to misbehaving AP not having enabled PMF
[00:00:20.103,118] <inf> wpa_supp: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[00:00:20.122,253] <inf> wpa_supp: wlan0: WPA: Key negotiation completed with fc:34:97:af:71:54 [PTK=CCMP GTK=CCMP]
[00:00:20.122,467] <inf> wpa_supp: wlan0: CTRL-EVENT-CONNECTED - Connection to fc:34:97:af:71:54 completed [id=0 id_str=]
[00:00:20.137,420] <inf> net_dhcpv4: Received: 192.168.1.203


uart:~$ wifi status
Status: successful
==================
State: COMPLETED
Interface Mode: STATION
Link Mode: WIFI 6 (802.11ax/HE)
SSID: Hizzulon
BSSID: FC:34:97:AF:71:54
Band: 5GHz
Channel: 44
Security: WPA2-PSK
MFP: Optional
RSSI: -34
Beacon Interval: 100
DTIM: 1
TWT: Supported
Current PHY rate : 26000


uart:~$ wifi scan
Scan requested

[wait ~30 seconds]


Scan request failed (-116)

[wait another ~30 seconds]


[00:01:33.363,311] <err> wifi_nrf: nrf_wifi_fmac_chg_vif_state: RPU is unresponsive for 10 sec
[00:01:33.363,342] <err> wifi_nrf: nrf_wifi_if_stop_zep: nrf_wifi_fmac_chg_vif_state failed
[00:01:33.364,013] <inf> wifi_supplicant: Network interface 1 (0x200013c0) down
[00:01:33.375,396] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
[00:01:33.375,854] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
[00:01:35.533,050] <inf> wifi_supplicant: Network interface 1 (0x200013c0) up
uart:~$ wifi status
Status: successful
==================
State: DISCONNECTED
uart:~$ 

So the scan fails, but later there's another error that looks like the low-level nRF7002 driver failing and recovering (CONFIG_NRF_WIFI_RPU_RECOVERY is enabled by default).

If scan while connected isn't a supported feature, I would expect it to error immediately, not get into a state where it drops the connection?

A probably related issue: if I issue "wifi connect" with invalid credentials, wifi status is "SCANNING" forever (certainly much longer than the 30 second scan timeout), and later connect requests fail with:

uart:~$ wifi connect <credentials>
Connection requested
[00:01:58.298,828] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
[00:01:58.302,124] <inf> wpa_supp: wlan0: Reject scan trigger since one is already pending
[00:01:58.302,246] <wrn> wpa_supp: wlan0: Failed to initiate AP scan
[00:01:58.304,992] <inf> wpa_supp: wlan0: Reject scan trigger since one is already pending
[00:01:58.305,114] <wrn> wpa_supp: wlan0: Failed to initiate AP scan

I need to explicitly do "wifi disconnect" before it will stop scanning and allow another connection. Normally, issuing a connect command while already connected disconnects automatically then initiates the new connection.

Parents
  • Hi

    So, this should be supported in NCS 2.8.0. Can you upload the scan results before you connect so we can take a look at the channel conditions?

    Terminal logs for the following commands should help us understand the issue:

    1) wifi scan 

    2) wifi scan -b 2

    3) wifi scan -b 5

    4) wifi connect -s Hizzulon <my AP credentials>

    5) wifi status 

    6) net ping <AP>

    7) wifi scan -b 2

    8) wifi scan -b 5

    9) wifi scan 

    These should also print the network conditions and run scans at specific bands.

    Best regards,

    Simon

Reply
  • Hi

    So, this should be supported in NCS 2.8.0. Can you upload the scan results before you connect so we can take a look at the channel conditions?

    Terminal logs for the following commands should help us understand the issue:

    1) wifi scan 

    2) wifi scan -b 2

    3) wifi scan -b 5

    4) wifi connect -s Hizzulon <my AP credentials>

    5) wifi status 

    6) net ping <AP>

    7) wifi scan -b 2

    8) wifi scan -b 5

    9) wifi scan 

    These should also print the network conditions and run scans at specific bands.

    Best regards,

    Simon

Children
  • Here are the logs. Sorry for the formatting, the tabs aren't getting pasted literally.

    [00:00:00.611,511] <inf> fs_nvs: 2 Sectors of 4096 bytes
    [00:00:00.611,511] <inf> fs_nvs: alloc wra: 0, fe8
    [00:00:00.611,541] <inf> fs_nvs: data wra: 0, 0
    *** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***
    Starting nrf7002dk with CPU frequency: 128 MHz
    [00:00:00.613,525] <inf> wifi_supplicant: wpa_supplicant initialized


    uart:~$ wifi scan
    Scan requested

    Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
    1 | Hizzulon 8 | 44 (5GHz ) | -54 | WPA2-PSK | FC:34:97:AF:71:34 | Disable
    2 | Hizzulon2 9 | 7 (2.4GHz) | -59 | WPA2-PSK | FC:34:97:AF:71:30 | Disable
    3 | 0 | 161 (5GHz ) | -62 | WPA2-PSK | BA:34:97:AF:71:3D | Disable
    4 | 0 | 161 (5GHz ) | -62 | WPA2-PSK | FC:34:97:AF:71:38 | Disable
    5 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -84 | WPA2-PSK | C2:BD:13:3B:A3:2A | Optional
    6 | Padres19 8 | 10 (2.4GHz) | -84 | WPA2-PSK | BC:9A:8E:33:9A:74 | Optional
    7 | MySpectrumWiFiD9-2G 19 | 11 (2.4GHz) | -85 | WPA2-PSK | C8:B4:22:2A:13:D7 | Disable
    8 | Tims House 10 | 11 (2.4GHz) | -86 | WPA2-PSK | 90:D0:92:04:1B:84 | Optional
    9 | 0 | 11 (2.4GHz) | -86 | WPA2-PSK | 7A:83:C2:03:48:A8 | Disable
    10 | 0 | 44 (5GHz ) | -87 | WPA2-PSK | 22:EF:BD:34:5E:DF | Disable
    11 | CocktailClub 12 | 11 (2.4GHz) | -87 | WPA2-PSK | A0:2D:13:3B:A3:29 | Disable
    12 | CocktailClub 12 | 11 (2.4GHz) | -87 | WPA2-PSK | A0:2D:13:64:CC:E5 | Disable
    13 | ATTkuv7HS2 10 | 8 (2.4GHz) | -87 | WPA2-PSK | 58:60:D8:7C:DD:30 | Optional
    14 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -88 | WPA2-PSK | 82:7D:13:64:CC:E6 | Optional
    15 | ATT8H862E9 10 | 2 (2.4GHz) | -88 | WPA2-PSK | 90:9D:7D:60:6A:90 | Optional
    16 | c67a96cd 8 | 1 (2.4GHz) | -88 | WPA2-PSK | 50:2C:C6:7A:96:CD | Disable
    17 | ATT5ffDcTA 10 | 1 (2.4GHz) | -90 | WPA2-PSK | 74:8A:0D:86:7F:D0 | Optional
    18 | 0 | 2 (2.4GHz) | -92 | WPA2-PSK | BA:6E:84:13:F7:66 | Disable
    Scan request done


    uart:~$ wifi scan -b 2
    Scan requested

    Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
    1 | Hizzulon2 9 | 7 (2.4GHz) | -59 | WPA2-PSK | FC:34:97:AF:71:30 | Disable
    2 | CocktailClub 12 | 11 (2.4GHz) | -87 | WPA2-PSK | A0:2D:13:64:CC:E5 | Disable
    3 | CocktailClub 12 | 11 (2.4GHz) | -87 | WPA2-PSK | A0:2D:13:3B:A3:29 | Disable
    4 | ATTkuv7HS2 10 | 8 (2.4GHz) | -87 | WPA2-PSK | 58:60:D8:7C:DD:30 | Optional
    5 | DIRECT-AA-HP OfficeJet 4650 27 | 2 (2.4GHz) | -87 | WPA2-PSK | 48:BA:4E:A5:13:AB | Disable
    6 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -88 | WPA2-PSK | 82:7D:13:64:CC:E6 | Optional
    7 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -89 | WPA2-PSK | C2:BD:13:3B:A3:2A | Optional
    8 | ATT7zYv8G7 10 | 9 (2.4GHz) | -89 | WPA2-PSK | 10:C4:CA:3D:C1:94 | Optional
    9 | c67a96cd 8 | 1 (2.4GHz) | -89 | WPA2-PSK | 50:2C:C6:7A:96:CD | Disable
    10 | TP-Link_Extender 16 | 2 (2.4GHz) | -90 | OPEN | A8:6E:84:13:F7:66 | Disable
    Scan request done


    uart:~$ wifi scan -b 5
    Scan requested

    Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
    1 | Hizzulon 8 | 44 (5GHz ) | -54 | WPA2-PSK | FC:34:97:AF:71:34 | Disable
    Scan request done


    uart:~$ wifi connect -s Hizzulon <credentials>
    Connection requested
    Connected
    [00:00:50.201,507] <inf> wpa_supp: wlan0: SME: Trying to authenticate with fc:34:97:af:71:34 (SSID='Hizzulon' freq=5220 MHz)
    [00:00:50.561,431] <inf> wpa_supp: wlan0: Trying to associate with fc:34:97:af:71:34 (SSID='Hizzulon' freq=5220 MHz)
    [00:00:50.578,063] <inf> wpa_supp: wlan0: Associated with fc:34:97:af:71:34
    [00:00:50.578,277] <inf> wpa_supp: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
    [00:00:50.596,038] <inf> wpa_supp: wlan0: WPA: Key negotiation completed with fc:34:97:af:71:34 [PTK=CCMP GTK=CCMP]
    [00:00:50.596,252] <inf> wpa_supp: wlan0: CTRL-EVENT-CONNECTED - Connection to fc:34:97:af:71:34 completed [id=0 id_str=]
    [00:00:50.606,903] <inf> net_dhcpv4: Received: 192.168.1.203


    uart:~$ wifi status
    Status: successful
    ==================
    State: COMPLETED
    Interface Mode: STATION
    Link Mode: WIFI 6 (802.11ax/HE)
    SSID: Hizzulon
    BSSID: FC:34:97:AF:71:34
    Band: 5GHz
    Channel: 44
    Security: WPA2-PSK
    MFP: Optional
    RSSI: -53
    Beacon Interval: 100
    DTIM: 1
    TWT: Supported
    Current PHY rate : 26000
    uart:~$ net ping 192.168.1.1
    PING 192.168.1.1
    28 bytes from 192.168.1.1 to 192.168.1.203: icmp_seq=1 ttl=64 time=10 ms
    28 bytes from 192.168.1.1 to 192.168.1.203: icmp_seq=2 ttl=64 time=11 ms
    28 bytes from 192.168.1.1 to 192.168.1.203: icmp_seq=3 ttl=64 time=10 ms


    uart:~$ wifi scan -b 2
    Scan requested

    Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
    1 | Hizzulon2 9 | 7 (2.4GHz) | -53 | WPA2-PSK | FC:34:97:AF:71:30 | Disable
    2 | 0 | 11 (2.4GHz) | -84 | WPA2-PSK | 7A:83:C2:03:48:A8 | Disable
    3 | CocktailClub 12 | 11 (2.4GHz) | -85 | WPA2-PSK | A0:2D:13:64:CC:E5 | Disable
    4 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -86 | WPA2-PSK | C2:BD:13:3B:A3:2A | Optional
    5 | CocktailClub 12 | 11 (2.4GHz) | -86 | WPA2-PSK | A0:2D:13:3B:A3:29 | Disable
    6 | ATT5cs7fRv_Guest 16 | 11 (2.4GHz) | -86 | WPA2-PSK | 82:7D:13:64:CC:E6 | Optional
    7 | c67a96cd 8 | 1 (2.4GHz) | -86 | WPA2-PSK | 50:2C:C6:7A:96:CD | Disable
    8 | Cycle 5 | 5 (2.4GHz) | -87 | WPA2-PSK | F0:2F:74:C5:75:F8 | Disable
    9 | TP-Link_Extender 16 | 2 (2.4GHz) | -91 | OPEN | A8:6E:84:13:F7:66 | Disable
    Scan request done


    uart:~$ wifi scan -b 5 -t passive
    Scan requested

    Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
    1 | Hizzulon 8 | 44 (5GHz ) | -55 | WPA2-PSK | FC:34:97:AF:71:34 | Disable
    2 | 0 | 161 (5GHz ) | -61 | WPA2-PSK | BA:34:97:AF:71:3D | Disable
    3 | 0 | 161 (5GHz ) | -61 | WPA2-PSK | FC:34:97:AF:71:38 | Disable
    4 | 0 | 44 (5GHz ) | -83 | WPA2-PSK | 22:EF:BD:34:5E:DF | Disable
    Scan request done


    uart:~$ wifi scan -b 5
    Scan requested
    Scan request failed (-116)
    [00:02:45.247,131] <err> wifi_nrf: nrf_wifi_fmac_chg_vif_state: RPU is unresponsive for 10 sec
    [00:02:45.247,161] <err> wifi_nrf: nrf_wifi_if_stop_zep: nrf_wifi_fmac_chg_vif_state failed
    [00:02:45.247,833] <inf> wifi_supplicant: Network interface 1 (0x200013c0) down
    [00:02:45.259,216] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
    [00:02:45.259,582] <inf> wpa_supp: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
    [00:02:47.416,870] <inf> wifi_supplicant: Network interface 1 (0x200013c0) up
    uart:~$

    Connected to a 5GHz AP, the 2.4GHz scan works but the 5GHz scan fails. I added a passive 5GHz scan, which works, so it appears the active scanning is the problem.

    I would have tried connecting to the 2.4GHz AP and seeing if the reverse is true, but the dev board won't connect to 2.4GHz. That's a quirk of my AP, as after multiple reboots I can eventually get it to connect (possibly something with the MAC address). Since the initial scan is successful, I don't think the AP behavior (even at 5GHz) is the issue here.

    I have a mesh network, which was used for the original test. To reduce variables, I disabled it for this test. For that reason, you will see different SSID and lower RSSI for these logs vs the original.

Related