主要内容

setGPIOSource

R2026b

Assign radio source that controls each GPIO signal

Since R2026b

Description

setGPIOSource(radio,bank,source) assigns the radio source source that controls each GPIO signal in the GPIO bank bank on the radio associated with the radio object radio. Each element of source maps one GPIO signal in bank to a radio source that can drive that signal.

Use this function to configure which radio paths drive individual GPIO signals before you enable automatic transmit/receive (ATR) behavior or manual GPIO control. To configure signal direction or ATR behavior, use the setGPIOAttribute function.

The behavior of GPIO source and attribute settings can vary between radio models depending on the hardware implementation. For details on source-to-pin routing for your device, consult the manufacturer documentation.

Note

The following actions reset the GPIO configuration:

  • Loading an application onto the radio. This occurs when you specify the Preload name-value argument as true during object creation, or the first time you call the transmit or capture function on an object created without Preload=true.

  • Calling the setup function on a usrp System object™.

  • Changing properties that select radio antennas, such as Antennas, TransmitAntennas, ReceiveAntennas, DUTInputAntennas, or DUTOutputAntennas.

  • Changing the SampleRate property to a value derived from a different master clock rate. For more information on how the baseband sample rate is derived, see Baseband Sample Rate in NI USRP Radios.

To preserve the GPIO configuration, perform these actions before you configure GPIO pins.

example

Examples

collapse all

Update the GPIO source mapping for a bank by changing the source for one signal.

Select a GPIO bank and a radio source.

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

Get the current source mapping, update the fourth GPIO signal to use the selected radio source, and apply the updated mapping.

gpioSource = getGPIOSource(radio,gpioBank);
gpioSource(4) = radioSource;
setGPIOSource(radio,gpioBank,gpioSource);

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.

Data Types: string

Configured GPIO source mapping for the specified bank, specified as a string column vector. Each element in the vector corresponds to one GPIO signal in the bank, in signal order.

Each value specifies which radio source controls the corresponding GPIO signal. Valid values depend on the radio and the selected bank. To query the available GPIO sources for a bank, use the getAvailableGPIOSources function.

The number of elements in source must match the number of GPIO signals in the specified bank.

Data Types: string

Version History

Introduced in R2026b