Discussion and technical support related to USRP, UHD, RFNoC
View all threadsHi,
I have one issue in accessing the GPIO pin in B205mini-i board.
what is the mask value in the API uhd_usrp_set_gpio_attr() function?
I have written code to access the pin 1 and 2. For that I have given
the mask value as 0x01 and 0x02. I am able to control the GPIO pin 1
with mask value 0x01. But, I am unable to access the GPIO pin 2 with
mask value 0x02.
What may be the issue?
The following is the code I have written.
const char* bank = "FP0";
size_t mboard = 0;
uhd_usrp_set_gpio_attr(usrp, bank, "CTRL", 0, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "CTRL", 0, 0x02, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x02, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "OUT", 0, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "OUT", 0, 0x02, mboard);
Thanks,
Kavinraj.
The mask affects the bits that you actually write to the attribute. In this
case:
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x02, mboard);
...you're setting the DDR register to 0x01 and the mask to 0x02. 0x01 &
0x02 == 0, so you're not setting anything.
This works:
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 0x02, 0x02, mboard);
...but this also saves you a call:
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 0x03, 0x03, mboard);
--M
On Mon, Jan 27, 2025 at 5:05 AM kavinraj@atindriya.co.in wrote:
Hi,
I have one issue in accessing the GPIO pin in B205mini-i board.
what is the mask value in the API uhd_usrp_set_gpio_attr() function?
I have written code to access the pin 1 and 2. For that I have given
the mask value as 0x01 and 0x02. I am able to control the GPIO pin 1
with mask value 0x01. But, I am unable to access the GPIO pin 2 with
mask value 0x02.
What may be the issue?
The following is the code I have written.
const char* bank = "FP0";
size_t mboard = 0;
uhd_usrp_set_gpio_attr(usrp, bank, "CTRL", 0, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "CTRL", 0, 0x02, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "DDR", 1, 0x02, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "OUT", 0, 0x01, mboard);
uhd_usrp_set_gpio_attr(usrp, bank, "OUT", 0, 0x02, mboard);
Thanks,
Kavinraj.
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com