[USRP-users] FW: how to select a specific GPIO pin (to toggle) in dboard unit_TX ?
anumsheraz1 at hotmail.com
Mon Dec 1 05:44:01 EST 2014
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
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*
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 :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the USRP-users