主要内容

getGPIOAttribute

R2026b

Query GPIO and ATR attributes

Since R2026b

Description

value = getGPIOAttribute(radio,bank,source,attribute) returns the current value of a specified GPIO or ATR attribute for the GPIO signals in the GPIO bank bank that are controlled by the radio source source on the radio associated with the radio object radio.

Use this function to query how GPIO signals are configured for GPIO or ATR operation, including signal direction, control mode, and the output states associated with idle, receive, transmit, and full‑duplex radio states. To configure a different attribute, use the setGPIOAttribute function.

example

Examples

collapse all

Query GPIO control and direction attributes for GPIO signals driven by a radio source.

Create a radio object and select a GPIO bank and radio source.

radio = radioConfigurations("MyRadio");
banks = getGPIOBanks(radio);
gpioBank = banks(1);
sources = getAvailableGPIOSources(radio,gpioBank);
radioSource = sources(4);

Query the control mode and signal direction attributes. For USRP X410 radios, use "GPIO" as the bank identifier for attribute functions. For details, see the bank input argument.

if strcmp(radio.Hardware,"USRP X410")
    attrBank = "GPIO";
else
    attrBank = gpioBank;
end

ctrlValue = getGPIOAttribute(radio,attrBank,radioSource,"CTRL")
ctrlValue = uint32

0
ddrValue = getGPIOAttribute(radio,attrBank,radioSource,"DDR")
ddrValue = uint32

4294967295

Input Arguments

collapse all

Radio object, specified as a radio object that corresponds to a radio setup configuration you saved using the Radio Setup wizard.

To create a radio object, call the radioConfigurations function with the name of your radio setup configuration. For example, for a radio setup configuration named MyRadio, call radio = radioConfigurations("MyRadio").

GPIO bank identifier, specified as a string scalar that identifies a GPIO bank on the radio.

To query the available GPIO bank identifiers on the radio, use the getGPIOBanks function.

Note

If you have a USRP™ X410 radio, use "GPIO" as the bank identifier.

  • Bits 1–12 of the attribute value value correspond to the "GPIO0" bank.

  • Bits 13–24 of the attribute value value correspond to the "GPIO1" bank.

Data Types: string

GPIO source identifier, specified as a string scalar that identifies which radio source controls the GPIO signals. The source identifies the FPGA radio block that owns the GPIO registers. You must specify a source for both ATR operation and manual GPIO control.

Valid values depend on the radio and the selected bank. To query the available GPIO sources for a bank, use the getAvailableGPIOSources function

Data Types: string

GPIO or ATR attribute to query, specified as a string scalar.

Attribute ValueDescription
"CTRL"

Control mode for each GPIO signal.

  • A value of 1 enables ATR control.

  • A value of 0 enables manual GPIO control.

"DDR"

Signal direction.

  • A value of 1 configures the signal as an output.

  • A value of 0 configures the signal as an input.

"OUT" GPIO output state when the signal is configured for manual GPIO control and as an output.
"ATR_0X" GPIO output state when the radio is idle.
"ATR_RX" GPIO output state when the radio is receiving.
"ATR_TX" GPIO output state when the radio is transmitting.
"ATR_XX" GPIO output state when the radio is transmitting and receiving, which is referred to as full‑duplex operation.
"READBACK" Current GPIO signal state as read from the hardware. This attribute is read‑only.

Data Types: string

Output Arguments

collapse all

GPIO or ATR attribute register value for the specified bank, source, and attribute, returned as an unsigned 32‑bit integer. Each bit corresponds to one GPIO signal in the bank.

Individual bits in the GPIO or ATR attribute register value correspond to one GPIO signal in the specified bank.

  • The least significant bits map to the lowest‑numbered GPIO signals. For example, bit 1 corresponds to GPIO signal Data[0], bit 2 corresponds to Data[1], and so on.

  • On a USRP X410 radio, the value corresponds to both GPIO banks. Bits 1–12 correspond to the "GPIO0" bank, and bits 13–24 correspond to the "GPIO1" bank.

GPIO signal indices do not correspond directly to physical pin numbers on the connector. For details about the mapping between GPIO signals and connector pins, see GPIO Connectors and Pin Mapping.

Data Types: uint32

Version History

Introduced in R2026b