update docs
[web/altusmetrum] / AltOS / doc / companion.html
index 6936953d03eff364a095985fb6d90bf5025bb54c..086fa7198cf3259f799572768644079b23290f9a 100644 (file)
@@ -1,10 +1,10 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>AltOS Companion Port</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" title="AltOS Companion Port"><div class="titlepage"><div><div><h2 class="title"><a name="idm14833760"></a>AltOS Companion Port</h2></div><div><h3 class="subtitle"><i>Protocol Definitions</i></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Keith</span> <span class="surname">Packard</span></h3></div></div><div><p class="copyright">Copyright © 2012 Keith Packard</p></div><div><div class="legalnotice" title="Legal Notice"><a name="idp108936"></a><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>AltOS Companion Port</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article"><div class="titlepage"><div><div><h2 class="title"><a name="idm6245264"></a>AltOS Companion Port</h2></div><div><h3 class="subtitle"><i>Protocol Definitions</i></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Keith</span> <span class="surname">Packard</span></h3></div></div><div><p class="copyright">Copyright © 2012 Keith Packard</p></div><div><div class="legalnotice"><a name="idp48058064"></a><p>
        This document is released under the terms of the
        <a class="ulink" href="http://creativecommons.org/licenses/by-sa/3.0/" target="_top">
          Creative Commons ShareAlike 3.0
        </a>
        license.
-      </p></div></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="2"><b>Revision History</b></th></tr><tr><td align="left">Revision 0.1</td><td align="left">13 January 2012</td></tr><tr><td align="left" colspan="2">Initial content</td></tr></table></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#idp110960">1. Companion Port</a></span></dt><dt><span class="section"><a href="#idp775584">2. Companion SPI Protocol</a></span></dt><dt><span class="section"><a href="#idp2087320">3. SPI Message Formats</a></span></dt><dd><dl><dt><span class="section"><a href="#idp2275192">3.1. Command Message</a></span></dt><dt><span class="section"><a href="#idp789920">3.2. SETUP reply message</a></span></dt><dt><span class="section"><a href="#idp195992">3.3. FETCH reply message</a></span></dt></dl></dd><dt><span class="section"><a href="#idp47944">4. History and Motivation</a></span></dt></dl></div><div class="section" title="1. Companion Port"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp110960"></a>1. Companion Port</h2></div></div></div><p>
+      </p></div></div><div><div class="revhistory"><table style="border-style:solid; width:100%;" summary="Revision History"><tr><th align="left" valign="top" colspan="2"><b>Revision History</b></th></tr><tr><td align="left">Revision 0.1</td><td align="left">13 January 2012</td></tr><tr><td align="left" colspan="2">Initial content</td></tr></table></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#idp47880352">1. Companion Port</a></span></dt><dt><span class="section"><a href="#idp47884848">2. Companion SPI Protocol</a></span></dt><dt><span class="section"><a href="#idp48960080">3. SPI Message Formats</a></span></dt><dd><dl><dt><span class="section"><a href="#idp48961360">3.1. Command Message</a></span></dt><dt><span class="section"><a href="#idp47895456">3.2. SETUP reply message</a></span></dt><dt><span class="section"><a href="#idp47916992">3.3. FETCH reply message</a></span></dt></dl></dd><dt><span class="section"><a href="#idp54642256">4. History and Motivation</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp47880352"></a>1. Companion Port</h2></div></div></div><p>
       Many Altus Metrum products come with an eight pin Micro MaTch
       connector, called the Companion Port. This is often used to
       program devices using a programming cable. However, it can also
       (hence the name).
     </p><p>
       The Companion Port provides two different functions:
-      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
          Power. Both battery-level and 3.3V regulated power are
          available. Note that the amount of regulated power is not
          huge; TeleMetrum contains a 150mA regulator and uses, at
          peak, about 120mA or so. For applications needing more than
          a few dozen mA, placing a separate regulator on them and
          using the battery for power is probably a good idea.
-       </li><li class="listitem">
+         </p></li><li class="listitem"><p>
          SPI. The flight computer operates as a SPI master, using
          a protocol defined in this document. Companion boards
          provide a matching SPI slave implementation which supplies
          telemetry information for the radio downlink during flight
-       </li></ul></div><p>
-    </p></div><div class="section" title="2. Companion SPI Protocol"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp775584"></a>2. Companion SPI Protocol</h2></div></div></div><p>
+         </p></li></ul></div><p>
+    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp47884848"></a>2. Companion SPI Protocol</h2></div></div></div><p>
       The flight computer implements a SPI master communications
       channel over the companion port, and uses this to get
       information about a connected companion board and then to get
     </p><p>
       Because of the limits of the AVR processors used in the first
       two companion boards, the SPI data rate is set to 187.5kbaud.
-    </p></div><div class="section" title="3. SPI Message Formats"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp2087320"></a>3. SPI Message Formats</h2></div></div></div>
+    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp48960080"></a>3. SPI Message Formats</h2></div></div></div><p>
     This section first defines the command message format sent from
     the flight computer to the companion board, and then the various
     reply message formats for each type of command message.
-    <div class="section" title="3.1. Command Message"><div class="titlepage"><div><div><h3 class="title"><a name="idp2275192"></a>3.1. Command Message</h3></div></div></div><div class="table"><a name="idp1196016"></a><p class="title"><b>Table 1. Companion Command Message</b></p><div class="table-contents"><table summary="Companion Command Message" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint8_t</td><td align="left">command</td><td align="left">Command identifier</td></tr><tr><td align="center">1</td><td align="center">uint8_t</td><td align="left">flight_state</td><td align="left">Current flight computer state</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">tick</td><td align="left">Flight computer clock (100 ticks/second)</td></tr><tr><td align="center">4</td><td align="center">uint16_t</td><td align="left">serial</td><td align="left">Flight computer serial number</td></tr><tr><td align="center">6</td><td align="center">uint16_t</td><td align="left">flight</td><td align="left">Flight number</td></tr><tr><td align="center">8</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="idp781256"></a><p class="title"><b>Table 2. Companion Command Identifiers</b></p><div class="table-contents"><table summary="Companion Command Identifiers" border="1"><colgroup><col align="center" class="Value"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Value</th><th align="left">Name</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">1</td><td align="left">SETUP</td><td align="left">Supply the flight computer with companion
+    </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp48961360"></a>3.1. Command Message</h3></div></div></div><div class="table"><a name="idp48962032"></a><p class="title"><b>Table 1. Companion Command Message</b></p><div class="table-contents"><table summary="Companion Command Message" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint8_t</td><td align="left">command</td><td align="left">Command identifier</td></tr><tr><td align="center">1</td><td align="center">uint8_t</td><td align="left">flight_state</td><td align="left">Current flight computer state</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">tick</td><td align="left">Flight computer clock (100 ticks/second)</td></tr><tr><td align="center">4</td><td align="center">uint16_t</td><td align="left">serial</td><td align="left">Flight computer serial number</td></tr><tr><td align="center">6</td><td align="center">uint16_t</td><td align="left">flight</td><td align="left">Flight number</td></tr><tr><td align="center">8</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="idp53502880"></a><p class="title"><b>Table 2. Companion Command Identifiers</b></p><div class="table-contents"><table summary="Companion Command Identifiers" border="1"><colgroup><col align="center" class="Value"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Value</th><th align="left">Name</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">1</td><td align="left">SETUP</td><td align="left">Supply the flight computer with companion
              information</td></tr><tr><td align="center">2</td><td align="left">FETCH</td><td align="left">Return telemetry information</td></tr><tr><td align="center">3</td><td align="left">NOTIFY</td><td align="left">Tell companion board when flight state
              changes</td></tr></tbody></table></div></div><br class="table-break"><p>
        The flight computer will send a SETUP message shortly after
@@ -74,7 +74,7 @@
        use this to change data collection parameters, disabling data
        logging until the flight starts and terminating it when the
        flight ends.
-      </p></div><div class="section" title="3.2. SETUP reply message"><div class="titlepage"><div><div><h3 class="title"><a name="idp789920"></a>3.2. SETUP reply message</h3></div></div></div><div class="table"><a name="idp790264"></a><p class="title"><b>Table 3. SETUP reply contents</b></p><div class="table-contents"><table summary="SETUP reply contents" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint16_t</td><td align="left">board_id</td><td align="left">Board identifier</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">board_id_inverse</td><td align="left">~board_id&#8212;used to tell if a board is present</td></tr><tr><td align="center">4</td><td align="center">uint8_t</td><td align="left">update_period</td><td align="left">Minimum time (in 100Hz ticks) between FETCH commands</td></tr><tr><td align="center">5</td><td align="center">uint8_t</td><td align="left">channels</td><td align="left">Number of data channels to retrieve in FETCH command</td></tr><tr><td align="center">6</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><p>
+      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp47895456"></a>3.2. SETUP reply message</h3></div></div></div><div class="table"><a name="idp47896128"></a><p class="title"><b>Table 3. SETUP reply contents</b></p><div class="table-contents"><table summary="SETUP reply contents" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint16_t</td><td align="left">board_id</td><td align="left">Board identifier</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">board_id_inverse</td><td align="left">~board_id&#8212;used to tell if a board is present</td></tr><tr><td align="center">4</td><td align="center">uint8_t</td><td align="left">update_period</td><td align="left">Minimum time (in 100Hz ticks) between FETCH commands</td></tr><tr><td align="center">5</td><td align="center">uint8_t</td><td align="left">channels</td><td align="left">Number of data channels to retrieve in FETCH command</td></tr><tr><td align="center">6</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><p>
        The SETUP reply contains enough information to uniquely
        identify the companion board to the end user as well as for
        the flight computer to know how many data values to expect in
        bit-wise inverse of board_id. Current companion boards use
        USB product ID as the board_id, but the flight computer does
        not interpret this data and so it can be any value.
-      </p></div><div class="section" title="3.3. FETCH reply message"><div class="titlepage"><div><div><h3 class="title"><a name="idp195992"></a>3.3. FETCH reply message</h3></div></div></div><div class="table"><a name="idp196336"></a><p class="title"><b>Table 4. FETCH reply contents</b></p><div class="table-contents"><table summary="FETCH reply contents" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint16_t</td><td align="left">data0</td><td align="left">0th data item</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">data1</td><td align="left">1st data item</td></tr><tr><td align="center">...</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><p>
+      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp47916992"></a>3.3. FETCH reply message</h3></div></div></div><div class="table"><a name="idp47917664"></a><p class="title"><b>Table 4. FETCH reply contents</b></p><div class="table-contents"><table summary="FETCH reply contents" border="1"><colgroup><col align="center" class="Offset"><col align="center" class="Data Type"><col align="left" class="Name"><col align="left" class="Description"></colgroup><thead><tr><th align="center">Offset</th><th align="center">Data Type</th><th align="center">Name</th><th align="center">Description</th></tr></thead><tbody><tr><td align="center">0</td><td align="center">uint16_t</td><td align="left">data0</td><td align="left">0th data item</td></tr><tr><td align="center">2</td><td align="center">uint16_t</td><td align="left">data1</td><td align="left">1st data item</td></tr><tr><td align="center">...</td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break"><p>
        The FETCH reply contains arbitrary data to be reported over
        the flight computer telemetry link. The number of 16-bit data items
        must match the 'channels' value provided in the SETUP reply
        message.
-      </p></div></div><div class="section" title="4. History and Motivation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp47944"></a>4. History and Motivation</h2></div></div></div><p>
+      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp54642256"></a>4. History and Motivation</h2></div></div></div><p>
       To allow cross-programming, the original TeleMetrum and
       TeleDongle designs needed to include some kind of
       connector. With that in place, adding the ability to connect