Skip to content

Commit

Permalink
wifi: samples: Add offloaded raw tx mode sample
Browse files Browse the repository at this point in the history
This sample demonstrates the offloaded raw TX packet
functionality of the nRF70 device.

Signed-off-by: Kapil Bhatt <[email protected]>
  • Loading branch information
kapbh committed Oct 4, 2024
1 parent ca2219e commit 4ef0bd6
Show file tree
Hide file tree
Showing 12 changed files with 503 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ manifest (west.yml).
Documentation
*************

Official latest documentation at https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/index.html
Documentation is available at https://files.nordicsemi.com/artifactory/NCS/Wi-Fi/docs/

For earlier versions, open the latest version and use the drop-down under the title header.
Steps for viewing the documentation:
------------------------------------

1. Download `nrf70_off_raw_tx_doc.tgz` from the link provided above.
2. Unpack the package by running `tar -xf nrf70_off_raw_tx_doc.tgz`.
3. Open nrf/index.html from your favourite browser.

Relevant pages in the documentation:

1. Protocols->Wi-Fi->Advanced modes->Offloaded raw transmit operation
2. Samples -> Wi-Fi samples -> Wi-Fi: Offloaded raw TX
2 changes: 2 additions & 0 deletions cmake/sysbuild/nrf700x.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ function(setup_nrf700x_xip_data)
set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/default/nrf70.bin)
elseif(SB_CONFIG_WIFI_NRF700X_RADIO_TEST)
set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/radio_test/nrf70.bin)
elseif(SB_CONFIG_WIFI_NRF70_OFFLOADED_RAW_TX)
set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/offloaded_raw_tx/nrf70.bin)
elseif(SB_CONFIG_WIFI_NRF700X_SCAN_ONLY)
set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/scan_only/nrf70.bin)
elseif(SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES)
Expand Down
1 change: 1 addition & 0 deletions doc/nrf/protocols/wifi/advanced_modes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ The following subpages cover topics related to the transmission and reception of
raw_tx_operation
sniffer_rx_operation
promiscuous_operation
offloaded_raw_tx
53 changes: 53 additions & 0 deletions doc/nrf/protocols/wifi/advanced_modes/offloaded_raw_tx.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. _ug_nrf70_developing_offloaded_raw_tx:

Offloaded raw transmit operation
################################

.. contents::
:local:
:depth: 2

The nRF70 series ICs can be used as offloaded raw transmit devices wherein the nRF70 series device can transmit frames at regular intervals utilizing very low power. The contents of the frame as well as parameters such as frequency and channel of transmission etc. are programmable. The major functionality of transmitting the frames is offloaded to the nRF70 device thereby placing very minimal requirements on the host (mainly programming capability) thereby leading to very little host memory requirements (Flash and RAM).

This can serve as an ideal solution for applications such as indoor navigation and tracking, where the anchor nodes need to do low-power beaconing. Anchor devices can transmit beacon-compliant packets containing tracking/location information inside the BSSID/SSID fields. This information can then be used by the devices that scan for these beacon-compliant packets.

The Offloaded Raw TX is supported as a separate stand-alone compile-time mode of operation in the Wi-Fi driver and is exclusive to the already existing modes of operation, i.e.:

1. `Wi-Fi mode` and
2. `Radio Test mode`

In addition to providing start/stop control over the offloaded raw transmit operation, the driver supports updating the configuration parameters as below:

Frame contents
Channel of operation
Data rate
Rate flags
Periodicity of transmission
Transmit power

.. _ug_nrf70_developing_enabling_offloaded_raw_tx:

Offloaded raw transmit API
**************************

The offloaded raw transmit functionality offered by nRF70 series ICs can be exercised using the APIs exposed by the driver. The API reference can be found at:

| Header file: :file:`zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h`

The usage of the API is demonstrated by the :ref:`Offloaded raw transmit sample <wifi_offloaded_raw_tx_packet_sample>`

.. _ug_nrf70_developing_offloaded_raw_tx_power_consumption:

Power consumption
*****************

The power consumed by the nRF70 device during the offloaded raw TX operation is dependent on:

1. Operating data rate (e.g. 6 Mbps, MCS0 etc.) : Power consumption decreases as the data rate increases.
2. Payload length : Power consumption increases with the payload length.
3. Periodicity of transmission : Power consumption increases as the period between successive transmissions decreases.
4. Transmit power : Power consumption increases as the transmit power is increased.

The simulated power profiler can be found at:
https://devzone.nordicsemi.com/power/w/opp/14/online-power-profiler-for-wi-fi
14 changes: 14 additions & 0 deletions samples/wifi/offloaded_raw_tx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(nrf_wifi_offloaded_raw_tx)

target_sources(app PRIVATE
src/main.c
)
24 changes: 24 additions & 0 deletions samples/wifi/offloaded_raw_tx/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

source "Kconfig.zephyr"

menu "Offloaded Raw TX sample"

config GENERATE_MAC_ADDRESS
bool "Random Wi-Fi MAC address"
depends on ENTROPY_GENERATOR
help
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
int "Beacon interval in milliseconds"
default 100
range 20 10000
help
Time interval (in ms) between beacon transmissions.
endmenu
110 changes: 110 additions & 0 deletions samples/wifi/offloaded_raw_tx/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. _wifi_offloaded_raw_tx_packet_sample:

Wi-Fi: Offloaded raw TX
#######################

.. contents::
:local:
:depth: 2

The Offloaded raw TX sample demonstrates how to use the `Offloaded raw TX` APIs provided by the nRF70 driver for transmitting raw packets.

Requirements
************

The sample supports the following development kits:

.. table-from-sample-yaml::

Overview
********

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

Configuration
*************

|config|

Configuration options
=====================

.. options-from-kconfig::

Building and running
********************

.. |sample path| replace:: :file:`samples/wifi/offloaded_raw_tx`

.. include:: /includes/build_and_run_ns.txt

To build for the nRF7002 DK, use the ``nrf7002dk/nrf5340/cpuapp`` board target.

.. code-block:: console
west build -p -b nrf7002dk/nrf5340/cpuapp
To be able to generate beacons with random source MAC address and BSSID:

.. code-block:: console
west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_GENERATE_MAC_ADDRESS=y -DCONFIG_ENTROPY_GENERATOR=y
To be able to transmit beacons at a specified interval:

.. code-block:: console
west build -p -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_BEACON_INTERVAL=200
Change the board target as given below for the nRF7002 EK.

.. code-block:: console
nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek
Testing
=======

|test_sample|

#. |connect_kit|
#. |connect_terminal|

The sample shows the following output:

.. code-block:: console
*** 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 -----

Packets sent out, can be observed in a sniffer capture by filtering the packets by their transmit MAC address or SSID.
8 changes: 8 additions & 0 deletions samples/wifi/offloaded_raw_tx/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y
CONFIG_NRF70_OFFLOADED_RAW_TX=y

# Memories
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=18000
CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y
20 changes: 20 additions & 0 deletions samples/wifi/offloaded_raw_tx/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sample:
description: Wi-Fi Offloaded Raw Tx Packet sample
application
name: Wi-Fi Offloaded Raw Tx Packet sample
tests:
sample.nrf7002.offloaded_raw_tx:
sysbuild: true
build_only: true
integration_platforms:
- nrf7002dk/nrf5340/cpuapp
platform_allow: nrf7002dk/nrf5340/cpuapp
tags: ci_build sysbuild ci_samples_wifi
sample.nrf7002_eks.offloaded_raw_tx:
sysbuild: true
build_only: true
extra_args: SHIELD=nrf7002ek
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
platform_allow: nrf5340dk/nrf5340/cpuapp
tags: ci_build sysbuild ci_samples_wifi
Loading

0 comments on commit 4ef0bd6

Please sign in to comment.