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.

The sample supports the following three modes of operation:

  • Continuous mode (default): Continuously cycles between Wi-Fi startup and shutdown with a configurable timeout.

  • One-shot mode: Performs Wi-Fi startup followed by shutdown once, then remains in shutdown mode.

  • Buttons mode: Manual control of Wi-Fi startup and shutdown using buttons.

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

nRF9151 DK

PCA10171

nrf9151dk

nrf9151dk/nrf9151/ns

nrf7002ek_nrf7000

nRF7002 DK

PCA10143

nrf7002dk

nrf7002dk/nrf5340/cpuapp

nRF54LM20 DK

PCA10184

nrf54lm20dk

nrf54lm20dk/nrf54lm20b/cpuapp nrf54lm20dk/nrf54lm20a/cpuapp

"nrf7002eb2"

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

"nrf7002eb2"

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

"nrf7002eb_interposer_p1;nrf7002eb"

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nrf7002ek nrf7002ek_nrf7000

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

nrf7002ek nrf7002ek_nrf7000

Overview

The sample can demonstrate Wi-Fi shutdown and achieve the lowest possible power consumption in the host SoC. It operates in one of the following three modes, based on the selected configuration:

  • In Continuous mode (default), the sample performs the following steps:

  1. Initializes the Wi-Fi driver and powers up the nRF70 device.

  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.

  5. Waits for the configured timeout period (SHUTDOWN_TIMEOUT_S).

  6. Repeats the cycle from step 1.

  • In One-shot mode, the sample performs steps 1-4 once, then remains in shutdown mode permanently.

  • In Buttons mode, the Wi-Fi state is controlled manually based on user button interactions.

User Interface

The user interface depends on the selected mode of operation:

Buttons mode

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.

Continuous and One-shot modes

User interaction is required. The sample operates automatically according to the selected mode.

Configuration

See Configuring and building for information about how to permanently or temporarily change the configuration.

Configuration options

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. This is automatically set for One-shot mode.

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

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

Adjust shutdown timeout

In Continuous mode, you can configure the timeout period between shutdown and restart cycles using the CONFIG_SHUTDOWN_TIMEOUT_S option (in seconds):

west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_SHUTDOWN_TIMEOUT_S=10

Building and running

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

For more security, it is recommended to use the */ns variant of the board target (see the Requirements section above.) When built for this variant, the sample is configured to compile and run as a non-secure application using security by separation. Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.

To build the sample, follow the instructions in 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.

Modes of operation

To build for the nRF7002 DK and nRF7000 EK with nRF5340 DK in different modes of operation, see the following examples:

Continuous mode (Default)

  • For nRF7002 DK:

west build -p -b nrf7002dk/nrf5340/cpuapp
  • For nRF7000 EK with nRF5340 DK:

west build -p -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek_nrf7000

One-shot mode

  • For nRF7002 DK:

west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_OPERATION_MODE_ONE_SHOT=y -DCONFIG_NRF_WIFI_IF_AUTO_START=n
  • For nRF7000 EK with nRF5340 DK:

west build -p -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek_nrf7000 -DCONFIG_OPERATION_MODE_ONE_SHOT=y -DCONFIG_NRF_WIFI_IF_AUTO_START=n

Buttons mode

  • For nRF7002 DK:

west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_OPERATION_MODE_BUTTONS=y
  • For nRF7000 EK with nRF5340 DK:

west build -p -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek_nrf7000 -DCONFIG_OPERATION_MODE_BUTTONS=y

Refer to the sample.yaml file for a complete list of supported boards and their corresponding build command options.

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 serial port. Serial ports are referred to as COM ports on Windows, /dev/ttyACM devices on Linux, and /dev/tty devices on macOS. To list Nordic Semiconductor devices connected to your computer together with their serial ports, open a terminal and run the nrfutil device list command. Alternatively, check your operating system’s device manager or its equivalent.

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

  3. The sample shows the following output in Continuous mode:

    *** Booting nRF Connect SDK v3.0.99-7c4f8113c3e4 ***
    *** Using Zephyr OS v4.1.99-eb12c854d528 ***
    [00:00:00.428,253] <inf> shutdown: Starting nrf7002dk with CPU frequency: 64 MHz
    
    [00:00:00.431,640] <inf> shutdown: 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.116,943] <inf> shutdown: Scan request done
    
    [00:00:05.130,706] <inf> shutdown: Interface down
    [00:00:05.297,180] <inf> shutdown: Interface up
    [00:00:05.299,194] <inf> shutdown: 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:10.009,399] <inf> shutdown: Scan request done
    
    [00:00:10.022,735] <inf> shutdown: Interface down
    [00:00:15.189,270] <inf> shutdown: Interface up
    [00:00:15.191,284] <inf> shutdown: Scan requested