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 |
---|---|---|---|---|
PCA10143 |
|
|||
PCA10095 |
|
|
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_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_BEACON_INTERVAL
Beacon interval in milliseconds
The option sets the time Time interval (in ms) between beacon transmissions.
Building and running
This sample can be found under samples/wifi/offloaded_raw_tx
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 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_GENERATE_MAC_ADDRESS=y -DCONFIG_ENTROPY_GENERATOR=y
To transmit beacons at a specified interval, run the following command:
west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_BEACON_INTERVAL=200
Change the board target as given below for the nRF7002 EK.
west build -p -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek
Testing
After programming the sample to your development kit, complete the following steps to test it:
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.
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 nRF Connect SDK v2.7.99-cb26b7c84971 *** *** Using Zephyr OS v3.7.99-9056bece3e70 *** ----- Initializing nRF70 ----- ----- Starting to transmit beacons with the following configuration ----- SSID: nRF70_off_raw_tx_1 Period: 200000 TX Power: 15 Channel: 1 Short Preamble: 0 Number of Retries: 10 Throughput Mode: Legacy Rate: 54M HE GI: 1 HE LTF: 1 ----- Statistics ----- Packet sent: 150 ----- Updating configuration to ----- SSID: nRF70_off_raw_tx_2 Period: 200000 TX Power: 11 Channel: 36 Short Preamble: 0 Number of Retries: 10 Throughput Mode: Legacy Rate: 12M HE GI: 1 HE LTF: 1 ----- Statistics ----- Packet sent: 299 ----- Stopping transmission ----- ----- Deinitializing nRF70 -----
Observe the packets that are sent out, in a sniffer capture, by filtering the packets based on their transmit MAC address or SSID.