[USRP-users] how to select a specific GPIO pin (to toggle) in dboard unit_TX ?
ianb at ionconcepts.com
Mon Dec 1 12:00:13 EST 2014
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.
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...
More information about the USRP-users