Wi-Fi: Station

The Station sample demonstrates how to connect the Wi-Fi station to a specified access point using Dynamic Host Configuration Protocol (DHCP).


The sample supports the following development kit:

Hardware platforms


Board name

Build target

nRF7002 DK





This sample can perform Wi-Fi operations such as connect and disconnect in the 2.4GHz and 5GHz bands depending on the capabilities of an access point.

Using this sample, the development kit can connect to the specified access point in STA mode.

Building and running

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

When built as firmware image for the _ns build target, 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 with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.

Currently, the following board(s) are supported:

  • nRF7002 DK

You must configure the following Wi-Fi credentials in prj.conf:

  • Network name (SSID)

  • Key management

  • Password


You can also use menuconfig to enable Key management option.

See Interactive Kconfig interfaces in the Zephyr documentation for instructions on how to run menuconfig.

To build for the nRF7002 DK, use the nrf7002dk_nrf5340_cpuapp build target. The following is an example of the CLI command:

west build -b nrf7002dk_nrf5340_cpuapp


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, PuTTY). See How to connect with PuTTY for the required settings.

    The sample shows the following output:

    <inf> sta: Connection requested
    <inf> sta: Connected
    Status: successful
      State: COMPLETED
      Interface Mode: STATION
      Link Mode: WIFI 6 (802.11ax/HE)
      BSSID: F0:1D:2D:72:EB:EF
      Band: 5GHz
      Channel: 116
      Security: WPA2-PSK
      MFP: Optional
      RSSI: -55
    <inf> sta: IP address:
    <inf> sta: Disconnect requested
    <inf> sta: Disconnection request done (0)
    Status: successful


This sample uses the following sdk-nrfxlib library: