• Home
Name Date Size #Lines LOC

..--

CMakeLists.txtD03-May-20241.8 KiB4641

Makefile.amD03-May-20247.5 KiB168110

README.mdD03-May-20242.2 KiB12694

cli_uart.cppD03-May-20249.9 KiB392268

ftd.cmakeD03-May-20242 KiB5246

main.cD03-May-20244.2 KiB14380

mtd.cmakeD03-May-20242 KiB5246

radio.cmakeD03-May-20242.1 KiB5750

README.md

1# OpenThread CLI Example
2
3This example application exposes OpenThread configuration and management APIs via a simple command-line interface. The steps below take you through the minimal steps required to ping one emulated Thread device from another emulated Thread device.
4
5## 1. Build
6
7```bash
8$ cd <path-to-openthread>
9$ ./bootstrap
10$ make -f examples/Makefile-simulation
11```
12
13## 2. Start node 1
14
15Spawn the process:
16
17```bash
18$ cd <path-to-openthread>/output/<platform>/bin
19$ ./ot-cli-ftd 1
20```
21
22Generate, view, and commit a new Active Operational Dataset:
23
24```bash
25> dataset init new
26Done
27> dataset
28Active Timestamp: 1
29Channel: 13
30Channel Mask: 0x07fff800
31Ext PAN ID: d63e8e3e495ebbc3
32Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
33Network Key: dfd34f0f05cad978ec4e32b0413038ff
34Network Name: OpenThread-8f28
35PAN ID: 0x8f28
36PSKc: c23a76e98f1a6483639b1ac1271e2e27
37Security Policy: 0, onrc
38Done
39> dataset commit active
40Done
41```
42
43Bring up the IPv6 interface:
44
45```bash
46> ifconfig up
47Done
48```
49
50Start Thread protocol operation:
51
52```bash
53> thread start
54Done
55```
56
57Wait a few seconds and verify that the device has become a Thread Leader:
58
59```bash
60> state
61leader
62Done
63```
64
65View IPv6 addresses assigned to Node 1's Thread interface:
66
67```bash
68> ipaddr
69fd3d:b50b:f96d:722d:0:ff:fe00:fc00
70fd3d:b50b:f96d:722d:0:ff:fe00:c00
71fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
72fe80:0:0:0:6c41:9001:f3d6:4148
73Done
74```
75
76## 2. Start node 2
77
78Spawn the process:
79
80```bash
81$ cd <path-to-openthread>/output/<platform>/bin
82$ ./ot-cli-ftd 2
83```
84
85Configure Thread Network Key from Node 1's Active Operational Dataset:
86
87```bash
88> dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
89Done
90> dataset commit active
91Done
92```
93
94Bring up the IPv6 interface:
95
96```bash
97> ifconfig up
98Done
99```
100
101Start Thread protocol operation:
102
103```bash
104> thread start
105Done
106```
107
108Wait a few seconds and verify that the device has become a Thread Child or Router:
109
110```bash
111> state
112child
113Done
114```
115
116## 3. Ping Node 1 from Node 2
117
118```bash
119> ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117
12016 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms
121```
122
123## 4. Explore More
124
125See the [OpenThread CLI Reference README.md](../../../src/cli/README.md) to explore more.
126