blob: f50a80d64f18d2abba1dba9742b95f08bdca2510 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoRaWAN App &mdash; Apache Mynewt latest documentation</title>
<link rel="shortcut icon" href="../../_static/mynewt-logo-only-newt32x32.png"/>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/sphinx_theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/bootstrap-3.0.3.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/v2.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/restructuredtext.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/overrides.css" type="text/css" />
<link rel="index" title="Index"
href="../../genindex.html"/>
<link rel="search" title="Search" href="../../search.html"/>
<link rel="top" title="Apache Mynewt latest documentation" href="../../index.html"/>
<link rel="up" title="Tutorials" href="../tutorials.html"/>
<link rel="next" title="OS Fundamentals" href="../os_fundamentals/os_fundamentals.html"/>
<link rel="prev" title="Use HCI access to NimBLE controller" href="../ble/blehci_project.html"/>
<script src="../../_static/js/modernizr.min.js"></script>
<script>
(function(i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
(i[r] =
i[r] ||
function() {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-72162311-1", "auto");
ga("send", "pageview");
</script>
</head>
<body class="not-front page-documentation" role="document" >
<div id="wrapper">
<div class="container">
<div id="banner" class="row v2-main-banner">
<a class="logo-cell" href="/">
<img class="logo" src="../../_static/img/logo.png">
</a>
<div class="tagline-cell">
<h4 class="tagline">An OS to build, deploy and securely manage billions of devices</h4>
</div>
<div class="news-cell">
<div class="well">
<h4>Latest News:</h4> <a href="/download">Apache Mynewt 1.11.0, Apache NimBLE 1.6.0 </a> released September 7, 2023)
</div>
</div>
</div>
</div>
<header>
<nav id="navbar" class="navbar navbar-inverse" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/"><i class="fa fa-home" style="font-size: larger;"></i></a>
</li>
<li class="important">
<a href="/quick-start/">Quick Start</a>
</li>
<li>
<a href="/about/">About</a>
</li>
<li>
<a href="/talks/">Talks</a>
</li>
<li class="active">
<a href="/documentation/">Documentation</a>
</li>
<li>
<a href="/download/">Download</a>
</li>
<li>
<a href="/community/">Community</a>
</li>
<li>
<a href="/events/">Events</a>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
</header>
<!-- STARTS MAIN CONTENT -->
<div id="main-content">
<div id="breadcrumb">
<div class="container">
<a href="/documentation/">Docs</a> /
<a href="../tutorials.html">Tutorials</a> /
LoRaWAN App
<div class="sourcelink">
<a href="https://github.com/apache/mynewt-documentation/edit/master/docs/tutorials/lora/lorawanapp.rst" class="icon icon-github"
rel="nofollow"> Edit on GitHub</a>
</div>
</div>
</div>
<!-- STARTS CONTAINER -->
<div class="container">
<!-- STARTS .content -->
<div id="content" class="row">
<!-- STARTS .container-sidebar -->
<div class="container-sidebar col-xs-12 col-sm-3">
<div id="docSidebar" class="sticky-container">
<div role="search" class="sphinx-search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search documentation" class="search-documentation" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<!-- Note: only works when deployed -->
<select class="form-control" onchange="if (this.value) window.location.href=this.value">
<option value="/latest" selected>
Version: latest
</option>
<option value="/v1_11_0" selected="selected" >
Version: 1.11.0
</option>
<option value="/v1_10_0" >
Version: 1.10.0
</option>
<option value="/v1_9_0" >
Version: 1.9.0
</option>
<option value="/v1_8_0" >
Version: 1.8.0
</option>
<option value="/v1_7_0" >
Version: 1.7.0
</option>
<option value="/v1_6_0" >
Version: 1.6.0
</option>
<option value="/v1_5_0" >
Version: 1.5.0
</option>
<option value="/v1_4_0" >
Version: 1.4.0
</option>
<option value="/v1_3_0/os/introduction" >
Version: 1.3.0
</option>
<option value="/v1_2_0/os/introduction" >
Version: 1.2.0
</option>
<option value="/v1_1_0/os/introduction" >
Version: 1.1.0
</option>
<option value="/v1_0_0/os/introduction" >
Version: 1.0.0
</option>
<option value="/v0_9_0/os/introduction" >
Version: 0.9.0
</option>
</select>
<div class="region region-sidebar">
<div class="docs-menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../get_started/index.html">Setup &amp; Get Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">Concepts</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../tutorials.html">Tutorials</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../blinky/blinky.html">Project Blinky</a></li>
<li class="toctree-l2"><a class="reference internal" href="../repo/add_repos.html">Working with repositories</a></li>
<li class="toctree-l2"><a class="reference internal" href="../slinky/project-slinky.html">Project Slinky for Remote Comms</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ble/ble.html">Bluetooth Low Energy</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">LoRa</a></li>
<li class="toctree-l2"><a class="reference internal" href="../os_fundamentals/os_fundamentals.html">OS Fundamentals</a></li>
<li class="toctree-l2"><a class="reference internal" href="../devmgmt/devmgmt.html">Remote Device Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sensors/sensors.html">Sensors</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tooling/tooling.html">Tooling</a></li>
<li class="toctree-l2"><a class="reference internal" href="../other/other.html">Other</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../external_links.html">Third-party Resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../os/os_user_guide.html">OS User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../network/index.html">BLE User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../newt/index.html">Newt Tool Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../newtmgr/index.html">Newt Manager Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mynewt_faq/index.html">Mynewt FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../misc/index.html">Appendix</a></li>
</ul>
</div>
</div>
</div>
<!-- ENDS STICKY CONTAINER -->
</div>
<!-- ENDS .container-sidebar -->
<div class="col-xs-12 col-sm-9">
<div class="alert alert-warning">
<p>
Version 1.11.0 is not the most recent version of the
Apache Mynewt documentation. Click <a href="/latest">here</a> to
read the latest version.
</p>
</div>
<div class="">
<div class="rst-content">
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="lorawan-app">
<h1>LoRaWAN App<a class="headerlink" href="#lorawan-app" title="Permalink to this headline"></a></h1>
<div class="section" id="objective">
<h2>Objective<a class="headerlink" href="#objective" title="Permalink to this headline"></a></h2>
<p>The purpose of this tutorial is to demonstrate how to build the lora app shell application for either a class A or class C lora device and to perform basic functions such as joining and sending data packets to a lora gateway/server.</p>
<p>NOTE: This tutorial presumes that you have a running lora gateway and lora network server. No description of the gateway/server is provided. It is expected that the user understands how to configure and operate the gateway/server so that it can communicate with a class A or class C device.</p>
</div>
<div class="section" id="hardware-needed">
<h2>Hardware needed<a class="headerlink" href="#hardware-needed" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>Telenor EE02 module</p></li>
<li><p>Segger J-Link or similar debugger</p></li>
<li><p>LORA gateway</p></li>
<li><p>Laptop running Mac OS</p></li>
<li><p>It is assumed you have already installed newt tool.</p></li>
<li><p>It is assumed you understand the basics of the mynewt OS</p></li>
<li><p>3-wire serial cable to connect telenor module to your laptop</p></li>
<li><p>Some form of terminal emulation application running on your laptop.</p></li>
</ul>
</div>
<div class="section" id="create-a-project">
<h2>Create a project.<a class="headerlink" href="#create-a-project" title="Permalink to this headline"></a></h2>
<p>Create a new project to hold your work. For a deeper understanding, you can read about project creation in <a class="reference internal" href="../../get_started/project_create.html"><span class="doc">Get Started – Creating Your First Project</span></a> or just follow the commands below.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ mkdir ~/dev
$ cd ~/dev
$ newt new mylora
Downloading project skeleton from apache/mynewt-blinky...
Installing skeleton in mylora...
Project mylora successfully created.
$ cd mylora
</pre></div>
</div>
</div>
<div class="section" id="install-everything">
<h2>Install Everything<a class="headerlink" href="#install-everything" title="Permalink to this headline"></a></h2>
<p>Now that you have defined the needed repositories, it’s time to install everything so that you can get started.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt upgrade -v
Downloading repository mynewt-core (commit: master) ...
...
apache-mynewt-core successfully upgraded to version 1.7.0
...
</pre></div>
</div>
</div>
<div class="section" id="create-the-targets">
<h2>Create the targets<a class="headerlink" href="#create-the-targets" title="Permalink to this headline"></a></h2>
<p>Create two targets - one for the bootloader and one for the lora app shell application.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt target create telee02_boot
$ newt target set telee02_boot bsp=@apache-mynewt-core/hw/bsp/telee02
$ newt target set telee02_boot app=@mcuboot/boot/mynewt
$ newt target set telee02_boot build_profile=optimized
$ newt target create lora_app_shell_telee02
$ newt target set lora_app_shell_telee02 bsp=@apache-mynewt-core/hw/bsp/telee02
$ newt target set lora_app_shell_telee02 app=@apache-mynewt-core/apps/lora_app_shell
$ newt target set lora_app_shell_telee02 build_profile=optimized
</pre></div>
</div>
<p>The lora app shell application requires a few additional system configuration variables. Create and edit a file called syscfg.yml in dev/mylora/targets/lora_app_shell. The file contents should be the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>### Package: targets/lora_app_shell_telee02
syscfg.vals:
SHELL_CMD_ARGC_MAX: &quot;20&quot;
LORA_MAC_TIMER_NUM: &quot;4&quot;
TIMER_4: &quot;1&quot;
</pre></div>
</div>
<p>You can now “display” the targets you created to make sure they are correct:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt target show telee02_boot
targets/telee02_boot
app=@mcuboot/boot/mynewt
bsp=@apache-mynewt-core/hw/bsp/telee02
build_profile=optimized
$ newt target show lora_app_shell_telee02
targets/lora_app_shell_telee02
app=@apache-mynewt-core/apps/lora_app_shell
bsp=@apache-mynewt-core/hw/bsp/telee02
build_profile=optimized
syscfg=LORA_MAC_TIMER_NUM=4:SHELL_CMD_ARGC_MAX=20:TIMER_4=1
</pre></div>
</div>
<p>Note: If you’ve already built and installed a bootloader for your ee02 module then you do not need to create a target for it here, or build and load it as below.</p>
</div>
<div class="section" id="build-the-target-executables">
<h2>Build the target executables<a class="headerlink" href="#build-the-target-executables" title="Permalink to this headline"></a></h2>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt clean telee02_boot
$ newt build telee02_boot
Building target targets/telee02_boot
Compiling repos/apache-mynewt-core/boot/bootutil/src/image_rsa.c
Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec.c
Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec256.c
. . .
Archiving telee02_boot-sysinit-app.a
Archiving util_mem.a
Linking /Users/wes/dev/wes/bin/targets/telee02_boot/app/boot/mynewt/mynewt.elf
Target successfully built: targets/telee02_boot
$ newt clean lora_app_shell_telee02
$ newt build lora_app_shell_telee02
Building target targets/lora_app_shell_telee02
Assembling repos/apache-mynewt-core/hw/bsp/telee02/src/arch/cortex_m4/gcc_startup_nrf52_split.s
Compiling repos/apache-mynewt-core/encoding/base64/src/hex.c
Compiling repos/apache-mynewt-core/encoding/base64/src/base64.c
. . .
Archiving util_mem.a
Archiving util_parse.a
Linking /Users/wes/dev/wes/bin/targets/lora_app_shell_telee02/app/apps/lora_app_shell/lora_app_shell.elf
Target successfully built: targets/lora_app_shell_telee0
</pre></div>
</div>
<p>Note: The newt clean step is not necessary but shown here for good measure.</p>
</div>
<div class="section" id="sign-and-create-the-application-image">
<h2>Sign and create the application image<a class="headerlink" href="#sign-and-create-the-application-image" title="Permalink to this headline"></a></h2>
<p>You must sign and version your application image to download it using newt to the board. Use the newt create-image command to perform this action. You may assign an arbitrary version (e.g. 1.0.0) to the image.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt create-image lora_app_shell_telee02 0.0.0
App image succesfully generated: /Users/wes/dev/wes/bin/targets/lora_app_shell_telee02/app/apps/lora_app_shell/lora_app_shell.img
</pre></div>
</div>
<p>Note: Only the application image requires this step; the bootloader does not</p>
</div>
<div class="section" id="connect-the-board">
<h2>Connect the board<a class="headerlink" href="#connect-the-board" title="Permalink to this headline"></a></h2>
<p>Connect the evaluation board via micro-USB to your PC via USB cable. Connect the Segger J-link debugger to the 9-pin SWD connector. Connect the UART pins (RX, TX and GND) to the board. Terminal settings 115200, N, 8, 1.</p>
</div>
<div class="section" id="download-bootloader-and-application">
<h2>Download bootloader and application<a class="headerlink" href="#download-bootloader-and-application" title="Permalink to this headline"></a></h2>
<p><strong>Note:</strong> If you want to erase the flash and load the image again, you can use JLinkExe to issue an <code class="docutils literal notranslate"><span class="pre">erase</span></code> command.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ JLinkExe -device nRF52 -speed 4000 -if SWD
SEGGER J-Link Commander V5.12c (Compiled Apr 21 2016 16:05:51)
DLL version V5.12c, compiled Apr 21 2016 16:05:45
Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17
Hardware version: V1.00
S/N: 682863966
VTref = 3.300V
Type &quot;connect&quot; to establish a target connection, &#39;?&#39; for help
J-Link&gt;erase
Cortex-M4 identified.
Erasing device (0;?i?)...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Total time needed: 0.363s (Prepare: 0.093s, Compare: 0.000s, Erase: 0.262s, Program: 0.000s, Verify: 0.000s, Restore: 0.008s)
Erasing done.
J-Link&gt;exit
$
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ newt load telee02_boot
Loading bootloader
$ newt load lora_app_shell_telee02
Loading app image into slot 1
</pre></div>
</div>
<p>Assuming you attached the serial port and have a terminal up you should set the following output on the terminal:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> 000002 lora_app_shell
### Shell Commands
</pre></div>
</div>
<p>There are a number of shell commands that will allow you to join and send both unconfirmed and confirmed data. If you type ‘help’ in your terminal you will see the various commands displayed. Here is a screen shot of the output of help</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>000002 lora_app_shell
help
032766 help
032766 stat
032767 tasks
032768 mpool
032769 date
032770 las_wr_mib
032771 las_rd_mib
032772 las_rd_dev_eui
032773 las_wr_dev_eui
032774 las_rd_app_eui
032775 las_wr_app_eui
032776 las_rd_app_key
032777 las_wr_app_key
032778 las_app_port
032779 las_app_tx
032780 las_join
032781 las_link_chk
032782 compat&gt;
</pre></div>
</div>
<p>The following table lists the commands and gives a brief description of the commands. The lora commands are described in more detail later in the tutorial as well as their syntax (syntax not shown in the table).</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 17%" />
<col style="width: 83%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Command</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>help</p></td>
<td><p>Display list of available shell commands</p></td>
</tr>
<tr class="row-odd"><td><p>stat</p></td>
<td><p>Display statistics. Syntax: stat &lt;statistics group&gt;. ‘stat’ with no group displays avaialable groups</p></td>
</tr>
<tr class="row-even"><td><p>tasks</p></td>
<td><p>Display OS tasks</p></td>
</tr>
<tr class="row-odd"><td><p>mpool</p></td>
<td><p>Displays OS memory pools and memory pool statistics</p></td>
</tr>
<tr class="row-even"><td><p>date</p></td>
<td><p>Displays current date/time</p></td>
</tr>
<tr class="row-odd"><td><p>las_wr_mib</p></td>
<td><p>Write lora MIB</p></td>
</tr>
<tr class="row-even"><td><p>las_rd_mib</p></td>
<td><p>Read lora MIB</p></td>
</tr>
<tr class="row-odd"><td><p>las_rd_dev_eui</p></td>
<td><p>Read lora device EUI</p></td>
</tr>
<tr class="row-even"><td><p>las_wr_dev_eui</p></td>
<td><p>Write lora device EUI</p></td>
</tr>
<tr class="row-odd"><td><p>las_rd_app_eui</p></td>
<td><p>Read lora application EUI</p></td>
</tr>
<tr class="row-even"><td><p>las_wr_app_eui</p></td>
<td><p>Write lora application EUI</p></td>
</tr>
<tr class="row-odd"><td><p>las_rd_app_key</p></td>
<td><p>Read lora application key</p></td>
</tr>
<tr class="row-even"><td><p>las_wr_app_key</p></td>
<td><p>Write lora application key</p></td>
</tr>
<tr class="row-odd"><td><p>las_app_port</p></td>
<td><p>Open/close lora application port</p></td>
</tr>
<tr class="row-even"><td><p>las_app_tx</p></td>
<td><p>Transmit on lora application port</p></td>
</tr>
<tr class="row-odd"><td><p>las_join</p></td>
<td><p>Perform a lora OTA join</p></td>
</tr>
<tr class="row-even"><td><p>las_link_chk</p></td>
<td><p>Perform a lora link check</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="ota-join">
<h2>OTA Join<a class="headerlink" href="#ota-join" title="Permalink to this headline"></a></h2>
<p>Before sending any application data a lora end device must be joined to its lora network. To perform a lora OTA (over-the-air) join there are some commands that must be issued prior to attempting to join. The reason for these commands is that a lora end device must be configured with a device EUI, application EUI and application key prior to performing an OTA join.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>598763 compat&gt; las_wr_app_eui 0x00:0x11:0x22:0x01:0x01:0x00:0x10:10
623106 compat&gt; las_wr_app_key 03:03:03:03:03:03:03:03:03:03:03:03:03:03:03:03
623758 compat&gt; las_wr_dev_eui 0x00:0x11:0x22:0x02:0x02:0x00:0x00:0x00
630333 compat&gt; las_join 1
630634 Attempting to join...
019802 compat&gt; Join cb. status=0 attempts=1
</pre></div>
</div>
<p>If the join is successful the status returned should be 0. If it fails the status will be a non-zero lora status code (lora status error codes are described later in this tutorial).</p>
<p>A note about “endianness” in the device EUI commands. The first three bytes of the EUI are the OUI and the last 5 bytes are unique (for that OUI). The above example assumes an OUI of 001122. This is not the same order as the address over the air as device addresses are sent “least significant byte” first (little endian). The same convention also applies to keys: they are in big-endian order in the command but sent little endian over the air.</p>
</div>
<div class="section" id="opening-closing-an-application-port">
<h2>Opening/closing an application port<a class="headerlink" href="#opening-closing-an-application-port" title="Permalink to this headline"></a></h2>
<p>Another step that must be performed prior to sending application data is to open an application port. All data frames containing application data are sent to a specific port. Port numbers are in the range 1 - 223 as port 0 is reserved for MLME-related activities. Ports 224-255 are reserved for future standardized application extensions.</p>
<p>The lora app shell does not open any application ports by default.</p>
<p>To open and/or close an application port the following commands are used. Note that the application port which you are using to send data must be open if you want to send data (or receive it).</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>115647 compat&gt; las_app_port open 1
150958 Opened app port 1
150958 compat&gt; las_app_port close 1
151882 Closed app port 1
</pre></div>
</div>
</div>
<div class="section" id="sending-data">
<h2>Sending data<a class="headerlink" href="#sending-data" title="Permalink to this headline"></a></h2>
<p>The lora app shell allows the user to send both unconfirmed and confirmed data. The command to send data is <em>las_app_tx &lt;port&gt; &lt;len&gt; &lt;type&gt;</em></p>
<p>NOTE: the current usage for this command shows an optional data rate and retries for this command. That feature has not been implemented and the command will not be accepted if they are separated.</p>
<p>Where: port = port number on which to send len = size n bytes of app data type = 0 for unconfirmed, 1 for confirmed</p>
<p>To send a confirmed data transmission of size 5 bytes on port 10 the command would be: las_app_tx 10 20 1</p>
<p>Once the end device has sent the frame requested there should be a message which contains some additional information. Here is a screen shot using the above example. Note that there will be some delay between seeing the “Packet sent on port 10” message and the additional information as the additional information is the “confirmation” that the lora stack provides and the confirmation will not be returned until the lora stack is finished transmitting the frame and has received an acknowledgement or has finished waiting for all the receive windows.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>449751 compat&gt; las_app_tx 10 5 1
452144 Packet sent on port 10
452144 compat&gt; Txd on port 10 type=conf status=0 len=5
452325 dr:0
452325 txpower:5
452325 tries:1
452326 ack_rxd:1
452326 tx_time_on_air:330
452327 uplink_cntr:0
452327 uplink_freq:903500000
</pre></div>
</div>
<p>The information contained in the confirmation is the following:</p>
<div class="line-block">
<div class="line">dr: The data rate on which the frame was sent.</div>
<div class="line">txpower: Transmit power level of the device.</div>
<div class="line">tries: # of attempts made to transmit the frame successfully.</div>
<div class="line">ack_rxd: Was an acknowledgement received (0 no 1 yes).</div>
<div class="line">tx_time_on_air: The on-air length of the frame (in milliseconds).</div>
<div class="line">uplink_cntr: The frame uplink counter that this frame used.</div>
<div class="line">uplink_freq: The frequency (logical) on which the frame was sent (in Hz).</div>
</div>
</div>
</div>
</div>
</div>
<div class="rst-footer-buttons row" role="navigation" aria-label="footer navigation">
<a href="../os_fundamentals/os_fundamentals.html" class="btn btn-neutral float-right" title="OS Fundamentals" accesskey="n">Next: OS Fundamentals <span class="fa fa-arrow-circle-right"></span></a>
<a href="../ble/blehci_project.html" class="btn btn-neutral" title="Use HCI access to NimBLE controller" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous: Use HCI access to NimBLE controller</a>
</div>
</div>
</div>
</div>
<!-- ENDS CONTENT SECTION -->
</div>
<!-- ENDS .content -->
</div>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12">
<p class="copyright">Apache Mynewt is available under Apache License, version 2.0.</p>
</div>
<div class="col-xs-12">
<div class="logos">
<img src="../../_static/img/asf_logo_wide_small.png" alt="Apache" title="Apache">
<small class="footnote">
Apache Mynewt, Mynewt, Apache, the Apache feather logo, and the Apache Mynewt project logo are either
registered trademarks or trademarks of the Apache Software Foundation in the United States and other countries.
</small>
<a href="">
<img src="../../_static/img/add_to_slack.png" alt="Slack Icon" title="Join our Slack Community" />
</a>
</div>
</div>
</div>
</div>
</footer>
</div>
<!-- ENDS #wrapper -->
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'latest',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
LINK_SUFFIX: '.html'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/bootstrap-3.0.3.min.js"></script>
<script type="text/javascript" src="../../_static/js/affix.js"></script>
<script type="text/javascript" src="../../_static/js/main.js"></script>
</body>
</html>