| <!-- |
| 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>spi SPI Tool — 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="stackmonitor Stack Monitor" href="../stackmonitor/index.html" /> |
| <link rel="prev" title="setlogmask “setlogmask” command" href="../setlogmask/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 current"><a class="reference internal" href="../index.html">System Libraries and NSH Add-Ons</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../adb/index.html"><code class="docutils literal notranslate"><span class="pre">adb</span></code> ADB daemon application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../argtable3/index.html"><code class="docutils literal notranslate"><span class="pre">argtable3</span></code> ARGTABLE3 library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cdcacm/index.html"><code class="docutils literal notranslate"><span class="pre">cdcacm</span></code> USB CDC/ACM Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cfgdata/index.html"><code class="docutils literal notranslate"><span class="pre">cfgdata</span></code> Cfgdata Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cle/index.html"><code class="docutils literal notranslate"><span class="pre">cle</span></code> EMACS-like Command Line Editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../composite/index.html"><code class="docutils literal notranslate"><span class="pre">composite</span></code> USB Composite Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../coredump/index.html"><code class="docutils literal notranslate"><span class="pre">coredump</span></code> Coredump tool capture system status</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../crimon/index.html"><code class="docutils literal notranslate"><span class="pre">critmon</span></code> Critcal Section Monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cu/index.html"><code class="docutils literal notranslate"><span class="pre">cu</span></code> CU minimal serial terminal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dd/index.html"><code class="docutils literal notranslate"><span class="pre">dd</span></code> system ‘dd’ command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dhcp6c/index.html"><code class="docutils literal notranslate"><span class="pre">dhcp6c</span></code> DHCP IPv6 Address Renewal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dhcpc/index.html"><code class="docutils literal notranslate"><span class="pre">dhcpc</span></code> DHCP Address Renewal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dumpstack/index.html"><code class="docutils literal notranslate"><span class="pre">dumpstack</span></code> dumpstack tool for show the task backtrace</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../fastboot/index.html"><code class="docutils literal notranslate"><span class="pre">fastboot</span></code> fastbootd</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../fdt/index.html"><code class="docutils literal notranslate"><span class="pre">fdt</span></code> fdt utility tools</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../flash_eraseall/index.html"><code class="docutils literal notranslate"><span class="pre">flash_eraseall</span></code> FLASH Erase-all Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../gcov/index.html"><code class="docutils literal notranslate"><span class="pre">gcov</span></code> gcov tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../gdbstub/index.html"><code class="docutils literal notranslate"><span class="pre">gdbstub</span></code> GDBSTUB</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hex2bin/index.html"><code class="docutils literal notranslate"><span class="pre">hex2bin</span></code> Intel HEX to binary conversion</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hexed/index.html"><code class="docutils literal notranslate"><span class="pre">hexed</span></code> Hex editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hostname/index.html"><code class="docutils literal notranslate"><span class="pre">hostname</span></code> “hostname” command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../i2c/index.html"><code class="docutils literal notranslate"><span class="pre">i2c</span></code> I2C Tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../input/index.html"><code class="docutils literal notranslate"><span class="pre">input</span></code> input tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../iptables/index.html"><code class="docutils literal notranslate"><span class="pre">iptables</span></code> “iptables” command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../libuv/index.html"><code class="docutils literal notranslate"><span class="pre">libuv</span></code> libuv asynchronous I/O Library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../lm75/index.html"><code class="docutils literal notranslate"><span class="pre">lm75</span></code> LM75 Temperature</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../lzf/index.html"><code class="docutils literal notranslate"><span class="pre">lzf</span></code> LZF compression tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../mdio/index.html"><code class="docutils literal notranslate"><span class="pre">mdio</span></code> PHY MDIO tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../netdb/index.html"><code class="docutils literal notranslate"><span class="pre">netdb</span></code> netdb interface</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nsh/index.html"><code class="docutils literal notranslate"><span class="pre">nsh</span></code> NuttShell (NSH) example</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ntpc/index.html"><code class="docutils literal notranslate"><span class="pre">ntpc</span></code> NTP Daemon Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxcamera/index.html"><code class="docutils literal notranslate"><span class="pre">nxcamera</span></code> NxCamera video test application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxdiag/index.html"><code class="docutils literal notranslate"><span class="pre">nxdiag</span></code> NuttX Diagnostic Tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxlooper/index.html"><code class="docutils literal notranslate"><span class="pre">nxlooper</span></code> NxLooper audio test application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxplayer/index.html"><code class="docutils literal notranslate"><span class="pre">nxplayer</span></code> NxPlayer Media Player</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxrecorder/index.html"><code class="docutils literal notranslate"><span class="pre">nxrecorder</span></code> NxRecorder pcm raw data Recorder</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ofloader/index.html"><code class="docutils literal notranslate"><span class="pre">ofloader</span></code> Open flash loader</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ping/index.html"><code class="docutils literal notranslate"><span class="pre">ping</span></code> ICMP “ping” command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ping6/index.html"><code class="docutils literal notranslate"><span class="pre">ping6</span></code> ICMPv6 “ping6” command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../popen/index.html"><code class="docutils literal notranslate"><span class="pre">popen</span></code> popen()/pclose() Functions</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../psmq/index.html"><code class="docutils literal notranslate"><span class="pre">psmq</span></code> Publish Subscribe Message Queue</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ptpd/index.html"><code class="docutils literal notranslate"><span class="pre">ptpd</span></code> PTP daemon commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../readline/index.html"><code class="docutils literal notranslate"><span class="pre">readline</span></code> readline() Support</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../sched_note/index.html"><code class="docutils literal notranslate"><span class="pre">sched_note</span></code> Scheduler monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../setlogmask/index.html"><code class="docutils literal notranslate"><span class="pre">setlogmask</span></code> “setlogmask” command</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">spi</span></code> SPI Tool</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#contents">Contents</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#system-requirements">System Requirements</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#configuration-options">Configuration Options</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#help">Help</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#command-line-form">Command Line Form</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#common-command-options">Common Command Options</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#sticky-options">“Sticky” Options</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#environment-variables">Environment Variables</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#common-option-summary">Common Option Summary</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#command-summary">Command Summary</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#list-buses-bus-options">List buses: <code class="docutils literal notranslate"><span class="pre">bus</span> <span class="pre">[OPTIONS]</span></code></a></li> |
| <li class="toctree-l5"><a class="reference internal" href="#exchange-data-exch-options-optional-tx-data">Exchange data: <code class="docutils literal notranslate"><span class="pre">exch</span> <span class="pre">[OPTIONS]</span> <span class="pre"><Optional</span> <span class="pre">TX</span> <span class="pre">Data></span></code></a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#i2c-build-configuration">I2C Build Configuration</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#nuttx-configuration-requirements">NuttX Configuration Requirements</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../stackmonitor/index.html"><code class="docutils literal notranslate"><span class="pre">stackmonitor</span></code> Stack Monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../system/index.html"><code class="docutils literal notranslate"><span class="pre">system</span></code> System Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../taskset/index.html"><code class="docutils literal notranslate"><span class="pre">taskset</span></code> Taskset Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../tcpdump/index.html"><code class="docutils literal notranslate"><span class="pre">tcpdump</span></code> tcpdump command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../tee/index.html"><code class="docutils literal notranslate"><span class="pre">tee</span></code> Tee Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../telnet/index.html"><code class="docutils literal notranslate"><span class="pre">telnet</span></code> Telnet chat daemon</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../telnetd/index.html"><code class="docutils literal notranslate"><span class="pre">telnetd</span></code> Telnet daemon application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../termcurses/index.html"><code class="docutils literal notranslate"><span class="pre">termcurses</span></code> Terminal Curses control support</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../trace/index.html"><code class="docutils literal notranslate"><span class="pre">trace</span></code> Trace command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ubloxmodem/index.html"><code class="docutils literal notranslate"><span class="pre">ubloxmodem</span></code> u-blox modem configuration tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../uniqueid/index.html"><code class="docutils literal notranslate"><span class="pre">uniqueid</span></code> “uniqueid” command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../uorb/index.html"><code class="docutils literal notranslate"><span class="pre">uorb</span></code> uorb(micro object request broker)</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../usbmsc/index.html"><code class="docutils literal notranslate"><span class="pre">usbmsc</span></code> USB Mass Storage Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../vi/index.html"><code class="docutils literal notranslate"><span class="pre">vi</span></code> VI Work-Alike Text Editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ymodem/index.html"><code class="docutils literal notranslate"><span class="pre">ymodem</span></code> YMODEM</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../zlib/index.html"><code class="docutils literal notranslate"><span class="pre">zlib</span></code> zlib data compression library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../zmodem/index.html"><code class="docutils literal notranslate"><span class="pre">zmodem</span></code> Zmodem Commands</a></li> |
| </ul> |
| </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"><a class="reference internal" href="../../wireless/index.html">Wireless Libraries and NSH Add-Ons</a></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">System Libraries and NSH Add-Ons</a></li> |
| <li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">spi</span></code> SPI Tool</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../../../_sources/applications/system/spi/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="spi-spi-tool"> |
| <h1><code class="docutils literal notranslate"><span class="pre">spi</span></code> SPI Tool<a class="headerlink" href="#spi-spi-tool" title="Permalink to this heading"></a></h1> |
| <p>The I2C tool provides a way to debug SPI related problems. This README file will |
| provide usage information for the SPI tools.</p> |
| <section id="contents"> |
| <h2>Contents<a class="headerlink" href="#contents" title="Permalink to this heading"></a></h2> |
| <ul class="simple"> |
| <li><p>System Requirements</p> |
| <ul> |
| <li><p>SPI Driver</p></li> |
| <li><p>Configuration Options</p></li> |
| </ul> |
| </li> |
| <li><p>Help</p></li> |
| <li><p>Common Line Form</p></li> |
| <li><p>Common Command Options</p> |
| <ul> |
| <li><p>“Sticky” Options</p></li> |
| <li><p>Environment variables</p></li> |
| <li><p>Common Option Summary</p></li> |
| </ul> |
| </li> |
| <li><p>Command summary</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">bus</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">dev</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">get</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">set</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">verf</span></code></p></li> |
| </ul> |
| </li> |
| <li><p>I2C Build Configuration</p> |
| <ul> |
| <li><p>NuttX Configuration Requirements</p></li> |
| <li><p>I2C Tool Configuration Options</p></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <section id="system-requirements"> |
| <h2>System Requirements<a class="headerlink" href="#system-requirements" title="Permalink to this heading"></a></h2> |
| <p>The SPI tool is designed to be implemented as a NuttShell (NSH) add-on. Read the |
| <code class="docutils literal notranslate"><span class="pre">apps/nshlib/README.md</span></code> file for information about add-ons.</p> |
| <section id="configuration-options"> |
| <h3>Configuration Options<a class="headerlink" href="#configuration-options" title="Permalink to this heading"></a></h3> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_BUILTIN_APPS</span></code> – Build the tools as an NSH built-in command.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MINBUS</span></code> – Smallest bus index supported by the hardware |
| (default <code class="docutils literal notranslate"><span class="pre">0</span></code>).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MAXBUS</span></code> – Largest bus index supported by the hardware |
| (default <code class="docutils literal notranslate"><span class="pre">3</span></code>).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_DEFFREQ</span></code> – Default frequency (default: <code class="docutils literal notranslate"><span class="pre">40000000</span></code>).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_DEFMODE</span></code> – Default mode, where:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>0 = CPOL=0, CPHA=0 |
| 1 = CPOL=0, CPHA=1 |
| 2 = CPOL=1, CPHA=0 |
| 3 = CPOL=1, CPHA=1 |
| </pre></div> |
| </div> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_DEFWIDTH</span></code> – Default bit width (default <code class="docutils literal notranslate"><span class="pre">8</span></code>).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_DEFWORDS</span></code> – Default number of words to exchange (default <code class="docutils literal notranslate"><span class="pre">1</span></code>).</p></li> |
| </ul> |
| </section> |
| </section> |
| <section id="help"> |
| <h2>Help<a class="headerlink" href="#help" title="Permalink to this heading"></a></h2> |
| <p>The SPI tools supports some help output. That help output can be view by |
| entering either:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> spi help |
| </pre></div> |
| </div> |
| <p>or:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> spi ? |
| </pre></div> |
| </div> |
| <p>Here is an example of the help output. I shows the general form of the command |
| line, the various SPI commands supported with their unique command line options, |
| and a more detailed summary of the command SPI command options:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> Usage: spi <cmd> [arguments] |
| |
| Where <cmd> is one of: |
| |
| Show help : ? |
| List buses : bus |
| SPI Exchange : exch [OPTIONS] [<hex senddata>] |
| Show help : help |
| |
| Where common _sticky_ OPTIONS include: |
| [-b bus] is the SPI bus number (decimal). Default: 0 Current: 2 |
| [-f freq] SPI frequency. Default: 4000000 Current: 4000000 |
| [-m mode] Mode for transfer. Default: 0 Current: 0 |
| [-u udelay] Delay after transfer in uS. Default: 0 Current: 0 |
| [-w width] Width of bus. Default: 8 Current: 8 |
| [-x count] Words to exchange. Default: 1 Current: 4 |
| </pre></div> |
| </div> |
| <p><strong>Notes</strong>:</p> |
| <ul class="simple"> |
| <li><p>An environment variable like $PATH may be used for any argument.</p></li> |
| <li><p>Arguments are _sticky_. For example, once the SPI address is specified, that |
| address will be re-used until it is changed.</p></li> |
| </ul> |
| <p><strong>Warning</strong>:</p> |
| <ul class="simple"> |
| <li><p>The SPI commands may have bad side effects on your SPI devices. Use only at |
| your own risk.</p></li> |
| </ul> |
| </section> |
| <section id="command-line-form"> |
| <h2>Command Line Form<a class="headerlink" href="#command-line-form" title="Permalink to this heading"></a></h2> |
| <p>The SPI is started from NSH by invoking the <code class="docutils literal notranslate"><span class="pre">spi</span></code> command from the NSH command |
| line. The general form of the <code class="docutils literal notranslate"><span class="pre">spi</span></code> command is:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>spi <cmd> [arguments] |
| </pre></div> |
| </div> |
| <p>Where <code class="docutils literal notranslate"><span class="pre"><cmd></span></code> is a “sub-command” and identifies one SPI operation supported by |
| the tool. <code class="docutils literal notranslate"><span class="pre">[arguments]</span></code> represents the list of arguments needed to perform the |
| SPI operation. Those arguments vary from command to command as described below. |
| However, there is also a core set of common <code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code> supported by all commands. |
| So perhaps a better representation of the general SPI command would be:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>i2c <cmd> [OPTIONS] [arguments] |
| </pre></div> |
| </div> |
| <p>Where <code class="docutils literal notranslate"><span class="pre">[OPTIONS]</span></code> represents the common options and and arguments represent the |
| operation-specific arguments.</p> |
| </section> |
| <section id="common-command-options"> |
| <h2>Common Command Options<a class="headerlink" href="#common-command-options" title="Permalink to this heading"></a></h2> |
| <section id="sticky-options"> |
| <h3>“Sticky” Options<a class="headerlink" href="#sticky-options" title="Permalink to this heading"></a></h3> |
| <p>In order to interact with SPI devices, there are a number of SPI parameters that |
| must be set correctly. One way to do this would be to provide to set the value |
| of each separate command for each SPI parameter. The SPI tool takes a different |
| approach, instead: The SPI configuration can be specified as a (potentially |
| long) sequence of command line arguments.</p> |
| <p>These arguments, however, are _sticky_. They are sticky in the sense that once |
| you set the SPI parameter, that value will remain until it is reset with a new |
| value (or until you reset the board).</p> |
| </section> |
| <section id="environment-variables"> |
| <h3>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this heading"></a></h3> |
| <p><strong>Note</strong> also that if environment variables are not disabled (by |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_DISABLE_ENVIRON=y</span></code>), then these options may also be environment |
| variables. Environment variables must be preceded with the special character |
| <code class="docutils literal notranslate"><span class="pre">$</span></code>. For example, <code class="docutils literal notranslate"><span class="pre">PWD</span></code> is the variable that holds the current working directory |
| and so <code class="docutils literal notranslate"><span class="pre">$PWD</span></code> could be used as a command line argument. The use of environment |
| variables on the I2C tools command is really only useful if you wish to write |
| NSH scripts to execute a longer, more complex series of SPI commands.</p> |
| </section> |
| <section id="common-option-summary"> |
| <h3>Common Option Summary<a class="headerlink" href="#common-option-summary" title="Permalink to this heading"></a></h3> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-b</span> <span class="pre">bus]</span></code> is the SPI bus number (decimal). Default: <code class="docutils literal notranslate"><span class="pre">0</span></code></p> |
| <p>Which SPI bus to commiuncate on. The bus must have been initialised as a |
| character device in the config in the form <code class="docutils literal notranslate"><span class="pre">/dev/spiX</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">/dev/spi2</span></code>).</p> |
| <p>The valid range of bus numbers is controlled by the configuration settings |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MINBUS</span></code> and <code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MAXBUS</span></code>.</p> |
| <p>The bus numbers are small, decimal numbers.</p> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-m</span> <span class="pre">mode]</span></code> SPI Mode for transfer.</p> |
| <p>Which of the available SPI modes is to be used. Options are:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>0 = CPOL=0, CPHA=0 |
| 1 = CPOL=0, CPHA=1 |
| 2 = CPOL=1, CPHA=0 |
| 3 = CPOL=1, CPHA=1 |
| </pre></div> |
| </div> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-u</span> <span class="pre">udelay]</span></code> Delay after transfer in uS. Default: <code class="docutils literal notranslate"><span class="pre">0</span></code></p> |
| <p>Any extra delay to be provided after the transfer. Not normally needed from |
| the command line.</p> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-x</span> <span class="pre">count]</span></code> Words to exchange Default: <code class="docutils literal notranslate"><span class="pre">1</span></code></p> |
| <p>The number of words to be transited over the bus. For sanitys sake this is |
| limited to a relatively small number (<code class="docutils literal notranslate"><span class="pre">40</span></code> by default). Any data on the |
| command line is sent first, padded by <code class="docutils literal notranslate"><span class="pre">0xFF</span></code>’s while any remaining data are |
| received.</p> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-w</span> <span class="pre">width]</span></code> is the data width (varies according to target). Default: <code class="docutils literal notranslate"><span class="pre">8</span></code></p> |
| <p>Various SPI devices support different data widths. This option is untested.</p> |
| </li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">[-f</span> <span class="pre">freq]</span></code> I2C frequency. Default: <code class="docutils literal notranslate"><span class="pre">4000000</span></code> Current: <code class="docutils literal notranslate"><span class="pre">4000000</span></code></p> |
| <p>The <code class="docutils literal notranslate"><span class="pre">[-f</span> <span class="pre">freq]</span></code> sets the frequency of the SPI device. The default is very |
| conservative.</p> |
| </li> |
| </ul> |
| </section> |
| </section> |
| <section id="command-summary"> |
| <h2>Command Summary<a class="headerlink" href="#command-summary" title="Permalink to this heading"></a></h2> |
| <section id="list-buses-bus-options"> |
| <h3>List buses: <code class="docutils literal notranslate"><span class="pre">bus</span> <span class="pre">[OPTIONS]</span></code><a class="headerlink" href="#list-buses-bus-options" title="Permalink to this heading"></a></h3> |
| <p>This command will simply list all of the configured SPI buses and indicate which |
| are supported by the driver and which are not:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>BUS EXISTS? |
| Bus 1: YES |
| Bus 2: NO |
| </pre></div> |
| </div> |
| <p>The valid range of bus numbers is controlled by the configuration settings |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MINBUS</span></code> and <code class="docutils literal notranslate"><span class="pre">CONFIG_SPITOOL_MAXBUS</span></code>.</p> |
| </section> |
| <section id="exchange-data-exch-options-optional-tx-data"> |
| <h3>Exchange data: <code class="docutils literal notranslate"><span class="pre">exch</span> <span class="pre">[OPTIONS]</span> <span class="pre"><Optional</span> <span class="pre">TX</span> <span class="pre">Data></span></code><a class="headerlink" href="#exchange-data-exch-options-optional-tx-data" title="Permalink to this heading"></a></h3> |
| <p>This command triggers an SPI transfer, returning the data back from the far end. |
| As an example (with MOSI looped back to MISO):</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> spi exch -b 2 -x 4 aabbccdd |
| |
| Received: AA BB CC DD |
| </pre></div> |
| </div> |
| <p>Note that the <code class="docutils literal notranslate"><span class="pre">TX</span> <span class="pre">Data</span></code> are always specified in hex, and are always two digits |
| each, case insensitive.</p> |
| </section> |
| </section> |
| <section id="i2c-build-configuration"> |
| <h2>I2C Build Configuration<a class="headerlink" href="#i2c-build-configuration" title="Permalink to this heading"></a></h2> |
| <section id="nuttx-configuration-requirements"> |
| <h3>NuttX Configuration Requirements<a class="headerlink" href="#nuttx-configuration-requirements" title="Permalink to this heading"></a></h3> |
| <p>The SPI tools requires the following in your NuttX configuration:</p> |
| <ol class="arabic"> |
| <li><p>Application configuration.</p> |
| <p>Using <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">menuconfig</span></code>, select the SPI tool. The following definition should |
| appear in your <code class="docutils literal notranslate"><span class="pre">.config</span></code> file:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SYSTEM_SPI=y |
| </pre></div> |
| </div> |
| </li> |
| <li><p>Device-specific SPI driver support must be enabled:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_SPI_DRIVER=y |
| </pre></div> |
| </div> |
| <p>The SPI tool will then use the SPI character driver to access the SPI bus. |
| These devices will reside at <code class="docutils literal notranslate"><span class="pre">/dev/spiN</span></code> where <code class="docutils literal notranslate"><span class="pre">N</span></code> is the I2C bus number.</p> |
| <p><strong>Note</strong>: The SPI driver <code class="docutils literal notranslate"><span class="pre">ioctl</span></code> interface is defined in |
| <code class="docutils literal notranslate"><span class="pre">include/nuttx/spi/spi.h</span></code>.</p> |
| </li> |
| </ol> |
| </section> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="../setlogmask/index.html" class="btn btn-neutral float-left" title="setlogmask “setlogmask” command" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="../stackmonitor/index.html" class="btn btn-neutral float-right" title="stackmonitor Stack Monitor" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |