[USRP-users] how to select a specific GPIO pin (to toggle) in dboard unit_TX ?

Anum Sheraz anumsheraz1 at hotmail.com
Thu Dec 4 03:31:34 EST 2014

Thanks ian for your quick response, 

Yes I've gone through that theory. Actually I have tested my gnu Tx-Rx application with this USRP n210 (daughter board: WBX). the io_tx_14 and io_tx_15 and all other pins which are NOT spare (io_tx_0-5 aswell). they are automatically set on ATR mode. I've tested this as follows;
cmd_handle.set_pin_ctrl(uhd.dboard_iface.UNIT_TX, 0xFDFF, 0xFFFF)

this hex value 0xFDFF defines the pin "io_tx_9". now i am toggling this pin along with my gnu 
application running. I have tested in oscilloscope that io_tx_15 is automatically toggling in 
TX_RX mode and io_tx_9 is individually being toggled as defined by my custom code. 

Now i am sticked in another issue. I am sending a high signal in io_tx_9 and connected this 
line on io_tx-8 (means, i want to read this signal on io_tx_8). but there are no such argument 
(value & mask) with read_gpio command like "0xFDFF, 0xFFFF". when i write cmd_handle.read_gpio(uhd.dboard_iface.UNIT_TX),
it reads all the pins on TX line. even the one which i am toggling "io_tx_9"

I want to read on a specific pin. How can i do that ?

any help will be highly appreciated. Thankyou :)

Subject: Re: [USRP-users] how to select a specific GPIO pin (to toggle) in dboard unit_TX ?
From: ianb at ionconcepts.com
Date: Mon, 1 Dec 2014 09:00:13 -0800
CC: usrp-users at lists.ettus.com
To: anumsheraz1 at hotmail.com

Anum, Glancing at this I think what you are missing is understanding of the ATR_CONTROL register.You should also be making more careful use of MASKs…these are important so that you do not disturb the functioning of GPIO pins claimed already by UHD and the H/W.
Try reading this documentation (Written for X300 but applicable here also) and comeback to the list if you still need help.http://files.ettus.com/manual/page_gpio_api.html
On Dec 1, 2014, at 2:37 AM, Anum Sheraz via USRP-users <usrp-users at lists.ettus.com> wrote:Hello i am trying to toggle the GPIO pins on my USRP n210 RFX2400. 

from gnuradio import uhd

if __name__ == '__main__':
    device = uhd.usrp_sink(
    cmd_handle = device.get_dboard_iface()
    cmd_handle.set_gpio_ddr(uhd.dboard_iface.UNIT_TX, 0xFFFF, 0xFFFF)   *1*
    toggle = False
    while True:
        cmd_handle.set_gpio_out(uhd.dboard_iface.UNIT_TX, (0xFFFF if toggle else 0x0000), 0xFFFF) *2*
        cmd_handle.set_pin_ctrl(uhd.dboard_iface.UNIT_TX, 0xACFF , 0xFFFF)   *3*     
        print read_gpio_value
        toggle = ~toggle
*1* This line indicates the direction. value set as 0xFFFF=high => output (gives me read_gpio value=65535)

*2* in this line, i am Manually setting the value of a pin by using Attr="out" for the init TX. Now my question is;

This toggles the whole TX unit lines on the dboard. But i want to toggle only one GPIO line. How can i do that ? 
I also tried to use the command "set_pin_ctrl" and wrote it as  *3* 
0xACFF gives me a binary value of 0000 0000 1010 1100 1111 1111. from which i examined, that 
the central bits "1010 1100" invert=> "0101 0011" are actually Now toggling the GPIO pins. 

and also now the read_gpio_values is also reduced from 65535 to 21248. This shouldn't happen 
because i haven't changed the value of set_gpio_out command. 

Any help will be highly appreciated.
Thankyou in Advance :)

USRP-users mailing list
USRP-users at lists.ettus.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20141204/d588b37c/attachment-0002.html>

More information about the USRP-users mailing list