openthread: enrich documentation for openthread examples

This commit is contained in:
Shu Chen 2021-09-09 21:08:57 +08:00
parent 028ff956b2
commit c09633d41b
23 changed files with 308 additions and 369 deletions

View File

@ -49,11 +49,11 @@ ESP_EVENT_DECLARE_BASE(OPENTHREAD_EVENT);
*
*/
typedef struct {
fd_set read_fds; /*!< The read file descriptors.*/
fd_set write_fds; /*!< The write file descriptors.*/
fd_set error_fds; /*!< The error file descriptors.*/
int max_fd; /*!< The max file descriptor.*/
struct timeval timeout; /*!< The timeout.*/
fd_set read_fds; /*!< The read file descriptors */
fd_set write_fds; /*!< The write file descriptors */
fd_set error_fds; /*!< The error file descriptors */
int max_fd; /*!< The max file descriptor */
struct timeval timeout; /*!< The timeout */
} esp_openthread_mainloop_context_t;
/**
@ -61,8 +61,8 @@ typedef struct {
*
*/
typedef struct {
uart_port_t port; /*!< UART port number*/
uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs*/
uart_port_t port; /*!< UART port number */
uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs */
int rx_pin; /*!< UART RX pin */
int tx_pin; /*!< UART TX pin */
} esp_openthread_uart_config_t;
@ -72,9 +72,9 @@ typedef struct {
*
*/
typedef enum {
RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio*/
RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP)*/
RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP)*/
RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio */
RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP) */
RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP) */
} esp_openthread_radio_mode_t;
/**
@ -82,9 +82,9 @@ typedef enum {
*
*/
typedef enum {
HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection*/
HOST_CONNECTION_MODE_CLI_UART = 0x1, /*!< CLI UART connection to the host*/
HOST_CONNECTION_MODE_RCP_UART = 0x2, /*!< RCP UART connection to the host*/
HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection */
HOST_CONNECTION_MODE_CLI_UART = 0x1, /*!< CLI UART connection to the host */
HOST_CONNECTION_MODE_RCP_UART = 0x2, /*!< RCP UART connection to the host */
} esp_openthread_host_connection_mode_t;
/**
@ -92,8 +92,8 @@ typedef enum {
*
*/
typedef struct {
esp_openthread_radio_mode_t radio_mode; /*!< The radio mode*/
esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP*/
esp_openthread_radio_mode_t radio_mode; /*!< The radio mode */
esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP */
} esp_openthread_radio_config_t;
/**
@ -101,8 +101,8 @@ typedef struct {
*
*/
typedef struct {
esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode*/
esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host*/
esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode */
esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host */
} esp_openthread_host_connection_config_t;
/**
@ -110,9 +110,9 @@ typedef struct {
*
*/
typedef struct {
const char *storage_partition_name; /*!< The partition for storing OpenThread dataset*/
uint8_t netif_queue_size; /*!< The packet queue size for the network interface*/
uint8_t task_queue_size; /*!< The task queue size*/
const char *storage_partition_name; /*!< The partition for storing OpenThread dataset */
uint8_t netif_queue_size; /*!< The packet queue size for the network interface */
uint8_t task_queue_size; /*!< The task queue size */
} esp_openthread_port_config_t;
/**
@ -120,9 +120,9 @@ typedef struct {
*
*/
typedef struct {
esp_openthread_radio_config_t radio_config; /*!< The radio configuration*/
esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration*/
esp_openthread_port_config_t port_config; /*!< The port configuration*/
esp_openthread_radio_config_t radio_config; /*!< The radio configuration */
esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration */
esp_openthread_port_config_t port_config; /*!< The port configuration */
} esp_openthread_platform_config_t;
#ifdef __cplusplus

View File

@ -0,0 +1,13 @@
# OpenThread Examples
See the [README.md](../README.md) file in the upper level [examples](../) directory for more information about examples.
## Overview
In this folder, it contains following OpenThread examples:
* [ot_cli](ot_cli) is an OpenThread Command Line example, in addition to the features listed in [OpenThread CLI](https://github.com/openthread/openthread/blob/master/src/cli/README.md), it supports some additional features such as TCP, UDP and Iperf over lwIP. It runs on an 802.15.4 SoC like ESP32-H2.
* [ot_rcp](ot_rcp) is an [OpenThread RCP](https://openthread.io/platforms/co-processor) example. It runs on an 802.15.4 SoC like ESP32-H2, to extend 802.15.4 radio.
* [ot_br](ot_br) is an [OpenThread Border Router](https://openthread.io/guides/border-router) example. It runs on a Wi-Fi SoC such as ESP32, ESP32-C3 and ESP32-S3. It needs an 802.15.4 SoC like ESP32-H2 running [ot_rcp](ot_rcp) example to provide 802.15.4 radio.

View File

@ -1,4 +1,4 @@
# OpenThread Border Router example
# OpenThread Border Router Example
## Overview
@ -6,9 +6,20 @@ This example demonstrates an [OpenThread border router](https://openthread.io/gu
## How to use example
### Hardware connection
### Hardware Required
To run this example, it's used to use an DevKit C board and connect PIN4 and PIN5 to the UART TX and RX port of another 15.4 capable radio co-processor ([RCP](https://openthread.io/platforms/co-processor?hl=en))
Two SoCs are required to run this example:
* An ESP32 series Wi-Fi SoC (ESP32, ESP32-C, ESP32-S, etc) loaded with this ot_br example.
* An ESP32-H2 802.15.4 SoC loaded with [ot_rcp](../ot_rcp) example.
Connect the two SoCs via UART, below is an example setup with ESP32 DevKitC and ESP32-H2 DevKitC:
![thread_br](image/thread-border-router-esp32-esp32h2.jpg)
ESP32 pin | ESP32-H2 pin
----------|-------------
GND | G
GPIO4 | TX
GPIO5 | RX
### Configure the project

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

View File

@ -1,4 +1,4 @@
menu "Example Configuration"
menu "OpenThread Border Router Example"
config OPENTHREAD_NETWORK_NAME
string "OpenThread network name"

View File

@ -1,16 +1,11 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
/* OpenThread Border Router Example
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include <string.h>

View File

@ -1,16 +1,11 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
/* OpenThread Border Router Example
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -49,3 +49,9 @@ CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
#
CONFIG_MDNS_STRICT_MODE=y
# end of mDNS
#
# ESP System Settings
#
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3584
# end of ESP System Settings

View File

@ -1,14 +1,15 @@
# OpenThread command line example
| Supported Targets | ESP32-H2 |
| ----------------- | -------- |
## Overview
# OpenThread Command Line Example
This example demonstrates a [basic OpenThread command line](https://github.com/openthread/openthread/blob/master/src/cli/README.md).
This example demonstrates an [OpenThread CLI](https://github.com/openthread/openthread/blob/master/src/cli/README.md), with some additional features such as TCP, UDP and Iperf.
## How to use example
### Hardware connection
### Hardware Required
To run this example, it's used to use an DevKit C board and connect PIN4 and PIN5 to the UART TX and RX port of another 15.4 capable radio co-processor ([RCP](https://openthread.io/platforms/co-processor?hl=en))
To run this example, an ESP32-H2 board is required.
### Configure the project
@ -26,56 +27,57 @@ Build the project and flash it to the board, then run monitor tool to view seria
idf.py -p PORT build flash monitor
```
Now you'll get an interactive OpenThread command line shell.
Now you'll get an OpenThread command line shell.
## Example Output
### Example Output
The `help` command will print all of the supported commands.
```bash
I (1540) OPENTHREAD: [INFO]-PLAT----: RCP reset: RESET_POWER_ON
I (1610) OPENTHREAD: [NOTE]-PLAT----: RCP API Version: 3
I (1840) OPENTHREAD: [INFO]-CORE----: Non-volatile: Read NetworkInfo {rloc:0x7404, extaddr:aee4a5cc7ed1ad88, role:Child, mode:0x0f, version:2, keyseq:0x0, ...
I (1850) OPENTHREAD: [INFO]-CORE----: Non-volatile: ... pid:0x1161bcdc, mlecntr:0x5a17, maccntr:0x5a91, mliid:33158c466ab576d4}
I (1900) OPENTHREAD: [INFO]-CORE----: Non-volatile: Read ParentInfo {extaddr:36505631b12ea5e3, version:2}
I (1900) OPENTHREAD: [INFO]-CORE----: Notifier: StateChanged (0x1007c300) [KeySeqCntr NetData Channel PanId NetName ExtPanId MstrKey ActDset]
> help
I(7058) OPENTHREAD:[INFO]-CLI-----: execute command: help
bbr
bufferinfo
ccathreshold
channel
child
childip
childmax
childsupervision
childtimeout
coap
contextreusedelay
counters
dataset
delaytimermin
diag
discover
dns
domainname
eidcache
eui64
extaddr
extpanid
factoryreset
...
```
## Set Up Network
To run this example, at least two ESP32-H2 boards flashed with this ot_cli example are required.
On the first device, run the following commands:
```bash
> factoryreset
... # the device will reboot
> ifconfig up
I (11320) OPENTHREAD: [INFO]-CLI-----: execute command: ifconfig up
Done
I (11340) OPENTHREAD: [INFO]-CORE----: Notifier: StateChanged (0x01001009) [Ip6+ LLAddr Ip6Mult+ NetifState]
> dataset init new
I (105650) OPENTHREAD: [INFO]-CLI-----: execute command: dataset init new
Done
> dataset
I (107460) OPENTHREAD: [INFO]-CLI-----: execute command: dataset
Active Timestamp: 1
Channel: 14
Channel Mask: 0x07fff800
Ext PAN ID: d9d69bf6535735ec
Mesh Local Prefix: fd73:192f:f27:2a5c::/64
Master Key: 7ad0ec87abbd8c41f07d004922b480bf
Network Name: OpenThread-a5fe
PAN ID: 0xa5fe
PSKc: ef028c933febdeb226f6681cc780272a
Security Policy: 672, onrcb
Done
> dataset commit active
I (134350) OPENTHREAD: [INFO]-CLI-----: execute command: dataset commit active
I (134350) OPENTHREAD: [INFO]-MESH-CP-: Active dataset set
Done
I (134380) OPENTHREAD: [INFO]-CORE----: Notifier: StateChanged (0x101fc110) [MLAddr KeySeqCntr Channel PanId NetName ExtPanId MstrKey PSKc SecPolicy ...
I (134390) OPENTHREAD: [INFO]-CORE----: Notifier: StateChanged (0x101fc110) ... ActDset]
>thread start
I (177250) OPENTHREAD: [INFO]-CLI-----: execute command: thread start
I (177250) OPENTHREAD: [NOTE]-MLE-----: Role Disabled -> Detached
I (177280) OPENTHREAD: [INFO]-CORE----: Non-volatile: Read NetworkInfo {rloc:0x7404, extaddr:aee4a5cc7ed1ad88, role:Child, mode:0x0f, version:2, keyseq:0x0, ...
I (177290) OPENTHREAD: [INFO]-CORE----: Non-volatile: ... pid:0x1161bcdc, mlecntr:0x5a17, maccntr:0x5a91, mliid:33158c466ab576d4}
I (194054) OPENTHREAD: [INFO]-CORE----: Non-volatile: Saved NetworkInfo {rloc:0x7404, extaddr:aee4a5cc7ed1ad88, role:Child, mode:0x0f, version:2, keyseq:0x0, ...
I (194064) OPENTHREAD: [INFO]-CORE----: Non-volatile: ... pid:0x1161bcdc, mlecntr:0x5e00, maccntr:0x5e79, mliid:33158c466ab576d4}
I (194074) OPENTHREAD: [INFO]-MLE-----: Send Child Update Request to parent (fe80:0:0:0:3450:5631:b12e:a5e3)
Done
> ifconfig up
Done
> thread start
Done
# After some seconds
@ -83,195 +85,80 @@ Done
leader
Done
```
## Example1: Set up network
You need to prepare two esp32h2(or two ESP devices each connected to a 15.4 RCP) and flashed with this example.
### Step 1 Configure the project
Now the first device has formed a Thread network as a leader. Get some information which will be used in next steps:
```bash
idf.py menuconfig
> ipaddr
fdde:ad00:beef:0:0:ff:fe00:fc00
fdde:ad00:beef:0:0:ff:fe00:8000
fdde:ad00:beef:0:a7c6:6311:9c8c:271b
fe80:0:0:0:5c27:a723:7115:c8f8
# Get the Active Dataset
> dataset active -x
0e080000000000010000000300001835060004001fffe00208fe7bb701f5f1125d0708fd75cbde7c6647bd0510b3914792d44f45b6c7d76eb9306eec94030f4f70656e5468726561642d35383332010258320410e35c581af5029b054fc904a24c2b27700c0402a0fff8
```
### Step 2 Build, Flash, and Run
```
idf.py -p PORT flash monitor
```
### Step 3 Set up network
On the first device, run:
On the second device, set the active dataset from leader, and start Thread interface:
```bash
> extaddr 166e0a0000000001
Done
> dataset channel 17
Done
> dataset panid 0xface
Done
> dataset extpanid 000db80000000000
Done
> dataset networkname GRL
Done
> dataset masterkey 00112233445566778899aabbccddeeff
Done
> dataset meshlocalprefix FD00:0DB8:0000:0000::
Done
> dataset pskc 00000000000000000000000000000000
Done
> dataset activetimestamp 1
Done
> dataset commit active
Done
> factoryreset
... # the device will reboot
> dataset set active 0e080000000000010000000300001835060004001fffe00208fe7bb701f5f1125d0708fd75cbde7c6647bd0510b3914792d44f45b6c7d76eb9306eec94030f4f70656e5468726561642d35383332010258320410e35c581af5029b054fc904a24c2b27700c0402a0fff8
> ifconfig up
Done
> thread start
Done
# After some seconds
> state
leader
Done
```
Now the first device has formed a Thread network, on the second device run:
```bash
> extaddr 166e0a0000000002
Done
> dataset channel 17
Done
> dataset panid 0xface
Done
> dataset extpanid 000db80000000000
Done
> dataset networkname GRL
Done
> dataset masterkey 00112233445566778899aabbccddeeff
Done
> dataset meshlocalprefix FD00:0DB8:0000:0000::
Done
> dataset pskc 00000000000000000000000000000000
Done
> dataset activetimestamp 1
Done
> dataset commit active
Done
> ifconfig up
Done
> thread start
Done
# After some seconds
# After some seconds
> state
router # child is also a valid state
Done
```
The second device has joined the Thread network as a router (or a child).
Now the second device has joined the Thread network and acting as a router (or a child).
## Example2: TCP/UDP server and client
You need to prepare two ESP devices each connected to a 15.4 RCP and flashed with this example.
### Step 1 Configure the project and Set up network
## TCP and UDP Example
On the leader device, start a TCP or UDP server:
```bash
idf.py menuconfig
```
Enable the operation: Example Configuration -> Enable custom command in ot-cli
After configuring the project project, you should follow 'Example1' to set up network.
### Step 2 Set up tcp/udp socket server and client
In leader device, run this command in command line shell.
```bash
# for setup a tcp server
> tcpsockserver
# for setup an udp server
Done
I (1310225) ot_socket: Socket created
I (1310225) ot_socket: Socket bound, port 12345
I (1310225) ot_socket: Socket listening, timeout is 30 seconds
```
or (UDP Server)
```bash
> udpsockserver
Done
I (1339815) ot_socket: Socket created
I (1339815) ot_socket: Socket bound, port 54321
I (1339815) ot_socket: Waiting for data, timeout is 30 seconds
Done
```
Then run this command to get the leader IPv6 address.
On router device, start a TCP or UDP client (replace with the leader's IPv6 address):
```bash
> ipaddr
fd00:db8:0:0:0:ff:fe00:fc00
fd00:db8:0:0:0:ff:fe00:ac00
fd00:db8:0:0:284a:cb4a:cb3b:2a42
fe80:0:0:0:146e:a00:0:1
> tcpsockclient fdde:ad00:beef:0:a7c6:6311:9c8c:271b
Done
ot_socket: Socket created, connecting to fdde:ad00:beef:0:a7c6:6311:9c8c:271b:12345
ot_socket: Successfully connected
...
```
In router device, run this command to set up a socket client in command line shell.
or (UDP Client)
```bash
# for setup a tcp client
> tcpsockclient fd00:db8:0:0:284a:cb4a:cb3b:2a42
# for setup an udp client
> udpsockclient fd00:db8:0:0:284a:cb4a:cb3b:2a42
> udpsockclient fdde:ad00:beef:0:a7c6:6311:9c8c:271b
Done
ot_socket: Socket created, sending to fdde:ad00:beef:0:a7c6:6311:9c8c:271b:54321
ot_socket: Message sent
...
```
You will get
### Iperf Example
```bash
# in leader device
> tcpsockserver
I(173437) OPENTHREAD:[INFO]-CLI-----: execute command: tcpsockserver
> I (173437) ot_secket: Socket created
I (173437) ot_secket: Socket bound, port 12345
I (173457) ot_secket: Socket listening, timeout is 30 seconds
I(175007) OPENTHREAD:[INFO]-MLE-----: Send Advertisement (ff02:0:0:0:0:0:0:1)
......
I (182187) ot_secket: Received 28 bytes from client:
I (182187) ot_secket: This message is from client
I (182187) ot_secket: Socket accepted ip address: FD00:DB8::498:DDB:EC7:49DC
I (182189) ot_secket: Socket server is closed.
# in router device
> tcpsockclient fd00:db8:0:0:284a:cb4a:cb3b:2a42
I(37731) OPENTHREAD:[INFO]-CLI-----: execute command: tcpsockclient fd00:db8:0:0:284a:cb4a:cb3b:2a42
> I (37741) ot_secket: Socket created, connecting to b80d00fd:0:4acb4a28:422a3bcb:12345
I(37751) OPENTHREAD:[INFO]-ARP-----: Sending address query for fd00:db8:0:0:284a:cb4a:cb3b:2a42
......
I (38171) ot_secket: Successfully connected
......
I (38321) ot_secket: Received 28 bytes from fd00:db8:0:0:284a:cb4a:cb3b:2a42
I (38321) ot_secket: This message is from server
I (38323) ot_secket: Socket client is closed.
```
## Example3 iperf:
### Step 1 Configure the project and Set up network
```bash
idf.py menuconfig
```
Enable the operation: Openthread -> Enable custom command in ot-cli
After configuring the project project, you should follow 'Example1' to set up network.
### Step 2 Iperf test:
Run this command for iperf help:
Print the iperf help:
```bash
iperf
I(272113) OPENTHREAD:[INFO]-CLI-----: execute command: iperf
---iperf parameter---
-s : server mode, only receive
-u : upd mode
@ -287,32 +174,56 @@ create a udp client : iperf -c <addr> -u -i 3 -t 60 -p 5001 -l 512
Done
```
In leader device, run this command to get the leader IPv6 address.
On the leader device, start iperf TCP or UDP server:
```bash
> ipaddr
fd00:db8:0:0:0:ff:fe00:fc00
fd00:db8:0:0:0:ff:fe00:ac00
fd00:db8:0:0:284a:cb4a:cb3b:2a42
fe80:0:0:0:146e:a00:0:1
```
Then run this command in command line shell.
```bash
# for setting up an iperf tcp server
> iperf -V -s -i 3 -p 5001 -t 20
# for setting up an iperf udp server
i:3
dp:5001
sp:5001
t:20
Done
```
or (UDP Server)
```bash
> iperf -V -s -u -i 3 -p 5001 -t 20
i:3
dp:5001
sp:5001
t:20
Done
```
In router device, run this command in command line shell.
On the router device, start iperf TCP or UDP client:
```bash
# for setting up an iperf tcp client
> iperf -V -c fd00:db8:0:0:284a:cb4a:cb3b:2a42 -i 1 -t 14 -p 5001 -l 512
# for setting up an iperf udp client
> iperf -V -c fd00:db8:0:0:284a:cb4a:cb3b:2a42 -u -i 1 -t 14 -p 5001 -l 512
> iperf -V -c fdde:ad00:beef:0:a7c6:6311:9c8c:271b -i 1 -t 5 -p 5001 -l 85
ip:fdde:ad00:beef:0:a7c6:6311:9c8c:271b
i:1
t:5
dp:5001
sp:5001
Done
Interval Bandwidth
0- 1 sec 0.05 Mbits/sec
1- 2 sec 0.05 Mbits/sec
2- 3 sec 0.05 Mbits/sec
3- 4 sec 0.05 Mbits/sec
4- 5 sec 0.05 Mbits/sec
0- 5 sec 0.05 Mbits/sec
```
or (UDP Client)
```bash
> iperf -V -c fdde:ad00:beef:0:a7c6:6311:9c8c:271b -u -i 1 -t 5 -p 5001 -l 85
ip:fdde:ad00:beef:0:a7c6:6311:9c8c:271b
i:1
t:5
dp:5001
sp:5001
Done
0- 1 sec 0.05 Mbits/sec
1- 2 sec 0.05 Mbits/sec
2- 3 sec 0.05 Mbits/sec
3- 4 sec 0.05 Mbits/sec
4- 5 sec 0.05 Mbits/sec
0- 5 sec 0.05 Mbits/sec
```

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "esp_openthread.h"

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "esp_check.h"

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "esp_check.h"
@ -108,7 +111,7 @@ static void tcp_socket_client_task(void *pvParameters)
client_sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_IPV6);
ESP_GOTO_ON_FALSE((client_sock >= 0), ESP_OK, exit, TAG, "Unable to create socket: errno %d", errno);
ESP_LOGI(TAG, "Socket created, connecting to %x:%x:%x:%x:%d", dest_addr.sin6_addr.un.u32_addr[0], dest_addr.sin6_addr.un.u32_addr[1], dest_addr.sin6_addr.un.u32_addr[2], dest_addr.sin6_addr.un.u32_addr[3], port);
ESP_LOGI(TAG, "Socket created, connecting to %s:%d", host_ip, port);
err = connect(client_sock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr_in6));
ESP_GOTO_ON_FALSE((err == 0), ESP_FAIL, exit, TAG, "Socket unable to connect: errno %d", errno);

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "esp_check.h"

View File

@ -1,7 +1,10 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
/* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once
@ -17,7 +20,7 @@ extern "C" {
void esp_ot_process_udp_server(void *aContext, uint8_t aArgsLength, char *aArgs[]);
/**
* @brief Yser command "udpsockserver" process.
* @brief User command "udpsockclient" process.
*
*/
void esp_ot_process_udp_client(void *aContext, uint8_t aArgsLength, char *aArgs[]);

View File

@ -1,3 +1,4 @@
CONFIG_IDF_TARGET="esp32h2"
#
# libsodium
#
@ -17,12 +18,13 @@ CONFIG_PARTITION_TABLE_MD5=y
#
# mbedTLS
#
# ESP32H2-TODO: enable HW acceleration
CONFIG_MBEDTLS_HARDWARE_AES=n
CONFIG_MBEDTLS_HARDWARE_MPI=n
CONFIG_MBEDTLS_HARDWARE_SHA=n
CONFIG_MBEDTLS_CMAC_C=y
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y
# end of TLS Key Exchange Methods
CONFIG_MBEDTLS_ECJPAKE_C=y
# end of mbedTLS
@ -30,6 +32,7 @@ CONFIG_MBEDTLS_ECJPAKE_C=y
# OpenThread
#
CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_BORDER_ROUTER=n
# end of OpenThread
#
@ -39,3 +42,9 @@ CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
CONFIG_LWIP_MULTICAST_PING=y
# end of lwIP
#
# IEEE 802.15.4
#
CONFIG_IEEE802154_ENABLED=y
# end of IEEE 802.15.4

View File

@ -1,21 +0,0 @@
#
# mbedTLS
#
# ESP32H2-TODO: enable HW acceleration
CONFIG_MBEDTLS_HARDWARE_AES=n
CONFIG_MBEDTLS_HARDWARE_MPI=n
CONFIG_MBEDTLS_HARDWARE_SHA=n
# end of mbedTLS
#
# OpenThread
#
CONFIG_OPENTHREAD_BORDER_ROUTER=n
# end of OpenThread
#
# IEEE 802.15.4
#
CONFIG_IEEE802154_ENABLED=y
# end of IEEE 802.15.4

View File

@ -1,16 +1,11 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
/* OpenThread RCP Example
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once

View File

@ -1,16 +1,11 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
/* OpenThread RCP Example
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include <unistd.h>