Wi-Fi: Offloaded raw TX

The Offloaded raw TX sample demonstrates how to use the offloaded raw transmit APIs provided by the nRF Wi-Fi driver for transmitting raw packets.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Board target

Shields

nRF7120 DK

nrf7120dk

nrf7120dk/nrf7120/cpuapp/ns nrf7120dk/nrf7120/cpuapp

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" "nrf7002eb_interposer_p1;nrf7002eb"

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

"nrf7002eb_interposer_p1;nrf7002eb"

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nrf7002ek

Overview

The sample generates and broadcasts 802.11 beacon frames as raw TX packets. As a result, the nRF70 Series device can be identified as a Wi-Fi® beaconing device.

For more information on the offloaded raw transmit operation, see Offloaded raw transmit operation.

Configuration

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

Configuration options

CONFIG_SAMPLE_OFFLOADED_RAW_TX_GENERATE_MAC_ADDRESS

Random Wi-Fi MAC address

The option specifies the MAC address to be used by the sample. This is only used when the nRF7002 OTP is not programmed with a MAC address.

CONFIG_SAMPLE_OFFLOADED_RAW_TX_BEACON_INTERVAL

Beacon interval in milliseconds

The option sets the time Time interval (in ms) between beacon transmissions.

CONFIG_SAMPLE_OFFLOADED_RAW_TX_BAND_AUTO

Auto (infer from channel number)

CONFIG_SAMPLE_OFFLOADED_RAW_TX_BAND_2GHZ

2.4 GHz

CONFIG_SAMPLE_OFFLOADED_RAW_TX_BAND_5GHZ

5 GHz

CONFIG_SAMPLE_OFFLOADED_RAW_TX_BAND_6GHZ

6 GHz

Building and running

This sample can be found under samples/wifi/offloaded_raw_tx 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.

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

west build -p -b nrf7002dk/nrf5340/cpuapp

To generate and transmit beacons, use the following commands:

To generate beacons with random source MAC address and BSSID, run the following command:

west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_SAMPLE_OFFLOADED_RAW_TX_GENERATE_MAC_ADDRESS=y -DCONFIG_ENTROPY_GENERATOR=y

Change the board target as given below for the nRF7002 EK.

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

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.

    The sample shows the following output:

    *** Booting nRF Connect SDK v3.4.99-91b99fbca673 ***
    *** Using Zephyr OS v4.4.99-389e70196936 ***
    ----- Initializing nRF wifi offloaded raw tx -----
    ----- Starting to transmit beacons with the following configuration -----
            SSID: nRF_wifi_off_raw_tx_1
            Period: 100000
            TX Power: 15
            Channel: 1
            Band: 2.4 GHz
            Short Preamble: 0
            Number of Retries: 10
            Throughput Mode: Legacy
            Rate: 54M
            HE GI: 1
            HE LTF: 1
    -----  Statistics -----
            Packet sent: 300
    ----- Updating configuration to -----
            SSID: nRF_wifi_off_raw_tx_2
            Period: 100000
            TX Power: 11
            Channel: 36
            Band: 5 GHz
            Short Preamble: 0
            Number of Retries: 10
            Throughput Mode: Legacy
            Rate: 12M
            HE GI: 1
            HE LTF: 1
    -----  Statistics -----
            Packet sent: 599
    ----- Stopping transmission -----
    ----- Deinitializing nRF wifi offloaded raw tx -----
    
  3. Observe the packets that are sent out, in a sniffer capture, by filtering the packets based on their transmit MAC address or SSID.