Skip to content

Commit 7fc6406

Browse files
kapbhkrish2718
authored andcommitted
doc: wifi: Add Wi-Fi direct document
Add Wi-Fi direct (p2p mode) document. Signed-off-by: Kapil Bhatt <[email protected]>
1 parent 5a363da commit 7fc6406

File tree

3 files changed

+262
-1
lines changed

3 files changed

+262
-1
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: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
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 :ref:`wifi_shell_sample` sample with the ``wifi-p2p`` snippet and external flash for firmware patches.
17+
18+
Build command
19+
=============
20+
21+
To build the Wi-Fi shell sample with Wi-Fi Direct (P2P) support, run the following command:
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 provided for each operation.
33+
34+
Finding peers
35+
=============
36+
37+
To start discovering Wi-Fi Direct peers, use the following commands:
38+
39+
.. tabs::
40+
41+
.. group-tab:: Wi-Fi shell command
42+
43+
.. code-block:: console
44+
45+
wifi p2p find
46+
47+
.. group-tab:: ``wpa_cli`` command
48+
49+
.. code-block:: console
50+
51+
wpa_cli p2p_find
52+
53+
This command initiates the P2P discovery process.
54+
The device scans for other Wi-Fi Direct-capable devices in range.
55+
56+
Listing discovered peers
57+
========================
58+
59+
To view the list of discovered peers, use the following commands:
60+
61+
.. tabs::
62+
63+
.. group-tab:: Wi-Fi shell command
64+
65+
.. code-block:: console
66+
67+
wifi p2p peers
68+
69+
.. group-tab:: ``wpa_cli`` command
70+
71+
.. code-block:: console
72+
73+
wpa_cli p2p_peers
74+
75+
This command displays a table of discovered peers with the following information:
76+
77+
.. code-block:: console
78+
79+
Num | Device Name | MAC Address | RSSI | Device Type | Config Methods
80+
1 | Galaxy S22 | D2:39:FA:43:23:C1 | -58 | 10-0050F204-5 | 0x188
81+
82+
The columns in the table represent the following attributes:
83+
84+
* ``Num`` - Sequential number of the peer in the list
85+
* ``Device Name`` - Friendly name of the peer device
86+
* ``MAC Address`` - MAC address of the peer device
87+
* ``RSSI`` - Signal strength in dBm
88+
* ``Device Type`` - WPS device type identifier
89+
* ``Config Methods`` - Supported WPS configuration methods
90+
91+
Getting peer details
92+
====================
93+
94+
To get detailed information about a specific peer, use the following commands:
95+
96+
.. tabs::
97+
98+
.. group-tab:: Wi-Fi shell command
99+
100+
.. code-block:: console
101+
102+
wifi p2p peer <mac_address>
103+
104+
.. group-tab:: ``wpa_cli`` command
105+
106+
.. code-block:: console
107+
108+
wpa_cli p2p_peer <mac_address>
109+
110+
For example:
111+
112+
.. code-block:: console
113+
114+
wpa_cli p2p_peer D2:39:FA:43:23:C1
115+
116+
This command displays detailed information about the specified peer device.
117+
118+
Connecting to a peer
119+
====================
120+
121+
To establish a Wi-Fi Direct connection with a discovered peer:
122+
123+
.. tabs::
124+
125+
.. group-tab:: Wi-Fi shell command
126+
127+
.. code-block:: console
128+
129+
wifi p2p connect <mac_address> <pin|pbc> -g <go_intent>
130+
131+
.. group-tab:: ``wpa_cli`` command
132+
133+
.. code-block:: console
134+
135+
wpa_cli p2p_connect <mac_address> <pin|pbc> go_intent=<go_intent>
136+
137+
Parameters:
138+
139+
* ``<mac_address>`` - MAC address of the peer device to connect to.
140+
* ``<pbc|pin>`` - WPS provisioning method:
141+
142+
* ``pin`` - Uses PIN-based WPS authentication.
143+
The command returns a PIN (for example, ``88282282``) that must be entered on the peer device.
144+
* ``pbc`` - Uses Push Button Configuration (PBC) for WPS authentication.
145+
146+
* ``go_intent`` - Group Owner (GO) intent value ``0-15``:
147+
148+
* Higher values indicate a stronger preference to become the Group Owner.
149+
* A value of ``15`` forces the device to become the GO.
150+
* A value of ``0`` indicates the device prefers to be a client.
151+
152+
Example connection using the PIN method:
153+
154+
.. tabs::
155+
156+
.. group-tab:: Wi-Fi shell command
157+
158+
.. code-block:: console
159+
160+
wifi p2p connect D2:39:FA:43:23:C1 pin -g 0
161+
162+
.. group-tab:: ``wpa_cli`` command
163+
164+
.. code-block:: console
165+
166+
wpa_cli p2p_connect D2:39:FA:43:23:C1 pin go_intent=0
167+
168+
The command outputs a PIN (for example, ``88282282``), which must be entered on the peer device to complete the connection.
169+
170+
To disconnect from a Wi-Fi Direct connection, use the following commands:
171+
172+
.. tabs::
173+
174+
.. group-tab:: Wi-Fi shell command
175+
176+
.. code-block:: console
177+
178+
wifi disconnect
179+
180+
.. group-tab:: ``wpa_cli`` command
181+
182+
.. code-block:: console
183+
184+
wpa_cli disconnect
185+
186+
Creating a P2P group (GO mode)
187+
==============================
188+
189+
To create a P2P group and start as the GO, use the following commands:
190+
191+
.. tabs::
192+
193+
.. group-tab:: Wi-Fi shell command
194+
195+
.. code-block:: console
196+
197+
wifi p2p group_add
198+
199+
.. group-tab:: ``wpa_cli`` command
200+
201+
.. code-block:: console
202+
203+
wpa_cli p2p_group_add
204+
205+
This command creates a P2P group with the device acting as the GO, allowing other devices to connect to it.
206+
207+
Inviting a peer to a P2P group
208+
==============================
209+
210+
To invite a peer to join an existing P2P group, use the following commands:
211+
212+
.. tabs::
213+
214+
.. group-tab:: Wi-Fi shell command
215+
216+
.. code-block:: console
217+
218+
wifi p2p invite -g <Group interface name> -P <mac_address>
219+
220+
.. group-tab:: ``wpa_cli`` command
221+
222+
.. code-block:: console
223+
224+
wpa_cli p2p_invite group=<Group interface name> peer=<mac_address>
225+
226+
Example:
227+
228+
.. tabs::
229+
230+
.. group-tab:: Wi-Fi shell command
231+
232+
.. code-block:: console
233+
234+
wifi p2p invite -g wlan0 -P D2:39:FA:43:23:C1
235+
236+
.. group-tab:: ``wpa_cli`` command
237+
238+
.. code-block:: console
239+
240+
wpa_cli p2p_invite group=wlan0 peer=D2:39:FA:43:23:C1
241+
242+
Setting P2P power save mode
243+
===========================
244+
245+
To enable or disable P2P power save mode, use the following commands:
246+
247+
.. tabs::
248+
249+
.. group-tab:: Wi-Fi shell command
250+
251+
.. code-block:: console
252+
253+
wifi p2p power_save <on|off>
254+
255+
.. group-tab:: ``wpa_cli`` command
256+
257+
.. code-block:: console
258+
259+
wpa_cli p2p_set ps <1|0>

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ Thread
299299
Wi-Fi®
300300
------
301301

302-
|no_changes_yet_note|
302+
* Added support for Wi-Fi Direct (P2P) mode.
303+
See :ref:`ug_wifi_direct` for details.
303304

304305
Applications
305306
============

0 commit comments

Comments
 (0)