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

Ian Buckley ianb at ionconcepts.com
Mon Dec 1 12:00:13 EST 2014


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

-Ian

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(
>       device_addr="addr=192.168.10.2",
>       io_type=uhd.io_type_t.COMPLEX_FLOAT32,
>       num_channels=1,
>     )
>     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*
>         read_gpio_value=cmd_handle.read_gpio(uhd.dboard_iface.UNIT_TX)
>         cmd_handle.set_pin_ctrl(uhd.dboard_iface.UNIT_TX, 0xACFF , 0xFFFF)   *3*     
>         print read_gpio_value
>         toggle = ~toggle
>         time.sleep(1)
> 
> *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 :)
> 
> -Anum 
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

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


More information about the USRP-users mailing list