Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > eb4b034508697cc17e7c9cfffe7f772b > files > 831

uhd-doc-3.7.2-3.mga5.noarch.rpm

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
<title>UHD - X3x0 GPIO API</title>
<style type="text/css">

body{
font-family:Arial, Helvetica, sans-serif;
font-size:11pt;
color:black;
background-color:white;
width:90%;
margin:0 auto 0 auto;
}

div.document div.contents{
border:1px solid #333333;
padding:10px 30px 10px 10px;
margin-left:50px;
color:inherit;
background-color:#FCFCFC;
display:inline-block;
}

div.document p.topic-title{
font-weight:bold;
}

div.document a:link, div.document a:visited{
color:#236B8E;
background-color:inherit;
text-decoration:none;
}

div.document a:hover{
color:#4985D6;
background-color:inherit;
text-decoration:none;
}

div.document h1.title{
font-size:150%;
border-left:1px solid #333333;
border-bottom:1px solid #333333;
text-align:left;
padding:10px 0px 10px 10px;
margin:10px 5px 20px 5px;
color:#333333;
background-color:inherit;
}

div.document h2.subtitle, div.section h1{
margin-top:50px;
border-bottom:1px solid #333333;
font-size:140%;
text-align:center;
padding:20px 0px 10px 0px;
color:#333333;
background-color:inherit;
}

div.section h2{
font-size:110%;
text-align:left;
padding:15px 0px 5px 0px;
text-decoration:underline;
color:#333333;
background-color:inherit;
}

div.document pre.literal-block{
border:1px inset #333333;
padding:5px;
margin:10px 5px 10px 5px;
color:inherit;
background-color:#FCFCFC;
font-size:90%;
}

div.document table{
padding:5px;
font-size:95%;
}

div.document th{
padding:3px 7px 3px 7px;
border:1px solid #333333;
text-align:center;
color:inherit;
background-color:#ECECEC;
}

div.document tr{
}

div.document td{
padding:3px 7px 3px 7px;
border:1px solid #333333;
text-align:center;
color:inherit;
background-color:#FCFCFC;
}

div.footer{
margin:50px auto 30px auto;
text-align:center;
font-size:85%;
}

</style>
</head>
<body>
<div class="document" id="uhd-x3x0-gpio-api">
<h1 class="title">UHD - X3x0 GPIO API</h1>

<div class="contents topic" id="table-of-contents">
<p class="topic-title first">Table of Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#the-x3x0-front-panel-gpio" id="id1">The X3x0 Front Panel GPIO</a><ul>
<li><a class="reference internal" href="#front-panel-gpio" id="id2">Front Panel GPIO</a><ul>
<li><a class="reference internal" href="#connector" id="id3">Connector</a></li>
<li><a class="reference internal" href="#pin-mapping" id="id4">Pin Mapping</a></li>
</ul>
</li>
<li><a class="reference internal" href="#explaining-atr" id="id5">Explaining ATR</a></li>
<li><a class="reference internal" href="#an-example" id="id6">An Example</a></li>
<li><a class="reference internal" href="#further-information" id="id7">Further Information</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="the-x3x0-front-panel-gpio">
<h1>The X3x0 Front Panel GPIO</h1>
<p>The X3x0 is the first USRP device to offer an auxiliary GPIO connection on the
motherboard itself (independent of the daughterboards). These GPIO pins are
controlled directly by the FPGA, where they are controlled by an ATR (Automatic
Transmit / Receive). This allows them to be toggled simultaneously with other
radio-level changes (e.g., enabling or disabling a TX or RX mixer).</p>
<div class="section" id="front-panel-gpio">
<h2>Front Panel GPIO</h2>
<div class="section" id="connector">
<h3>Connector</h3>
<img alt="./res/x3x0_gpio_conn.png" class="align-left" src="./res/x3x0_gpio_conn.png" />
</div>
<div class="section" id="pin-mapping">
<h3>Pin Mapping</h3>
<ul class="simple">
<li>Pin 1:  +3.3V</li>
<li>Pin 2:  Data[0]</li>
<li>Pin 3:  Data[1]</li>
<li>Pin 4:  Data[2]</li>
<li>Pin 5:  Data[3]</li>
<li>Pin 6:  Data[4]</li>
<li>Pin 7:  Data[5]</li>
<li>Pin 8:  Data[6]</li>
<li>Pin 9:  Data[7]</li>
<li>Pin 10: Data[8]</li>
<li>Pin 11: Data[9]</li>
<li>Pin 12: Data[10]</li>
<li>Pin 13: Data[11]</li>
<li>Pin 14: 0V</li>
<li>Pin 15: 0V</li>
</ul>
</div>
</div>
<div class="section" id="explaining-atr">
<h2>Explaining ATR</h2>
<p>ATR works by defining the value of the GPIO pins for certain states of the
radio. This is the &quot;automatic&quot; part of it. For example, you can tell UHD that
when the radio is transmitting and receiving (full duplex), GPIO6 should be
high, but when it is only transmitting, GPI06 should be low. This state machine
is set up using a series of GPIO attributes, with paired values and a mask,
which you will want to define for the GPIO pins you intend to use. To set up
the ATR, you use the <strong>multi_usrp</strong> function <em>set_gpio_attr</em>.</p>
<ul class="simple">
<li><strong>CTRL</strong>: Is this pin controlled by ATR (automatic), or by manual control
only?</li>
<li><strong>DDR</strong>: &quot;Data Direction Register&quot; - defines whether or not a GPIO is an
output or an input.</li>
<li><strong>OUT</strong>: Manually set the value of a pin (only to be used in non-ATR mode).</li>
<li><strong>ATR_0X</strong>: The status of the pins when the radio is <strong>idle</strong>.</li>
<li><strong>ATR_RX</strong>: The status of the pins when the radio is only <strong>receiving</strong>.</li>
<li><strong>ATR_TX</strong>: The status of the pins when the radio is only <strong>transmitting</strong>.</li>
<li><strong>ATR_XX</strong>: The status of the pins when the radio is in <strong>full-duplex</strong> mode.</li>
</ul>
<p>The counterpart to setting the ATR (the &quot;getter&quot;), is called <em>get_gpio_attr</em>.
It has the exact same attributes as above, and has one more:</p>
<ul class="simple">
<li><strong>READBACK</strong>: Readback the GPIOs marked as inputs.</li>
</ul>
</div>
<div class="section" id="an-example">
<h2>An Example</h2>
<p>The front panel X3x0 GPIO bank is enumerated in the motherboard property tree
(&quot;<em>&lt;mb_path&gt;/gpio/FP0/</em>&quot;), and so is easily accessible through the standard
<strong>multi_usrp</strong> UHD interface.</p>
<p>You can discover this using the <em>get_gpio_banks</em> function in <strong>multi_usrp</strong>.
This will tell you that there is a GPIO bank on your X3x0 called &quot;FP0&quot;. This is
the bank we want to set-up.</p>
<p>Let's say we want to use GPIO6 for an external amp. We want it to be
automatically controlled by ATR as an output, and we want it to be high when we
are transmitting, and low in all other cases. We are also using GPIO4, which
we want to control manually, as an output. We can set this up with the following
code:</p>
<pre class="literal-block">
// set up our masks, defining the pin numbers
#define AMP_GPIO_MASK   (1 &lt;&lt; 6)
#define MAN_GPIO_MASK   (1 &lt;&lt; 4)

#define ATR_MASKS       (AMP_GPIO_MASK | MAN_GPIO_MASK)

// set up our values for ATR control: 1 for ATR, 0 for manual
#define ATR_CONTROL     (AMP_GPIO_MASK &amp; ~MAN_GPIO_MASK)

// set up the GPIO directions: 1 for output, 0 for input
#define GPIO_DDR        (AMP_GPIO_MASK &amp; ~MAN_GPIO_MASK)

// assume an existing USRP device handle, called &quot;usrp_x300&quot;

// now, let's do the basic ATR setup
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;CTRL&quot;, ATR_CONTROL, ATR_MASKS);
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;DDR&quot;, GPIO_DDR, ATR_MASKS);

// let's manually set GPIO4 high
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;OUT&quot;, 1, MAN_GPIO_MASK);

// finally, let's set up GPIO6 as we described above
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;ATR_0X&quot;, 0, AMP_GPIO_MASK);
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;ATR_RX&quot;, 0, AMP_GPIO_MASK);
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;ATR_TX&quot;, 0, AMP_GPIO_MASK);
usrp_x300-&gt;set_gpio_attr(&quot;FP0&quot;, &quot;ATR_XX&quot;, 0, AMP_GPIO_MASK);
</pre>
<p>After the above code is run, the ATR in the FPGA will automatically control
GPIO6, as we have described, based on the radio state, and we have direct
manual control over GPIO4.</p>
</div>
<div class="section" id="further-information">
<h2>Further Information</h2>
<p>For more information, see the Doxygen API documentation:</p>
<ul class="simple">
<li><a class="reference external" href="./../../doxygen/html/classuhd_1_1usrp_1_1multi__usrp.html">multi_usrp API</a></li>
</ul>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2014-10-15 11:47 UTC.

</div>
</body>
</html>