# Toggling LFRX gpio pins

**URL:** <https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924>\
**Category:** GNU Radio\
**Created:** [July 24, 2013, 5:00pm UTC](https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924 "2013-07-24T17:00:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 24, 2013, 5:00pm UTC](https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924/1 "2013-07-24T17:00:12Z")

</div>

Hi guys again,

I have designed small RF frontend using TI’s cc1000 transciever. Since  
the  
transciever need to be configured using external pins, I need to be able  
to  
toggle gpio pins on my LFRX. I have found that I should use dboard\_iface  
which is available in python via swig. However I have several questions:  
How should I address my board, since there are 4 possible slots, and  
onlt 2  
values of type unit, UNIT\_RX and UNIT\_TX.  
As far as i can see, every uhd source has method get\_iface, does this  
anyhow concerns me?

Thanks again,  
Nemanja

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [July 24, 2013, 6:47pm UTC](https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924/2 "2013-07-24T18:47:11Z")

</div>

After some time I maybe realized how this thing works, but I don’t know  
jow  
to call correctly methods from dboard\_iface:

def get\_pin\_ctrl(self, \*args, \*\*kwargs):  
“”“get\_pin\_ctrl(self, unit\_t unit) -\> boost::uint16\_t”""  
return \_uhd\_swig.dboard\_iface\_get\_pin\_ctrl(self, \*args,  
\*\*kwargs)

ef get\_gpio\_ddr(self, \*args, \*\*kwargs):  
“”“get\_gpio\_ddr(self, unit\_t unit) -\> boost::uint16\_t”""  
return \_uhd\_swig.dboard\_iface\_get\_gpio\_ddr(self, \*args,  
\*\*kwargs)

or any of these methods that have \*arg and \*\*kwargs. When I call like  
this:  
iface = usrp1\_src.get\_dboard\_iface()  
print iface.get\_pin\_ctrl(uhd.dboard\_iface.UNIT\_RX, 0)

I get following error:

Traceback (most recent call last):  
File “lftx\_io.py”, line 31, in   
print iface.get\_pin\_ctrl(uhd.dboard\_iface.UNIT\_RX, 0)  
File  
“/usr/local/lib64/python2.6/site-packages/gnuradio/uhd/uhd\_swig.py”,  
line 1691, in get\_pin\_ctrl  
return \_uhd\_swig.dboard\_iface\_sptr\_get\_pin\_ctrl(self, \*args,  
\*\*kwargs)  
TypeError: dboard\_iface\_sptr\_get\_pin\_ctrl() takes at most 2 arguments (3  
given)

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [July 25, 2013, 9:45am UTC](https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924/3 "2013-07-25T09:45:48Z")

</div>

On 07/24/2013 12:46 PM, Nemanja S. wrote:

> line 1691, in get\_pin\_ctrl  
> return \_uhd\_swig.dboard\_iface\_sptr\_get\_pin\_ctrl(self, \*args, \*\*kwargs)  
> TypeError: dboard\_iface\_sptr\_get\_pin\_ctrl() takes at most 2 arguments (3  
> given)

You have the right idea, but that particular function only takes one  
argument. So thats the error.

Take a look at include/uhd/usrp/dboard\_iface.hpp for documentation. The  
python interface may be a little different syntax wise, but the function  
names are all the same.

-josh

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [July 25, 2013, 10:16am UTC](https://www.ruby-forum.com/t/toggling-lfrx-gpio-pins/235924/4 "2013-07-25T10:16:11Z")

</div>

Hi,

thank you Josh. Yesterday late I figured out almost everything. I  
suppose  
everything would be faster with a little bit more documentation.  
So, I have USRP1 with wbx, lftx and lfrx.  
There is one doubt now. When I set USRP source to wbx and after that  
read  
register for setting direction of the pins i get some value (49116). The  
binary representation is not the same as i expect from WBX schematic. In  
schematgic is written that for example io\_rx[5] for selecting rx1 or rx2  
is  
output pin, but I get 0 when I read. Also io\_rx[15] and io\_rx[14] are  
unused, but still one is set as output and other as input. Also when I  
change antenna selection and read the same value again i read the same  
number.

thanks,  
Nemanja
