OpenThread: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 12: Line 12:
         {{#vardefine:SPIDEV|/dev/spidev1.0}}
         {{#vardefine:SPIDEV|/dev/spidev1.0}}
     }} <!--
     }} <!--
    {{#vardefine:EVKA|{{#var:MACHINE_NAME}}-a}}
    {{#vardefine:EVKB|{{#var:MACHINE_NAME}}-b}}
-->{{DocImage|category1=Yocto|category2=Debian}}[[Category:VAR-SOM-MX93]] __toc__
-->{{DocImage|category1=Yocto|category2=Debian}}[[Category:VAR-SOM-MX93]] __toc__


Line 50: Line 52:
  52fc4e6d3cd98e30
  52fc4e6d3cd98e30
  Done
  Done
The following sections demonstrate how to create a network on '''{{#var:EVKA}}''' and connect to the network on '''{{#var:EVKB}}'''.


== Create OpenThread network using ot-ctl ==
== Create OpenThread network using ot-ctl ==
Line 55: Line 59:
Variscite provides an example script in '''/etc/openthread/variscite-ot-server''' to create an OpenThread network. It is only meant to be an example to accelerate the development process. For example:
Variscite provides an example script in '''/etc/openthread/variscite-ot-server''' to create an OpenThread network. It is only meant to be an example to accelerate the development process. For example:


  root@som-a# /etc/openthread/variscite-ot-server start
  root@{{#var:EVK}}# /etc/openthread/variscite-ot-server start
  State is detached, waiting for state=leader
  State is detached, waiting for state=leader
  State is detached, waiting for state=leader
  State is detached, waiting for state=leader
Line 66: Line 70:
Variscite provides an example script in '''/etc/openthread/variscite-ot-client''' to connect to an OpenThread network. It is only meant to be an example to accelerate the development process. For example:
Variscite provides an example script in '''/etc/openthread/variscite-ot-client''' to connect to an OpenThread network. It is only meant to be an example to accelerate the development process. For example:


  root@som-b# /etc/openthread/variscite-ot-client start c9ca829c5a194f86e141a8721f1f38aa
  root@{{#var:EVKB}}# /etc/openthread/variscite-ot-client start c9ca829c5a194f86e141a8721f1f38aa
  Scanning for available networks:                                                                         
  Scanning for available networks:                                                                         
  | PAN  | MAC Address      | Ch | dBm | LQI |                                                             
  | PAN  | MAC Address      | Ch | dBm | LQI |                                                             
Line 76: Line 80:
  State is detached, waiting to connect to the network                                                     
  State is detached, waiting to connect to the network                                                     
  State is child, connected to the network
  State is child, connected to the network
Once connected, you can

Revision as of 17:42, 15 September 2023

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release mx93-yocto-langdale-6.1.1_1.0.1-v1.1.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
802.15.4 OpenThread

VAR-SOM-MX93 OpenThread Overview

VAR-SOM-MX93 SoMs ordered with the WBE option feature an IW612 based tri-radio module that supports Wi-Fi 6, Bluetooth/Bluetooth Low Energy 5.2, and 802.15.4.

The 802.15.4 radio coprocessor is managed by OpenThread. Thread is an IPv6-based networking protocol designed for low-power Internet of Things devices in an IEEE802.15.4-2015 wireless mesh network. OpenThread released by Google is an open-source implementation of Thread.

The OpenThread core runs on the host processor (mx93) and communicates with the 802.15.4 coprocessor via OpenThread Daemon (ot-daemon) through SPI interface. Clients can connect to the ot-daemon UNIX socket and communicate using OpenThread CLI as a protocol.

Configuring ot-daemon

ot-daemon is started with the following command:

ot-daemon "spinel+spi:///dev/spidev1.0?gpio-int-device=4&gpio-int-line=29&gpio-reset-device=4_&gpio-reset-line=4_&spi-mode=0&spi-speed=1000000&spi-reset-delay=500" &

This is done automatically on boot by Variscite's ot-service and the scripts in /etc/openthread on boot. The service can be managed using systemd:

systemctl <start|stop|restart|enable|disable> variscite-ot.service

For example, you can stop and disable the service:

# Stop the service
systemctl stop variscite-ot

# Start the service
systemctl disable variscite-ot

Managing OpenThread using ot-ctl

ot-ctl uses the ot-daemon UNIX socket and can be used to manage OpenThread. It requires that ot-daemon is first running. As a reminder, the variscite-ot service starts this by default.

For example, you can read the extended MAC address of your device:

# ot-ctl extaddr
52fc4e6d3cd98e30
Done

The following sections demonstrate how to create a network on ' and connect to the network on '.

Create OpenThread network using ot-ctl

Variscite provides an example script in /etc/openthread/variscite-ot-server to create an OpenThread network. It is only meant to be an example to accelerate the development process. For example:

root@# /etc/openthread/variscite-ot-server start
State is detached, waiting for state=leader
State is detached, waiting for state=leader
State is detached, waiting for state=leader
State is leader
Network key c9ca829c5a194f86e141a8721f1f38aa saved to /tmp/ot-wpan0.key

Connect to OpenThread network using ot-ctl

Variscite provides an example script in /etc/openthread/variscite-ot-client to connect to an OpenThread network. It is only meant to be an example to accelerate the development process. For example:

root@# /etc/openthread/variscite-ot-client start c9ca829c5a194f86e141a8721f1f38aa
Scanning for available networks:                                                                         
| PAN  | MAC Address      | Ch | dBm | LQI |                                                             
+------+------------------+----+-----+-----+                                                             
| 1234 | 962ba3d53bbc9bb6 | 26 | -46 | 133 |                                                             
Done                                                                                                     
State is detached, waiting to connect to the network                                                     
State is detached, waiting to connect to the network                                                     
State is detached, waiting to connect to the network                                                     
State is child, connected to the network

Once connected, you can