Skip to content

Commit ff52ed8

Browse files
committed
doc: wifi: Add Wi-Fi direct document
Add Wi-Fi direct (p2p mode) document. Signed-off-by: Kapil Bhatt <[email protected]>
1 parent c01b222 commit ff52ed8

File tree

2 files changed

+171
-0
lines changed

2 files changed

+171
-0
lines changed

doc/nrf/protocols/wifi/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ If you want to go through an online training course to familiarize yourself with
3333
station_mode/index
3434
scan_mode/index
3535
sap_mode/index
36+
wifi_direct
3637
advanced_modes/index
3738
provisioning/index
3839
regulatory_support
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
.. _ug_wifi_direct:
2+
3+
Wi-Fi Direct (P2P mode)
4+
#######################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
Wi-Fi Direct® (also known as Wi-Fi P2P or peer-to-peer mode) enables direct device-to-device connections without requiring a traditional access point.
11+
The nRF70 Series devices support Wi-Fi Direct, allowing you to establish peer-to-peer connections with other Wi-Fi Direct-capable devices.
12+
13+
Building with Wi-Fi Direct support
14+
***********************************
15+
16+
To build an application with Wi-Fi Direct support, use the Wi-Fi shell sample with the ``wifi-p2p`` snippet and external flash for firmware patches.
17+
18+
Build command
19+
=============
20+
21+
Use the following command to build the Wi-Fi shell sample with P2P support:
22+
23+
.. code-block:: console
24+
25+
west build --pristine --board nrf7002dk/nrf5340/cpuapp -S wifi-p2p -S nrf70-fw-patch-ext-flash
26+
west flash
27+
28+
Wi-Fi Direct commands
29+
**********************
30+
31+
The following commands are available for Wi-Fi Direct operations.
32+
Both Wi-Fi shell commands and wpa_cli commands are shown for each operation:
33+
34+
Finding peers
35+
=============
36+
37+
To start discovering Wi-Fi Direct peers:
38+
39+
**Wi-Fi shell command:**
40+
41+
.. code-block:: console
42+
43+
wifi p2p find
44+
45+
**wpa_cli command:**
46+
47+
.. code-block:: console
48+
49+
wpa_cli p2p_find
50+
51+
This command initiates the P2P discovery process. The device will scan for other Wi-Fi Direct-capable devices in range.
52+
53+
Listing discovered peers
54+
=========================
55+
56+
To view the list of discovered peers:
57+
58+
**Wi-Fi shell command:**
59+
60+
.. code-block:: console
61+
62+
wifi p2p peer
63+
64+
**wpa_cli command:**
65+
66+
.. code-block:: console
67+
68+
wpa_cli p2p_peers
69+
70+
This displays a table of discovered peers with the following information:
71+
72+
.. code-block:: console
73+
74+
Num | Device Name | MAC Address | RSSI | Device Type | Config Methods
75+
1 | Galaxy S22 | D2:39:FA:43:23:C1 | -58 | 10-0050F204-5 | 0x188
76+
77+
Where:
78+
79+
* **Num** - Sequential number of the peer in the list
80+
* **Device Name** - Friendly name of the peer device
81+
* **MAC Address** - MAC address of the peer device
82+
* **RSSI** - Signal strength in dBm
83+
* **Device Type** - WPS device type identifier
84+
* **Config Methods** - Supported WPS configuration methods
85+
86+
Getting peer details
87+
====================
88+
89+
To get detailed information about a specific peer:
90+
91+
**Wi-Fi shell command:**
92+
93+
.. code-block:: console
94+
95+
wifi p2p peer <mac_address>
96+
97+
**wpa_cli command:**
98+
99+
.. code-block:: console
100+
101+
wpa_cli p2p_peer <mac_address>
102+
103+
For example:
104+
105+
.. code-block:: console
106+
107+
wpa_cli p2p_peer D2:39:FA:43:23:C1
108+
109+
This displays detailed information about the specified peer device.
110+
111+
Connecting to a peer
112+
====================
113+
114+
To establish a Wi-Fi Direct connection with a discovered peer:
115+
116+
**Wi-Fi shell command:**
117+
118+
.. code-block:: console
119+
120+
wifi p2p connect <mac_address> [pin|pbc] -g <go_intent>
121+
122+
**wpa_cli command:**
123+
124+
.. code-block:: console
125+
126+
wpa_cli p2p_connect <mac_address> <pbc|pin> [go_intent=<0..15>]
127+
128+
Parameters:
129+
130+
* **mac_address** - MAC address of the peer device to connect to
131+
* **pin|pbc** - WPS provisioning method:
132+
133+
* ``pin`` - Use PIN-based WPS authentication. The command will return a PIN (for example, ``88282282``) that must be entered on the peer device.
134+
* ``pbc`` - Use Push Button Configuration (PBC) for WPS authentication.
135+
136+
* **go_intent** - Group Owner (GO) intent value (0-15):
137+
138+
* Higher values indicate a stronger desire to become the Group Owner
139+
* Value of 15 forces the device to become the GO
140+
* Value of 0 indicates the device prefers to be a client
141+
142+
Example connection with PIN method:
143+
144+
**Wi-Fi shell command:**
145+
146+
.. code-block:: console
147+
148+
wifi p2p connect D2:39:FA:43:23:C1 pin -g 0
149+
150+
**wpa_cli command:**
151+
152+
.. code-block:: console
153+
154+
wpa_cli p2p_connect D2:39:FA:43:23:C1 pin go_intent=0
155+
156+
The command will output a PIN (for example, ``88282282``) that should be entered on the peer device to complete the connection.
157+
158+
To disconnect from a Wi-Fi Direct connection:
159+
160+
**Wi-Fi shell command:**
161+
162+
.. code-block:: console
163+
164+
To be added
165+
166+
**wpa_cli command:**
167+
168+
.. code-block:: console
169+
170+
wpa_cli disconnect

0 commit comments

Comments
 (0)