Problem with switching off Wi-Fi interface on nrf7002-DK using SoftAP example

Hello everybody,

                         now, I am solving problem with switching off Wi-Fi interface on nrf7002-DK. I am runnig SoftAP example on my nrf7002-DK board. So my board behaves like AP. I wanna make function, that will be able to switch off (or close) Wi-Fi network running on my board. I wanna be able to re-open Wi-Fi network, but with another configuration (another parameters, like another CCID, PSWD etc.)

I trie to use net_if_down() function, but i get two errors.

[00:00:53.440,002] <inf> wifi_supplicant: Network interface 1 (0x20001268) down
[00:00:53.440,521] <inf> wpa_supp: wlan0: interface state ENABLED->DISABLED
[00:00:53.440,643] <err> wpa_supp: wpa_drv_zep_send_mlme: send_mlme op failed: -1
[00:00:53.440,765] <inf> wpa_supp: wlan0: AP-DISABLED 
[00:00:53.441,375] <err> wpa_supp: wpa_drv_zep_deinit_ap: deinit_ap op failed: -1
[00:00:53.441,650] <inf> wpa_supp: wlan0: CTRL-EVENT-DISCONNECTED bssid=f4:ce:36:00:18:64 reason=3 locally_generated=1

What is correct procedure how to switch-off Wi-Fi? What is correct procedure how to re-open Wi-Fi?


Kind regards

Jaroslav Havel

  • Hi

    To get started with The nRF7002 DK and Wi-Fi development, I strongly recommend you begin with the DevAcademy Wi-Fi Fundamentals course that should take you through all the basics when working with a Nordic Wi-Fi device.

    Due to the summer holiday in Norway we're currently very short on staff, so delayed replies must be expected.

    Best regards,

    Simon

  • Thank you Simon

    I have to explain what I want to do. My idea is close Wi-Fi network in idea of changing its parametrs. Now, i am trying to disable AP mode on nrf7002-DK via command. My code is:

    struct net_if *iface = net_if_get_default();
    struct wifi_iface_status status;
    
    ret = net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, sizeof(status));
         if (ret == 0) 
         {
           LOG_INF("Wi-Fi state: %d", status.state);
    
         }
    ret = net_mgmt(NET_REQUEST_WIFI_AP_STA_DISCONNECT, iface, NULL, 0);
         if (ret) 
    	 {
           LOG_ERR("Disconnect selhal: %d", ret);
         }     
    ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, NULL,0);
    	 if (ret) 
    	 {
    	   LOG_ERR("AP mode disabled failed: %s", strerror(-ret));
    	 } 
    	 else 
    	 {
    	   LOG_INF("AP režim uspesnw vypnut \n");
    	 }
                                                 I got these errors:

    [00:02:33.297,454] <err> softap: Disconnect selhal: -22
    [00:02:33.297,546] <err> wpa_supp: Interface wlan is not in disconnected state
    [00:02:33.297,637] <err> softap: AP mode disabled failed: Device or resource busy

    I thing that i have bad parametrs in net_mgmt() functions.

    Is procedure that I am trying to do correct?

    Kind regards

    Jaroslav Havel

Related