| <!-- |
| 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>How to use RNDIS — 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="Drivers" href="drivers.html" /> |
| <link rel="prev" title="How to debug NuttX using QEMU and GDB" href="qemugdb.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> |
| |
| <option value="../../12.6.0" >12.6.0</option> |
| |
| <option value="../../12.7.0" >12.7.0</option> |
| |
| <option value="../../12.8.0" >12.8.0</option> |
| |
| <option value="../../12.9.0" >12.9.0</option> |
| |
| <option value="../../12.10.0" >12.10.0</option> |
| |
| <option value="../../12.11.0" >12.11.0</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"><a class="reference internal" href="../applications/index.html">Applications</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 current"><a class="reference internal" href="index.html">Guides</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="nfs.html">NFS Client How-To</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="usbtrace.html">USB Device Trace</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="simulator.html">Simulator</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="qemugdb.html">How to debug NuttX using QEMU and GDB</a></li> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">How to use RNDIS</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#compiling">Compiling</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#flashing">Flashing</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#setup-rndis-in-your-computer">Setup RNDIS in your computer</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="drivers.html">Drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="tasktrace.html">Task Trace</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="cpp_cmake.html">C++ Example using CMake</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="cortexmhardfaults.html">Analyzing Cortex-M Hardfaults</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="coredump.html">Core Dump</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="gdbwithpython.html">GDB with Python</a></li> |
| </ul> |
| </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">Guides</a></li> |
| <li class="breadcrumb-item active">How to use RNDIS</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../_sources/guides/rndis.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="how-to-use-rndis"> |
| <span id="rndis"></span><h1>How to use RNDIS<a class="headerlink" href="#how-to-use-rndis" title="Permalink to this heading"></a></h1> |
| <p>This guide explains the steps needed to get USB RNDIS working, using |
| the STM32F4Discovery board as example.</p> |
| <p>If you don’t know RNDIS, it is a way to share Ethernet-like connection |
| over USB port without using any external device to it. Just a USB cable |
| between your board (that has USB Device) and your computer.</p> |
| <p>WARNING: RNDIS is going to be removed from Linux kernel because they |
| understand it as an unsecure protocol. That said use it aware of this |
| risk and also be aware that it was tested up to Ubuntu 22.04 LTS and |
| couldn’t work in future versions.</p> |
| <section id="compiling"> |
| <h2>Compiling<a class="headerlink" href="#compiling" title="Permalink to this heading"></a></h2> |
| <ol class="arabic"> |
| <li><p>Configure the RNDIS</p> |
| <p>There is a sample configuration to use RNDIS on stm32f4discovery |
| board. If your board doesn’t save a sample example then you need |
| to create a configuration by yourself looking this config.</p> |
| <p>Just use <code class="docutils literal notranslate"><span class="pre">stm32f4discovery:rndis</span></code> board profile for this purpose.</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>nuttx |
| <span class="gp">$ </span>./tools/configure.sh<span class="w"> </span>stm32f4discovery:rndis |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Compile</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>make<span class="w"> </span>-j |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| </ol> |
| </section> |
| <section id="flashing"> |
| <h2>Flashing<a class="headerlink" href="#flashing" title="Permalink to this heading"></a></h2> |
| <ol class="arabic"> |
| <li><p>Flash the generated nuttx.bin to your board:</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>$<span class="w"> </span>sudo<span class="w"> </span>openocd<span class="w"> </span>-f<span class="w"> </span>interface/stlink.cfg<span class="w"> </span>-f<span class="w"> </span>target/stm32f4x.cfg<span class="w"> </span>-c<span class="w"> </span>init<span class="w"> </span>-c<span class="w"> </span><span class="s2">"reset halt"</span><span class="w"> </span>-c<span class="w"> </span><span class="s2">"flash write_image erase nuttx.bin 0x08000000"</span> |
| <span class="go">...</span> |
| <span class="go">Open On-Chip Debugger 0.11.0</span> |
| <span class="go">...</span> |
| <span class="go">Info : STLINK V2J14S0 (API v2) VID:PID 0483:3748</span> |
| <span class="go">Info : Target voltage: 3.203144</span> |
| <span class="go">Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints</span> |
| <span class="go">Info : starting gdb server for stm32f4x.cpu on 3333</span> |
| <span class="go">Info : Listening on port 3333 for gdb connections</span> |
| <span class="go">target halted due to debug-request, current mode: Thread</span> |
| <span class="go">xPSR: 0x01000000 pc: 0x08000188 msp: 0x20003f24</span> |
| <span class="go">Info : device id = 0x10036413</span> |
| <span class="go">Info : flash size = 1024 kbytes</span> |
| <span class="go">auto erase enabled</span> |
| <span class="go">wrote 262144 bytes from file nuttx.bin in 11.043253s (23.182 KiB/s)</span> |
| <span class="go">Info : Listening on port 6666 for tcl connections</span> |
| <span class="go">Info : Listening on port 4444 for telnet connections</span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| </ol> |
| </section> |
| <section id="setup-rndis-in-your-computer"> |
| <h2>Setup RNDIS in your computer<a class="headerlink" href="#setup-rndis-in-your-computer" title="Permalink to this heading"></a></h2> |
| <blockquote> |
| <div><p>These steps show how to connect your board to your Linux machine.</p> |
| </div></blockquote> |
| <div class="admonition-todo admonition" id="id1"> |
| <p class="admonition-title">Todo</p> |
| <p>Add Mac and Windows instructions</p> |
| </div> |
| <ol class="arabic"> |
| <li><p>Reset your board</p></li> |
| <li><p>Plug a USB cable from the STM32F4Discovery’s microUSB to your computer</p></li> |
| <li><p>Confirm that your board was detected as a USB RNDIS device:</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>dmesg |
| <span class="go">...</span> |
| <span class="go">[ 1099.821480] usb 3-3: new full-speed USB device number 12 using xhci_hcd</span> |
| <span class="go">[ 1099.972379] usb 3-3: New USB device found, idVendor=584e, idProduct=5342, bcdDevice= 0.01</span> |
| <span class="go">[ 1099.972389] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3</span> |
| <span class="go">[ 1099.972393] usb 3-3: Product: RNDIS gadget</span> |
| <span class="go">[ 1099.972396] usb 3-3: Manufacturer: NuttX</span> |
| <span class="go">[ 1099.972398] usb 3-3: SerialNumber: 1234</span> |
| <span class="go">[ 1099.988952] usbcore: registered new interface driver cdc_ether</span> |
| <span class="go">[ 1099.990144] rndis_host 3-3:1.0: skipping garbage</span> |
| <span class="go">[ 1099.990641] rndis_host 3-3:1.0: dev can't take 1558 byte packets (max 660), adjusting MTU to 602</span> |
| <span class="go">[ 1099.992089] rndis_host 3-3:1.0 eth0: register 'rndis_host' at usb-0000:00:14.0-3, RNDIS device, a0:e0:de:ad:ca:fe</span> |
| <span class="go">[ 1099.992102] usbcore: registered new interface driver rndis_host</span> |
| <span class="go">[ 1099.994026] usbcore: registered new interface driver rndis_wlan</span> |
| <span class="go">[ 1099.997001] rndis_host 3-3:1.0 enxa0e0deadcafe: renamed from eth0</span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Configure your Linux distro to share network to this USB RNDIS device:</p> |
| <p>Click in the top right corner of your Ubuntu and go to:</p> |
| <p>NuttX Ethernet -> Wired Settings</p> |
| <p>Click in the ‘Gear icon’ and in the tab “IPv4” select: “Shared to other computers”</p> |
| <p>Click on “Apply”</p> |
| <p>Disconect and connect the USB cable to force it to get IP.</p> |
| </li> |
| <li><p>Identify what IP address your board got:</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>tail<span class="w"> </span>-f<span class="w"> </span>/var/log/syslog |
| <span class="go">...</span> |
| <span class="go">Jan 28 10:30:24 dev dnsmasq-dhcp[35526]: DHCPDISCOVER(enxa0e0deadcafe) 00:e0:de:ad:ca:fe</span> |
| <span class="go">Jan 28 10:30:24 dev dnsmasq-dhcp[35526]: DHCPOFFER(enxa0e0deadcafe) 10.42.0.86 00:e0:de:ad:ca:fe</span> |
| <span class="go">Jan 28 10:30:24 dev dnsmasq-dhcp[35526]: DHCPREQUEST(enxa0e0deadcafe) 10.42.0.86 00:e0:de:ad:ca:fe</span> |
| <span class="go">Jan 28 10:30:24 dev dnsmasq-dhcp[35526]: DHCPACK(enxa0e0deadcafe) 10.42.0.86 00:e0:de:ad:ca:fe nuttx</span> |
| <span class="go">Jan 28 10:30:29 dev systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.</span> |
| <span class="go">^C</span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Ping this IP to confirm it is working:</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>ping<span class="w"> </span><span class="m">10</span>.42.0.86 |
| <span class="go">PING 10.42.0.86 (10.42.0.86) 56(84) bytes of data.</span> |
| <span class="go">64 bytes from 10.42.0.86: icmp_seq=1 ttl=64 time=0.809 ms</span> |
| <span class="go">64 bytes from 10.42.0.86: icmp_seq=2 ttl=64 time=0.849 ms</span> |
| <span class="go">^C</span> |
| <span class="go">--- 10.42.0.86 ping statistics ---</span> |
| <span class="go">2 packets transmitted, 2 received, 0% packet loss, time 1027ms</span> |
| <span class="go">rtt min/avg/max/mdev = 0.809/0.829/0.849/0.020 ms</span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| <li><p>Connect to your board over telnet:</p> |
| <blockquote> |
| <div><div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>telnet<span class="w"> </span><span class="m">10</span>.42.0.86 |
| <span class="go">Trying 10.42.0.86...</span> |
| <span class="go">Connected to 10.42.0.86.</span> |
| <span class="go">Escape character is '^]'.</span> |
| |
| <span class="go">NuttShell (NSH) NuttX-12.0.0</span> |
| <span class="go">nsh></span> |
| </pre></div> |
| </div> |
| </div></blockquote> |
| </li> |
| </ol> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="qemugdb.html" class="btn btn-neutral float-left" title="How to debug NuttX using QEMU and GDB" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="drivers.html" class="btn btn-neutral float-right" title="Drivers" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2020, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |