blob: fc7e18329483708071b6d632de7c7afacbe1cb9d [file] [log] [blame]
<!--
Documentation/_templates/layout.html
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. The
ASF licenses this file to you 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
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.
-->
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>i8sak or i8 IEEE 802.15.4 Swiss Army Knife &mdash; NuttX latest documentation</title>
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/copybutton.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/tabs.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" />
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/sphinx_highlight.js"></script>
<script src="../../../_static/clipboard.min.js"></script>
<script src="../../../_static/copybutton.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="i8shark IEEE 802.15.4 Wireshark adapter" href="../i8shark/index.html" />
<link rel="prev" title="gs2200m Telit GS2200M usrsock daemon" href="../gs2200m/index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../../index.html" class="icon icon-home"> NuttX
</a>
<!-- this version selector is quite ugly, should be probably replaced by something
more modern -->
<div class="version-selector">
<select onchange="javascript:location.href = this.value;">
<option value="../../../../latest" selected="selected">latest</option>
<option value="../../../../10.0.0" >10.0.0</option>
<option value="../../../../10.0.1" >10.0.1</option>
<option value="../../../../10.1.0" >10.1.0</option>
<option value="../../../../10.2.0" >10.2.0</option>
<option value="../../../../10.3.0" >10.3.0</option>
<option value="../../../../11.0.0" >11.0.0</option>
<option value="../../../../12.0.0" >12.0.0</option>
<option value="../../../../12.1.0" >12.1.0</option>
<option value="../../../../12.2.0" >12.2.0</option>
<option value="../../../../12.2.1" >12.2.1</option>
<option value="../../../../12.3.0" >12.3.0</option>
<option value="../../../../12.4.0" >12.4.0</option>
<option value="../../../../12.5.0" >12.5.0</option>
<option value="../../../../12.5.1" >12.5.1</option>
</select>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../introduction/index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../quickstart/index.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing/index.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../platforms/index.html">Supported Platforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../components/index.html">OS Components</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Applications</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../audioutils/index.html">Audio Utility libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../boot/index.html">Bootloader Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../benchmarks/index.html">Benchmark Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../canutils/index.html">CAN Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../crypto/index.html">Cryptography Library Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../fsutils/index.html">File System Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../games/index.html">Games</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../graphics/index.html">Graphics Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../industry/index.html">Industrial Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../inertial/index.html">Inertial Libraries Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../interpreters/index.html">Interpreters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../logging/index.html">Logging Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../lte/index.html">LTE Libraries and NSH Add-Ons</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../math/index.html">Math Library Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mlearing/index.html">Machine Learning Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../netutils/index.html">Network Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../nsh/index.html">NuttShell (NSH)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../sdr/index.html">Software Define Radio Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../system/index.html">System Libraries and NSH Add-Ons</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../testing/index.html">Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../tools/index.html">Host Side Tools</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Wireless Libraries and NSH Add-Ons</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../btsak/index.html"><code class="docutils literal notranslate"><span class="pre">btsak</span></code> Bluetooth Swiss Army Knife</a></li>
<li class="toctree-l3"><a class="reference internal" href="../gs2200m/index.html"><code class="docutils literal notranslate"><span class="pre">gs2200m</span></code> Telit GS2200M usrsock daemon</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">i8sak</span></code> or <code class="docutils literal notranslate"><span class="pre">i8</span></code> IEEE 802.15.4 Swiss Army Knife</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#description">Description</a></li>
<li class="toctree-l4"><a class="reference internal" href="#how-to-use">How To Use</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../i8shark/index.html"><code class="docutils literal notranslate"><span class="pre">i8shark</span></code> IEEE 802.15.4 Wireshark adapter</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ipwan/index.html"><code class="docutils literal notranslate"><span class="pre">ipwan</span></code> IEEE 802.15.4 Command Line Tool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../libmac/index.html"><code class="docutils literal notranslate"><span class="pre">libmac</span></code> IEEE 802.15.4 MAC library routines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nimble/index.html"><code class="docutils literal notranslate"><span class="pre">nimble</span></code> Apache NimBLE (BLE host-layer) for NuttX</a></li>
<li class="toctree-l3"><a class="reference internal" href="../wapi/index.html"><code class="docutils literal notranslate"><span class="pre">wapi</span></code> WAPI (Wireless API)</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../examples/index.html">Examples</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../implementation/index.html">Implementation Details</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reference/index.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../guides/index.html">Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary.html">Glossary</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../index.html">NuttX</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../../index.html">Applications</a></li>
<li class="breadcrumb-item"><a href="../index.html">Wireless Libraries and NSH Add-Ons</a></li>
<li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">i8sak</span></code> or <code class="docutils literal notranslate"><span class="pre">i8</span></code> IEEE 802.15.4 Swiss Army Knife</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/applications/wireless/i8sak/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="i8sak-or-i8-ieee-802-15-4-swiss-army-knife">
<h1><code class="docutils literal notranslate"><span class="pre">i8sak</span></code> or <code class="docutils literal notranslate"><span class="pre">i8</span></code> IEEE 802.15.4 Swiss Army Knife<a class="headerlink" href="#i8sak-or-i8-ieee-802-15-4-swiss-army-knife" title="Permalink to this heading"></a></h1>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this heading"></a></h2>
<p>The i8sak app is a useful CLI for testing various IEEE 802.15.4 functionality.
It also serves as a starting place for learning how to interface with the NuttX
IEEE 802.15.4 MAC layer.</p>
<p>The i8sak CLI can be used to manipulate multiple MAC layer networks at once.
Both a MAC character driver interface and a network interface using sockets are
supported. The MAC character driver is used in cases where networking is not
enabled and you want your application to use IEEE 802.15.4 directly. In most
cases however, you will probably be using 6LoWPAN networking support and
therefore, the MAC can be controlled directly from the socket interface rather
than the MAC character driver. IEEE 802.15.4 MAC character drivers show up in
NuttX as <code class="docutils literal notranslate"><span class="pre">/dev/ieeeN</span></code> by default.</p>
<p>When you invoke the first call to i8sak with a specified interface name, it
creates an i8sak instance and launches a daemon to handle processing work. The
instance is considered sticky, so it is possible to run <code class="docutils literal notranslate"><span class="pre">i8</span> <span class="pre">/dev/ieee0</span></code> or <code class="docutils literal notranslate"><span class="pre">i8</span>
<span class="pre">wpan0</span></code> at the beginning of a session and then can exclude the interface name
from all future calls. The number of i8sak instances supported is controllable
through menuconfig.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">i8sak</span></code> app has many settings that can be configured. Most options are
_sticky_, meaning, if you set the endpoint short address once, any future
operation using the endpoint short address can default to the previously used
address. This is particularly useful to keep the command lengths down.</p>
</section>
<section id="how-to-use">
<h2>How To Use<a class="headerlink" href="#how-to-use" title="Permalink to this heading"></a></h2>
<p>The i8sak app has a series of CLI functions that can be invoked. The default
i8sak command is <code class="docutils literal notranslate"><span class="pre">i8</span></code> to make things quick and easy to type.</p>
<p>In my test setup I have 2 Clicker2-STM32 boards from MikroElektronika, with the
BEE-click (MRF24J40) radios. Choose one device to be the PAN Coordinator. We’ll
refer to that as device A.</p>
<p>On that device, run:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 /dev/ieee0 startpan cd:ab
</pre></div>
</div>
<p>This will tell the MAC layer that it should now act as a PAN coordinator using
PAN ID CD:AB. For now, this function assumes that we are operating a non-beacon
enabled PAN, since, as of this writing, beacon-enabled networks are unfinished.</p>
<p>Configure PAN coordinator short address and EP short addres:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 set saddr 0A:00
i8 set ep_saddr 0B:00
</pre></div>
</div>
<p>Next, on the same device, run:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 acceptassoc
</pre></div>
</div>
<p>Notice in the second command, we did not use the devname, again, that is
_sticky_ so unless we are switching back and forth between character drivers, we
can just use it once.</p>
<p>The acceptassoc command, without any arguments, informs the <code class="docutils literal notranslate"><span class="pre">i8sak</span></code> instance to
accept all association requests. The acceptassoc command also allows you to only
accept requests from a single device by specifying the extended address with
option <code class="docutils literal notranslate"><span class="pre">-e</span></code>.</p>
<p>For instance:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 acceptassoc -e DEADBEEF00FADE0B
</pre></div>
</div>
<p>But for this example, let’s just use the command with no arguments.</p>
<p>Now, the second device will act as an endpoint device. The i8sak instance
defaults to being in endpoint mode. Let’s refer to the second device as device
<code class="docutils literal notranslate"><span class="pre">B</span></code>.</p>
<p>On device B, run:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 /dev/ieee0 assoc
</pre></div>
</div>
<p>This command attempts to associate with the node at the configured endpoint
address. If everything is setup correctly, device A should have log information
saying that a device tried to associate and that it accepted the association. On
device <code class="docutils literal notranslate"><span class="pre">B</span></code>, the console should show that the association request was successful.
With all default settings, device B should have been allocated a short address
of <code class="docutils literal notranslate"><span class="pre">0x000B</span></code>.</p>
<p>If you are following along with a packet sniffer, you should see something
similar to the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>1) Association Request
Frame Type - CMD
Sequence Number - 0
Dest. PAN ID - 0xFADE
Dest. Address - 0x000A
Src. PAN ID - 0xFFFE
Src. Address - 0xDEADBEEF00FADE0C
Command Type - Association Request
1a) ACK
Frame Type - ACK
Sequence Number - 0
2) Data Request
Frame Type - CMD
Sequence Number - 1
Dest. PAN ID - 0xFADE
Dest. Address - 0x000A
Src. PAN ID - 0xFFFE
Src. Address - 0xDEADBEEF00FADE0C
Command Type - Data Request
2a) ACK
Frame Type - ACK
Sequence Number - 1
3) Association Response
Frame Type - CMD
Sequence Number - 0
Dest. PAN ID - 0xFADE
Dest. Address - 0xDEADBEEF00FADE0C
Src. Address - 0xDEADBEEF00FADE0A
Command Type - Association Response
Assigned SADDR - 0x000B
Assoc Status - Successful
3a) ACK
Frame Type - ACK
Sequence Number - 0
</pre></div>
</div>
<p>The default endpoint address can be configured via Kconfig or set dynamically
using the <code class="docutils literal notranslate"><span class="pre">set</span></code> command.</p>
<p>Here is how to set the endpoint short address:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 set ep_saddr 0a:00
</pre></div>
</div>
<p>When setting the address, it’s important to make sure the endpoint addressing
mode is configured the way you want: Use <code class="docutils literal notranslate"><span class="pre">s</span></code> for short addressing or <code class="docutils literal notranslate"><span class="pre">e</span></code> for
extended:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 set ep_addrmode s
</pre></div>
</div>
<p>Device B has now successfully associated with device A. If you want to send data
from device B to device A, run the following on device B:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 tx ABCDEF
</pre></div>
</div>
<p>This will immediately (not actually immediate, transaction is sent using CSMA)
send the frame to device A with frame payload <code class="docutils literal notranslate"><span class="pre">0xABCDEF</span></code></p>
<p>Sending data from device A to device B is different. In IEEE 802.15.4, frames
must be extracted from the coordinator. To prepare the frame, run the following
command on device A:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 tx AB
</pre></div>
</div>
<p>Because the devmode is PAN Coordinator, the <code class="docutils literal notranslate"><span class="pre">i8sak</span></code> app knows to send the data
as an indirect transaction. If you were running the <code class="docutils literal notranslate"><span class="pre">i8sak</span></code> app on a device that
is a coordinator, but not the PAN coordinator, you can force the <code class="docutils literal notranslate"><span class="pre">i8sak</span></code> app to
send the transaction directly, rather than to the parent coordinator, by using
the <code class="docutils literal notranslate"><span class="pre">-d</span></code> option.</p>
<p><strong>Note</strong>: Currently, the indirect transaction timeout is disabled. This means
frames must be extracted or space may run out. This is only for the testing
phase as it is easier to debug when I am not fighting a timeout. Re-enabling the
timeout may effect the behavior of the indirect transaction features in the
<code class="docutils literal notranslate"><span class="pre">i8sak</span></code> app.</p>
<p>To extract the data, run the following command on device <code class="docutils literal notranslate"><span class="pre">B</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i8 poll
</pre></div>
</div>
<p>This command polls the endpoint (our device A PAN Coordinator in this case) to
see if there is any data. In the console of device B you should see a Poll
request status print out.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../gs2200m/index.html" class="btn btn-neutral float-left" title="gs2200m Telit GS2200M usrsock daemon" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../i8shark/index.html" class="btn btn-neutral float-right" title="i8shark IEEE 802.15.4 Wireshark adapter" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2023, The Apache Software Foundation.</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>