blob: acdd9dc865ed82456972e93e28457c911455407b [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>Enable Wi-Fi on Arduino MKR1000 &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="Other" href="other.html"/>
<link rel="next" title="Charge control on PineTime" href="chg_ctrl_on_pinetime.html"/>
<link rel="prev" title="Write a Test Suite for a Package" href="unit_test.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> /
<a href="other.html">Other</a> /
Enable Wi-Fi on Arduino MKR1000
<div class="sourcelink">
<a href="https://github.com/apache/mynewt-documentation/edit/master/docs/tutorials/other/wi-fi_on_arduino.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" >
Version: 1.11.0
</option>
<option value="/v1_10_0" selected="selected" >
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"><a class="reference internal" href="../lora/lorawanapp.html">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 current"><a class="reference internal" href="other.html">Other</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="codesize.html">How to reduce Application Code Size</a></li>
<li class="toctree-l3"><a class="reference internal" href="unit_test.html">Write a Test Suite for a Package</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Enable Wi-Fi on Arduino MKR1000</a></li>
<li class="toctree-l3"><a class="reference internal" href="chg_ctrl_on_pinetime.html">Charge control on PineTime</a></li>
<li class="toctree-l3"><a class="reference internal" href="rust.html">Rust Blinky application</a></li>
</ul>
</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.10.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="enable-wi-fi-on-arduino-mkr1000">
<h1>Enable Wi-Fi on Arduino MKR1000<a class="headerlink" href="#enable-wi-fi-on-arduino-mkr1000" title="Permalink to this headline"></a></h1>
<p>This tutorial shows you how to enable Wi-Fi on an Arduino MKR1000 board
and connect to a Wi-Fi network.</p>
<div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline"></a></h2>
<p>Ensure that you have met the following prerequisites before continuing
with this tutorial:</p>
<ul class="simple">
<li><p>Have an Arduino MKR1000 board.</p></li>
<li><p>Have Internet connectivity to fetch remote Mynewt components.</p></li>
<li><p>Have a computer to build a Mynewt application and connect to the
board over USB.</p></li>
<li><p>Have a Micro-USB cable to connect the board and the computer.</p></li>
<li><p>Have local Wi-Fi network that the computer is connected to and that
the MKR1000 board can join.</p></li>
<li><p>Have a <a class="reference internal" href="../../get_started/serial_access.html"><span class="doc">Serial Port Setup</span></a>.</p></li>
<li><p>Have a <a class="reference external" href="https://www.segger.com/jlink-debug-probes.html">Segger J-Link Debug
Probe</a>.</p></li>
<li><p>Have a <a class="reference external" href="https://www.segger.com/jlink-adapters.html#CM_9pin">J-Link 9 pin Cortex-M
Adapter</a> that
allows JTAG, SWD and SWO connections between J-Link and Cortex M
based target hardware systems</p></li>
<li><p>Install the <a class="reference external" href="https://www.segger.com/jlink-software.html">Segger JLINK Software and documentation
pack</a>.</p></li>
<li><p>Install the Newt tool and toolchains (See <a class="reference internal" href="../../get_started/native_install/index.html"><span class="doc">Native Installation</span></a>)</p></li>
<li><p>Create a project space (directory structure) and populated it with
the core code repository (apache-mynewt-core) or know how to as
explained in <a class="reference internal" href="../../get_started/project_create.html"><span class="doc">Creating Your First
Project</span></a>.</p></li>
<li><p>Read the Mynewt OS <span class="xref std std-doc">Concepts</span>
section.</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 if you do not have an existing one. You can skip
this step and proceed to <a class="reference external" href="#%20fetchexternal">fetch external packages</a>
if you already created a project.</p>
<p>Run the following commands to create a new project:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>mkdir<span class="w"> </span>~/dev
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>~/dev
<span class="gp">$ </span>newt<span class="w"> </span>new<span class="w"> </span>arduinowifi
<span class="go">Downloading project skeleton from apache/mynewt-blinky...</span>
<span class="go">Downloading repository mynewt-blinky (commit: master) ...</span>
<span class="go">Installing skeleton in arduinowifi...</span>
<span class="go">Project arduinowifi successfully created.</span>
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>arduinowifi
<span class="gp">$ </span>newt<span class="w"> </span>upgrade
<span class="go">Downloading repository mynewt-core (commit: master) ...</span>
<span class="go">Downloading repository mcuboot (commit: master) ...</span>
<span class="go">Downloading repository mynewt-nimble (commit: master) ...</span>
<span class="go">Making the following changes to the project:</span>
<span class="go">apache-mynewt-core successfully upgraded to version 1.7.0</span>
<span class="go">apache-mynewt-nimble successfully upgraded to version 1.2.0</span>
<span class="go">mcuboot successfully upgraded to version 1.3.1</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="fetch-external-packages">
<h2>Fetch External Packages<a class="headerlink" href="#fetch-external-packages" title="Permalink to this headline"></a></h2>
<p>Mynewt uses source code provided directly from the chip manufacturer for
low level operations. Sometimes this code is licensed only for the
specific manufacturer of the chipset and cannot live in the Apache
Mynewt repository. That happens to be the case for the Arduino Zero
board which uses Atmel SAMD21. Runtime’s git hub repository hosts such
external third-party packages and the Newt tool can fetch them.</p>
<p>To fetch the package with MCU support for Atmel SAMD21 for Arduino Zero
from the Runtime git repository, you need to add the repository to the
<code class="docutils literal notranslate"><span class="pre">project.yml</span></code> file in your base project directory.</p>
<p>Mynewt uses source code provided directly from the chip manufacturer for
low level operations. Sometimes this code is licensed only for the
specific manufacturer of the chipset and cannot live in the Apache
Mynewt repository. That happens to be the case for the Arduino Zero
board which uses Atmel SAMD21. Runtime’s github repository hosts such
external third-party packages and the Newt tool can fetch them.</p>
<p>To fetch the package with MCU support for Atmel SAMD21 for Arduino Zero
from the Runtime git repository, you need to add the repository to the
<code class="docutils literal notranslate"><span class="pre">project.yml</span></code> file in your base project directory (<code class="docutils literal notranslate"><span class="pre">arduinowifi</span></code>).</p>
<p>Here is an example <code class="docutils literal notranslate"><span class="pre">project.yml</span></code> file with the Arduino Zero repository
added. The sections with <code class="docutils literal notranslate"><span class="pre">mynewt_arduino_zero</span></code> that need to be added
to your project file are highlighted.</p>
<p><strong>Note:</strong> On Windows platforms: You need to set <code class="docutils literal notranslate"><span class="pre">vers</span></code> to <code class="docutils literal notranslate"><span class="pre">0-dev</span></code>
and use the latest master branch for both repositories.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"> $ </span>more<span class="w"> </span>project.yml
<span class="go"> project.name: &quot;my_project&quot;</span>
<span class="go"> project.repositories:</span>
<span class="go"> - apache-mynewt-core</span>
<span class="hll"><span class="go"> - mynewt_arduino_zero</span>
</span>
<span class="go"> repository.apache-mynewt-core:</span>
<span class="go"> type: github</span>
<span class="go"> vers: 1-latest</span>
<span class="go"> user: apache</span>
<span class="go"> repo: mynewt-core</span>
<span class="hll"><span class="go"> repository.mynewt_arduino_zero:</span>
</span><span class="hll"><span class="go"> type: github</span>
</span><span class="hll"><span class="go"> vers: 1-latest</span>
</span><span class="hll"><span class="go"> user: runtimeco</span>
</span><span class="hll"><span class="go"> repo: mynewt_arduino_zero</span>
</span><span class="gp"> $</span>
</pre></div>
</div>
<p>Install the project dependencies using the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">upgrade</span></code> command
(you can specify <code class="docutils literal notranslate"><span class="pre">-v</span></code> for verbose output):</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>upgrade
<span class="go">Downloading repository mynewt_arduino_zero (commit: master) ...</span>
<span class="go">Skipping &quot;apache-mynewt-core&quot;: already upgraded (1.7.0)</span>
<span class="go">Skipping &quot;apache-mynewt-nimble&quot;: already upgraded (1.2.0)</span>
<span class="go">Skipping &quot;mcuboot&quot;: already upgraded (1.3.1)</span>
<span class="go">Making the following changes to the project:</span>
<span class="go">mynewt_arduino_zero successfully upgraded to version 1.7.0</span>
<span class="gp">$</span>
</pre></div>
</div>
<p><strong>NOTE:</strong> If there has been a new release of a repo used in your project
since you last installed it, the <code class="docutils literal notranslate"><span class="pre">1-latest</span></code> version for the repo in
the <code class="docutils literal notranslate"><span class="pre">project.yml</span></code> file will refer to the new release and will not
match the installed files. In that case you will get an error message
saying so and you will need to run <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">upgrade</span></code> to overwrite the
existing files with the latest codebase.</p>
</div>
<div class="section" id="create-a-target-for-the-bootloader">
<h2>Create a Target for the Bootloader<a class="headerlink" href="#create-a-target-for-the-bootloader" title="Permalink to this headline"></a></h2>
<p>You need to create two targets for the MKR1000 board, one for the
bootloader and one for the <code class="docutils literal notranslate"><span class="pre">winc1500_wifi</span></code> application. Run the
following <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">target</span></code> commands, from your project directory, to
create a bootloader target. We name the target <code class="docutils literal notranslate"><span class="pre">mkr1000_boot</span></code>.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span>create<span class="w"> </span>mkr1000_boot
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_boot<span class="w"> </span><span class="nv">bsp</span><span class="o">=</span>@mynewt_arduino_zero/hw/bsp/arduino_mkr1000
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_boot<span class="w"> </span><span class="nv">app</span><span class="o">=</span>@mcuboot/boot/mynewt
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_boot<span class="w"> </span><span class="nv">build_profile</span><span class="o">=</span>optimized
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_boot<span class="w"> </span><span class="nv">syscfg</span><span class="o">=</span><span class="nv">BSP_ARDUINO_ZERO_PRO</span><span class="o">=</span><span class="m">1</span>
</pre></div>
</div>
</div>
<div class="section" id="create-a-target-for-the-wi-fi-application">
<h2>Create a Target for the Wi-Fi Application<a class="headerlink" href="#create-a-target-for-the-wi-fi-application" title="Permalink to this headline"></a></h2>
<p>Run the following <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">target</span></code> commands to create a target for the
<code class="docutils literal notranslate"><span class="pre">winc1500_wifi</span></code> application in the arduino repository. We name the
application target <code class="docutils literal notranslate"><span class="pre">mkr1000_wifi</span></code>.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span>create<span class="w"> </span>mkr1000_wifi
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_wifi<span class="w"> </span><span class="nv">app</span><span class="o">=</span>@mynewt_arduino_zero/apps/winc1500_wifi
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_wifi<span class="w"> </span><span class="nv">bsp</span><span class="o">=</span>@mynewt_arduino_zero/hw/bsp/arduino_mkr1000
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_wifi<span class="w"> </span><span class="nv">build_profile</span><span class="o">=</span>debug
<span class="gp">$ </span>newt<span class="w"> </span>target<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mkr1000_boot<span class="w"> </span><span class="nv">syscfg</span><span class="o">=</span><span class="nv">BSP_ARDUINO_ZERO_PRO</span><span class="o">=</span><span class="m">1</span>
</pre></div>
</div>
</div>
<div class="section" id="build-the-bootloader">
<h2>Build the Bootloader<a class="headerlink" href="#build-the-bootloader" title="Permalink to this headline"></a></h2>
<p>Run the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">build</span> <span class="pre">mkr1000_boot</span></code> command to build the bootloader:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>build<span class="w"> </span>mkr1000_boot
<span class="go">Building target targets/mkr1000_boot</span>
<span class="go">Compiling repos/mcuboot/boot/bootutil/src/image_rsa.c</span>
<span class="go">Compiling repos/mcuboot/boot/bootutil/src/image_ec256.c</span>
<span class="go">Compiling repos/apache-mynewt-core/crypto/mbedtls/src/aes.c</span>
<span class="go">Compiling repos/mcuboot/boot/bootutil/src/image_ec.c</span>
<span class="go">Compiling repos/mcuboot/boot/bootutil/src/image_validate.c</span>
<span class="go">Compiling repos/mcuboot/boot/mynewt/src/main.c</span>
<span class="go"> ...</span>
<span class="go">Archiving util_mem.a</span>
<span class="go">Linking ~/dev/arduinowifi/bin/targets/mkr1000_boot/app/@mcuboot/boot/mynewt/mynewt.elf</span>
<span class="go">Target successfully built: targets/mkr1000_boot</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="build-the-wi-fi-application">
<h2>Build the Wi-Fi Application<a class="headerlink" href="#build-the-wi-fi-application" title="Permalink to this headline"></a></h2>
<p>Run the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">build</span> <span class="pre">mkr1000_wifi</span></code> command to build the wi-fi
application image:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span>newt<span class="w"> </span>build<span class="w"> </span>mkr1000_wifi
<span class="go">Building target targets/mkr1000_wifi</span>
<span class="go">Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec.c</span>
<span class="go">Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec256.c</span>
<span class="go">Compiling repos/apache-mynewt-core/boot/bootutil/src/image_rsa.c</span>
<span class="go">Compiling repos/apache-mynewt-core/boot/bootutil/src/image_validate.c</span>
<span class="go">Compiling repos/apache-mynewt-core/boot/bootutil/src/loader.c</span>
<span class="go"> ...</span>
<span class="go">Archiving util_mem.a</span>
<span class="go">Linking ~/dev/arduinowifi/bin/targets/mkr1000_wifi/app/apps/winc1500_wifi/winc1500_wifi.elf</span>
<span class="go">Target successfully built: targets/mkr1000_wifi</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="sign-and-create-the-wi-fi-application-image">
<h2>Sign and Create the Wi-Fi Application Image<a class="headerlink" href="#sign-and-create-the-wi-fi-application-image" title="Permalink to this headline"></a></h2>
<p>Run the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">create-image</span> <span class="pre">mkr1000_wifi</span> <span class="pre">1.0.0</span></code> command to sign and
create an image file for the Wi-Fi application. You may assign an
arbitrary version (e.g. 1.0.0) number.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span>newt<span class="w"> </span>create-image<span class="w"> </span>mkr1000_wifi<span class="w"> </span><span class="m">1</span>.0.0
<span class="go">Compiling bin/targets/mkr1000_wifi/generated/src/mkr1000_wifi-sysinit-app.c</span>
<span class="go">Archiving mkr1000_wifi-sysinit-app.a</span>
<span class="go">Linking ~/dev/arduinowifi/bin/targets/mkr1000_wifi/app/apps/winc1500_wifi/winc1500_wifi.elf</span>
<span class="go">App image succesfully generated: ~/dev/arduinowifi/bin/targets/mkr1000_wifi/app/apps/winc1500_wifi/winc1500_wifi.img</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="connect-to-the-board">
<h2>Connect to the Board<a class="headerlink" href="#connect-to-the-board" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>Connect your computer to the MKR1000 board with the Micro-USB cable.</p></li>
<li><p>Connect the debug probe to the JTAG port on the board using the Jlink
9-pin adapter and cable.</p></li>
</ul>
<blockquote>
<div><p><img alt="J-Link debug probe to MKR1000" src="../../_images/mkr1000-jlink.jpg" /></p>
</div></blockquote>
<p>Mynewt will download and debug the target through this port. You should
see a green LED come on and indicates the board has power.</p>
</div>
<div class="section" id="load-the-bootloader-onto-the-board">
<h2>Load the Bootloader onto the Board<a class="headerlink" href="#load-the-bootloader-onto-the-board" title="Permalink to this headline"></a></h2>
<p>Run the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">load</span> <span class="pre">mkr1000_boot</span></code> command to load the bootloader onto
the board:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>load<span class="w"> </span>mkr1000_boot
<span class="go">Loading bootloader</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="load-the-wi-fi-application-image-onto-the-board">
<h2>Load the Wi-Fi Application Image onto the Board<a class="headerlink" href="#load-the-wi-fi-application-image-onto-the-board" title="Permalink to this headline"></a></h2>
<p>Run the <code class="docutils literal notranslate"><span class="pre">newt</span> <span class="pre">load</span> <span class="pre">mkr1000_wifi</span></code> command to load the wifi application
onto the board:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>newt<span class="w"> </span>load<span class="w"> </span>mkr1000_wifi
<span class="go">Loading app image into slot 1</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="setup-a-serial-connection-between-your-computer-and-the-board">
<h2>Setup a Serial Connection Between Your Computer and the Board<a class="headerlink" href="#setup-a-serial-connection-between-your-computer-and-the-board" title="Permalink to this headline"></a></h2>
<p>Set up a serial connection from your computer to the MKR1000 board (See
<a class="reference internal" href="../../get_started/serial_access.html"><span class="doc">Serial Port Setup</span></a>). On the
MKR1000 board, the TX pin is PIN 14 and the RX pin in PIN 13. <img alt="Serial Connection to MKR1000" src="../../_images/mkr1000-serial.jpg" /></p>
<p>Locate the port, in the /dev directory on your computer, that the
serial connection uses. The format of the port name is platform
dependent:</p>
<ul>
<li><p>Mac OS uses the format <code class="docutils literal notranslate"><span class="pre">tty.usbserial-&lt;some</span> <span class="pre">identifier&gt;</span></code>.</p></li>
<li><p>Linux uses the format <code class="docutils literal notranslate"><span class="pre">TTYUSB&lt;N&gt;</span></code>, where <code class="docutils literal notranslate"><span class="pre">N</span></code> is a number. For
example, TTYUSB2.</p></li>
<li><p>MinGW on Windows uses the format <code class="docutils literal notranslate"><span class="pre">ttyS&lt;N&gt;</span></code>, where <code class="docutils literal notranslate"><span class="pre">N</span></code> is a
number. You must map the port name to a Windows COM port:
<code class="docutils literal notranslate"><span class="pre">/dev/ttyS&lt;N&gt;</span></code> maps to <code class="docutils literal notranslate"><span class="pre">COM&lt;N+1&gt;</span></code>. For example, <code class="docutils literal notranslate"><span class="pre">/dev/ttyS2</span></code>
maps to <code class="docutils literal notranslate"><span class="pre">COM3</span></code>.</p>
<p>You can also use the Windows Device Manager to find the COM port
number.</p>
</li>
</ul>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>ls<span class="w"> </span>/dev/tty*usbserial*
<span class="go">/dev/tty.usbserial-1d13</span>
<span class="gp">$</span>
</pre></div>
</div>
</div>
<div class="section" id="start-wi-fi-via-console">
<h2>Start Wi-Fi via console<a class="headerlink" href="#start-wi-fi-via-console" title="Permalink to this headline"></a></h2>
<p>Use a terminal emulation program to communicate with the board over the
serial port. This tutorial shows a Minicom set up. Run the minicom
command with the serial port you located on your computer:</p>
<p><strong>Note:</strong> On Windows, you can use the PuTTY application.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>minicom<span class="w"> </span>-D<span class="w"> </span>/dev/tty.usbserial-1d13<span class="w"> </span>-b<span class="w"> </span><span class="m">115200</span>
</pre></div>
</div>
<p>Type <code class="docutils literal notranslate"><span class="pre">wifi</span> <span class="pre">start</span></code> to start Wi-Fi.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go"> Welcome to minicom 2.7.1</span>
<span class="go"> OPTIONS:</span>
<span class="go"> Compiled on May 17 2017, 15:29:14.</span>
<span class="go"> Port /dev/tty.usbserial, 15:12:10</span>
<span class="go"> Press Meta-Z for help on special keys</span>
<span class="hll"><span class="go"> 138465 compat&gt; wifi start</span>
</span><span class="go"> 144570 compat&gt; (APP)(INFO)Chip ID 1503a0</span>
<span class="go"> (APP)(INFO)Firmware ver : 19.4.4</span>
<span class="go"> (APP)(INFO)Min driver ver : 19.3.0</span>
<span class="go"> (APP)(INFO)Curr driver ver: 19.3.0</span>
<span class="go"> wifi_init : 0</span>
</pre></div>
</div>
<p>Connect to the local Wi-Fi network. Note that the MKR1000 board only
supports 2.4 GHz Wi-Fi networks.</p>
<p>Run the <code class="docutils literal notranslate"><span class="pre">wifi</span> <span class="pre">connect</span></code> command and specify your network and . After
you are connected to your wi-fi network, run the <code class="docutils literal notranslate"><span class="pre">net</span> <span class="pre">service</span></code> command
to start network services.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="hll"><span class="go"> wifi connect</span>
</span><span class="go"> 037624 wifi_request_scan : 0</span>
<span class="go"> 037627 compat&gt; scan_results 7: 0</span>
<span class="go"> 038454 wifi_connect : 0</span>
<span class="go"> 039451 connect_done : 0</span>
<span class="go"> 039958 dhcp done</span>
<span class="go"> 192.168.0.135</span>
<span class="hll"><span class="go"> 040169 get sys time response 2017.7.12-22.41.33</span>
</span><span class="go"> net service</span>
</pre></div>
</div>
<p>The board is connected to the network succesfully and has IP address:
192.168.0.135</p>
</div>
<div class="section" id="establish-tcp-connection-and-talk">
<h2>Establish TCP Connection and Talk!<a class="headerlink" href="#establish-tcp-connection-and-talk" title="Permalink to this headline"></a></h2>
<p>From a terminal on your computer, telnet to ports 7, 9, or 19 using the
IP address your board has been assigned. Type something on this terminal
and see the console output (on minicom). Can you see the difference in
the behaviors?</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span>telnet<span class="w"> </span><span class="m">192</span>.168.0.135<span class="w"> </span><span class="m">7</span>
<span class="go">Trying 192.168.0.135...</span>
<span class="go">Connected to 192.168.0.135.</span>
<span class="go">Escape character is &#39;^]&#39;.</span>
<span class="go">hello</span>
<span class="go">hello</span>
<span class="go">^]</span>
<span class="go">telnet&gt; q</span>
<span class="gp">$</span>
</pre></div>
</div>
<p>One port echoes whatever is typed, one discards everything it gets, and
the third spews out bits constantly. Type <code class="docutils literal notranslate"><span class="pre">wifi</span> <span class="pre">stop</span></code> to disable WiFi
on the Arduino board.</p>
</div>
</div>
</div>
</div>
<div class="rst-footer-buttons row" role="navigation" aria-label="footer navigation">
<a href="chg_ctrl_on_pinetime.html" class="btn btn-neutral float-right" title="Charge control on PineTime" accesskey="n">Next: Charge control on PineTime <span class="fa fa-arrow-circle-right"></span></a>
<a href="unit_test.html" class="btn btn-neutral" title="Write a Test Suite for a Package" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous: Write a Test Suite for a Package</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>