Wi-Fi: Shutdown

The Shutdown sample demonstrates how to put the Nordic Semiconductor’s Wi-Fi® chipset in the Shutdown state, where the device is completely powered off. For more information, see the nRF70 Series power states page.

This also demonstrates how to achieve the lowest possible power consumption in the Host SoC (nRF53, nRF52 or nRF91 Series) when Wi-Fi is enabled but not being used.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

Shields

nRF9161 DK

PCA10153

nrf9161dk

nrf9161dk/nrf9161/ns

nrf7002ek_nrf7000

nRF9160 DK

PCA10090

nrf9160dk

nrf9160dk/nrf9160/ns

nrf7002ek_nrf7000

nRF7002 DK (emulating nRF7001)

PCA10143

nrf7002dk

nrf7002dk/nrf5340/cpuapp/nrf7001

nRF7002 DK

PCA10143

nrf7002dk

nrf7002dk/nrf5340/cpuapp

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nrf7002ek

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

nrf7002ek

Overview

The sample can demonstrate Wi-Fi shutdown and achieve the lowest possible power consumption in the Host SoC. The sample:

  1. Initializes the Wi-Fi driver.

  2. Scans for available Wi-Fi networks to verify that the Wi-Fi driver is operational.

  3. Brings down the Wi-Fi network interface, which automatically directs the Wi-Fi driver to power down the nRF70 device.

  4. Puts the Host SoC in the lowest possible power consumption mode.

User Interface

Button 1:

Wakes up the Host SoC, brings up the Wi-Fi network interface, which automatically directs the Wi-Fi driver to power on the nRF70 device. The sample then scans for available Wi-Fi networks to verify that the Wi-Fi driver is operational.

Button 2:

Brings down the Wi-Fi network interface, which automatically directs the Wi-Fi driver to power down the nRF70 device. The Host SoC is put into the lowest possible power consumption mode.

Building and running

This sample can be found under samples/wifi/shutdown in the nRF Connect SDK folder structure.

When built as firmware image for a board target with the */ns variant, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE). Because of this, it automatically includes the Trusted Firmware-M (TF-M). To read more about CMSE, see Processing environments.

To build the sample, follow the instructions in Configuring and building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

To build for the nRF7002 DK, use the nrf7002dk/nrf5340/cpuapp board target. The following is an example of the CLI command to demonstrate Wi-Fi shutdown:

west build -b nrf7002dk/nrf5340/cpuapp

Disable auto-start of the Wi-Fi driver

The Wi-Fi network interface is automatically brought up when the Wi-Fi driver is initialized by default. You can disable it by setting the CONFIG_NRF_WIFI_IF_AUTO_START Kconfig option to n.

west build -b nrf7002dk/nrf5340/cpuapp -DCONFIG_NRF_WIFI_IF_AUTO_START=n

With this configuration, the Wi-Fi network interface is not automatically brought up by the Zephyr networking stack. You must press Button 1 to bring up the Wi-Fi network interface.

Testing

After programming the sample to your development kit, complete the following steps to test it:

  1. Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.

  2. Connect to the kit with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

    The sample shows the following output:

    *** Booting Zephyr OS build v3.3.99-ncs1-26-ge405279d2134 ***
    [00:00:00.440,460] <inf> wifi_nrf: Firmware (v1.2.8.1) booted successfully
    
    [00:00:00.638,397] <inf> scan: Starting nrf7002dk_nrf5340_cpuapp with CPU frequency: 64 MHz
    
    [00:00:00.642,608] <inf> scan: Scan requested
    
    Num  | SSID                             (len) | Chan | RSSI | Security | BSSID
    1    | abcdef                           6     | 1    | -37  | WPA/WPA2 | aa:aa:aa:aa:aa:aa
    2    | pqrst                            5     | 1    | -65  | WPA/WPA2 | xx:xx:xx:xx:xx:xx
    3    | AZBYCXD                          7     | 1    | -41  | WPA/WPA2 | yy:yy:yy:yy:yy:yy
    [00:00:05.445,739] <inf> scan: Scan request done
    
    [00:00:05.452,423] <inf> scan: Interface down
    
  3. Press Button 1 to wake up the nRF5340 SoC, initialize the Wi-Fi chipset, and scan for available Wi-Fi networks:

    The sample shows the following output:

    [00:00:29.141,357] <inf> wifi_nrf: Firmware (v1.2.8.1) booted successfully
    
    [00:00:29.269,165] <inf> scan: Interface up
    [00:00:29.272,521] <inf> scan: Scan requested
    
    Num  | SSID                             (len) | Chan | RSSI | Security | BSSID
    1    | abcdef                           6     | 1    | -37  | WPA/WPA2 | aa:aa:aa:aa:aa:aa
    2    | pqrst                            5     | 1    | -65  | WPA/WPA2 | xx:xx:xx:xx:xx:xx
    3    | AZBYCXD                          7     | 1    | -41  | WPA/WPA2 | yy:yy:yy:yy:yy:yy
    [00:00:34.092,285] <inf> scan: Scan request done
    
  4. Press Button 2 to shut down the Wi-Fi driver and put the nRF5340 SoC in lowest possible power consumption mode:

    The sample shows the following output:

    [00:00:48.313,354] <inf> scan : Interface down