comm.SDRRxPluto
Receive data from Analog Devices ADALM-PLUTO radio
Add-On Required: This feature requires the Communications Toolbox Support Package for Analog Devices ADALM-Pluto Radio add-on.
Description
The comm.SDRRxPluto
System object™ is a signal source that receives data from an Analog Devices® ADALM-PLUTO radio. This connection
enables you to simulate and develop various software-defined radio applications.
The following diagram shows the interaction between MATLAB®, the comm.SDRRxPluto
System object, and the radio hardware.
After connecting a PlutoSDR device to a USB port on the host computer, to receive data from the radio hardware:
Create the
comm.SDRRxPluto
object and set its properties.Call the object as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
Channel Output
The ADALM-PLUTO radio has a single channel for receiving data and sending it to
the comm.SDRRxPluto
System object. The SDR System object outputs a column vector signal of fixed length.
The first call to the comm.SDRRxPluto
System object might contain transient values, which can result in packets containing
undefined data.
Creation
Description
creates a
PlutoSDR receiver System object with default properties that you can use to receive data from the
PlutoSDR device. rxPluto
= sdrrx('Pluto')
creates a PlutoSDR receiver object with the specified property
rxPluto
= sdrrx('Pluto',Name,Value
)Name
set to the specified Value
. You
can specify additional name-value pair arguments in any order as
(Name1,Value1,...,NameN,ValueN)
. Unspecified properties
take default values.
Example: rx =
sdrrx('Pluto','CenterFrequency',3.5e9,'BasebandSampleRate',2.0e6);
Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release
function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
RadioID
— Radio identification number
'usb:0'
(default) | character vector
Radio identification number, specified as one of the following character vectors:
(recommended) A device-independent index, with the prefix
usb:
, such as'usb:0'
,'usb:1'
,'usb:2'
, …, indicating the first, second, third, ..., attached ADALM-PLUTO radio, respectivelyAn IP address, with the prefix
ip:
, such as'ip:192.168.2.1'
A serial number, represented by a hexadecimal string with the prefix
sn:
, such as'sn:100000235523730700230031090216eaeb'
Note
When working with multiple radios, if devices are inserted or removed, the host computer assignment of USB addresses might change. Any time an SDR device is inserted or removed from a USB port, the host computer polls all USB ports and assigns or reassigns the radio addresses associated with connected devices.
When operating on Windows® keep these considerations in mind.
When running multiple radios on the same host in separate MATLAB sessions, for each MATLAB session the first radio is assigned
usb:0
, and the ID number increments by one for subsequent radios.Radios that are being used by one MATLAB are not seen by other MATLAB sessions. Use
findPlutoRadio
and check the reported serial number to identify the radios seen in a particular MATLAB session.
To ensure that all assigned radio identities remain static, do not connect or disconnect radios after SDR objects have been created. The best practice is to connect radios and create SDR objects in this order:
Clear all SDR objects.
Connect all radios.
Check to confirm that the connected radios are recognized by running this command:
findPlutoRadio
Create SDR objects.
To interface with the radio hardware, the RadioID
property of the
radio object must match the radio ID of the radio hardware. Update the
RadioID
property, if necessary.
When running multiple radios on the same host, the host assigns each radio a different
radio ID. When identifying the radio by USB ID, the first radio is assigned
usb:0
, and the ID number increments by one for subsequent radios. For
example, to assign IDs to two radios connected on the same host computer, at the MATLAB command prompt, enter:
rx = sdrrx('Pluto','RadioID','usb:0'); tx = sdrtx('Pluto','RadioID','usb:1');
CenterFrequency
— RF center frequency setting in Hz
2.4e9
(default) | scalar
RF center frequency setting in Hz, specified as a scalar from
70.0e6
to 6.0e9
.
Note
Analog Devices qualifies the PLUTO radio over a tuning range of 325 MHz to 3.8 GHz. This
support package enables you to use the PLUTO radio outside the qualified tuning range by
configuring the radio to operate using the AD9364 firmware. To extend the frequency range,
at the MATLAB command prompt, enter configurePlutoRadio
('AD9364'
).
Tunable: Yes
Data Types: double
ChannelMapping
— Channel mapping
1
(default)
This property is read-only.
The channel mapping is always set to 1
.
GainSource
— Gain source
'AGC Slow Attack'
(default) | 'AGC Fast Attack'
| 'Manual'
Gain source, specified as one of the following:
'AGC Slow Attack'
— For signals with slowly changing power levels'AGC Fast Attack'
— For signals with rapidly changing power levels'Manual'
— For setting the gain manually with theGain
property
Data Types: char
| string
Gain
— Radio receiver gain
10
(default) | scalar
Radio receiver gain in dB, specified as a scalar from -4
to 71
.
Note
The acceptable minimum and maximum gain setting depends on the center frequency. An incompatible gain and center frequency combination returns an error.
Tunable: Yes
Dependencies
To enable this property, set GainSource
to
'Manual'
.
Data Types: double
BasebandSampleRate
— Baseband sampling rate
1.0e6
(default) | scalar
Baseband sampling rate in Hz, specified as a scalar from 65105
to
61.44e6
samples per second.
Note
The actual computed value and your specified setting can have a small
mismatch. To confirm that the actual computed value is close enough
to your specified setting, call the info
object
function on the radio object.
Data Types: double
OutputDataType
— Output signal data type
'int16'
(default) | 'single'
| 'double'
Output signal data type, specified as one of the following:
int16
— 16-bit signed integersdouble
— Double-precision floating pointsingle
— Single-precision floating point
SamplesPerFrame
— Number of samples per frame
20,000
(default) | positive integer
Number of samples per frame, specified as an even positive integer from 2 to 16,777,216. Using values less than 3660 can yield poor performance.
Data Types: double
EnableBurstMode
— Option for burst mode
false
(default) | true
Option for burst mode, specified as false
or true
.
When set to true
, this property produces a set of contiguous samples without
overflow. This setting can help simulate models that cannot run in real time. When you enable
burst mode, specify the amount of contiguous data using the property. For more information on
how to use this property, see Burst Mode.
Data Types: logical
NumFramesInBurst
— Number of frames in a contiguous burst
1
(default) | strictly positive integer
Number of frames in a contiguous burst, specified as a strictly positive integer.
Dependencies
To enable this property, set EnableBurstMode
to
true
.
Data Types: double
ShowAdvancedProperties
— Option to show advanced properties
false
(default) | true
Option to show advanced properties, specified as false
or true
.
Data Types: logical
UseCustomFilter
— Use custom filter
false
(default) | true
Use custom filter, specified as one of these values.
false
— The filter chain uses the default filter design.true
— The filter chain uses a custom filter design. To design a custom filter, call thedesignCustomFilter
function.
Note
When applying a custom filter to a comm.SDRRxPluto
System object, the UseCustomFilter
property is automatically set to
true
. To switch between the default and your custom filter, set
UseCustomFilter
property to false
or
true
, respectively.
For more information, see Baseband Sampling Rate and Filter Chains.
Data Types: logical
EnableQuadratureCorrection
— Quadrature correction
true
(default) | false
Quadrature correction, specified as true
or
false
. When this property is true
, the
object applies in-phase and quadrature (IQ) imbalance compensation. For more
information, see Quadrature Tracking.
Dependencies
To view this property, set ShowAdvancedProperties
to
true
.
EnableRFDCCorrection
— RF DC correction
true
(default) | false
RF direct current (DC) correction, specified as true
or
false
. When the property is true
, the
object applies an RF DC blocking filter. For more information, see DC Offset Tracking.
Dependencies
To view this property, set ShowAdvancedProperties
to
true
.
EnableBasebandDCCorrection
— Baseband DC correction
true
(default) | false
Baseband DC correction, specified as true
or
false
. When the property is true
, the
object applies a baseband DC blocking filter. For more information, see DC Offset Tracking.
Dependencies
To view this property, set ShowAdvancedProperties
to
true
.
FrequencyCorrection
— Frequency correction value in ppm
0
(default) | scalar
Frequency correction value in ppm, specified as a scalar from -200
to
200
. This property value corrects frequency shifts in data due to
local oscillator frequency offset or clock rate inaccuracy.
Note
When the
FrequencyCorrection
setting is0
, the factory-calibrated setting of the radio will be used.The
FrequencyCorrection
property changes the actual radio setting forBasebandSampleRate
andCenterFrequency
.
Tunable: Yes
Dependencies
To view this property, set ShowAdvancedProperties
to
true
.
Data Types: double
BISTLoopbackMode
— Built-in self-test (BIST) loopback mode
'Disabled'
(default) | 'Digital Tx -> Digital Rx'
| 'RF Rx -> RF Tx'
Built-in self-test loopback mode, specified as one of these options:
'Disabled'
— Disable BIST loopback.'Digital Tx -> Digital Rx'
— Enable digital signals to loop back within the AD936x device. The signals bypass the RF stage.'RF Rx -> RF Tx'
— Enable incoming receiver RF signals to loop back to the RF transmitter port. The signals bypass the FPGA.
Dependencies
To enable this property, set ShowAdvancedProperties
to
true
.
Data Types: char
| string
BISTToneInject
— BIST signal injection mode
'Disabled'
(default) | 'Tone Inject Tx'
| 'Tone Inject Rx'
BIST signal injection mode, specified as one of these options:
'Disabled'
— Disable BIST signal injection.'Tone Inject Tx'
— Enable BIST signal injection to transmit path.'Tone Inject Rx'
— Enable BIST signal injection to receive path.
When you enable BIST signal
injection, you can set the source of BIST signal
generation with the
BISTSignalGen
property.
Dependencies
To enable this property, set
ShowAdvancedProperties
to
true
.
Data Types: char
| string
BISTSignalGen
— Source of BIST signal generation
'PRBS'
(default) | 'Tone'
Source of BIST signal generation, specified as one of these options:
'PRBS'
— Use the pseudo random binary sequence (PRBS) generator of the board.'Tone'
— Use the tone generator of the board. To set the tone frequency and tone level, use theBISTToneFreq
andBISTToneLevel
properties, respectively.
Dependencies
To enable this property, set BISTToneInject
to 'Tone Inject Tx'
or 'Tone Inject Rx'
.
Data Types: char
| string
BISTToneFreq
— BIST tone frequency
'Fs/32'
(default) | 'Fs/16'
| 'Fs*3/32'
| 'Fs/8'
BIST tone frequency, specified as 'Fs/32'
,
'Fs/16'
, 'Fs*3/32'
, or
'Fs/8'
.
Dependencies
To enable this property, set BISTSignalGen
to 'Tone'
.
Data Types: char
| string
BISTToneLevel
— BIST tone level
'0'
(default) | '-6'
| '-12'
| '-18'
BIST tone level in dB, specified as '0'
, '-6'
,
'-12'
, or
'-18'
.
Dependencies
To enable this property, set BISTSignalGen
to 'Tone'
.
Data Types: char
| string
Usage
Description
Output Arguments
rxdata
— Received data
vector of complex values
Received data, returned as a vector of complex values. The value range depends on the data type of the output.
int16
— Output data consists of 16-bit signed integer values in the range [–2048, 2047]. The AD936X RF chip has a 12-bit ADC. The 12-bit data from the ADC is stored in the lower 12 bits of the output value and sign-extended to 16 bits.double
— Output data consists of double-precision floating point values scaled to the range of [–1, 1].single
— Output data consists of single-precision floating point values scaled to the range of [–1, 1].
Note
The AD936X RF chip has a 12-bit ADC. Double-precision and single-precision floating
point representations of received data values are directly created from the
sign-extended int16
value received from the board. These
representations occupy only the range [–1, 1].
To specify the data type of the received data, use the
OutputDataType
property.
Data Types: int16
| single
| double
Complex Number Support: Yes
datavalid
— Data valid indicator
logical
Data valid indicator, returned as a logical.
A
0
indicates that received sample is not valid.A
1
indicates that received sample is valid.
overflow
— Lost samples indicator
logical
Lost samples indicator, returned as a logical.
A
0
indicates that no samples were lost.A
1
indicates that samples were lost.
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Specific to comm.SDRRxPluto
capture | Capture RF signal data using SDR device |
info | Obtain radio information |
designCustomFilter | Design custom filter for Analog Devices AD936x RF chip |
Examples
Create Receiver System Object and Receive Data on Single Channel
Configure an ADALM-PLUTO radio with the RadioID
property set to 0. Set the radio to receive at 2.5 GHz with a baseband rate of 1 MHz. Save the data using a log.
Create a ADALM-PLUTO radio receiver System object to use for data reception and dsp.SignalSink
System objects to log the received data when the data does not overflow and when the data is valid.
rxPluto = sdrrx('Pluto',... 'RadioID','usb:0',... 'CenterFrequency',2.5e9,... 'BasebandSampleRate',1e6); rxLogNoOverflow = dsp.SignalSink; rxLogDataValid = dsp.SignalSink;
Inside a for
loop, receive data using the rxPluto
object. Log the data when there is no overflow and when the data is valid. Display messages when received samples are dropped or when the received data is not valid.
for counter = 1:20 [data,datavalid,overflow] = rxPluto(); % Check for overflow of received samples. if (overflow) % dropped samples disp('samples dropped'); else rxLogNoOverflow(data); end % Check for overflow and validity of received data. if ~(overflow) % no dropped samples if ~(datavalid) % received desired data rxLogDataValid(data); end else disp('no valid data received'); end end
## Establishing connection to hardware. This process can take several seconds.
Using Frequency Correction with One ADALM-PLUTO Radio
When transmitting and receiving using one ADALM-PLUTO radio, individual transmitter and receiver objects use the same underlying radio hardware setting for frequency correction. Create separate ADALM-PLUTO radio System objects with default settings for the transmitter and receiver.
rx = sdrrx('Pluto'); tx = sdrtx('Pluto'); rx.ShowAdvancedProperties = true; tx.ShowAdvancedProperties = true; rxFreqCorr = rx.FrequencyCorrection
rxFreqCorr = 0
txFreqCorr = tx.FrequencyCorrection
txFreqCorr = 0
The default frequency correction value is 0 ppm. Here the underlying radio hardware setting for frequency correction when receiving and transmitting is 0.
data0 = rx();
## Establishing connection to hardware. This process can take several seconds.
tx(data0);
## Establishing connection to hardware. This process can take several seconds.
Update the frequency correction setting to 50 ppm for the receiver object. This does not update the frequency correction setting for the transmitter object, but here the master clock rate of the underlying radio hardware is adjusted based on the setting of 50 ppm for the frequency correction when receiving or transmitting. The last update of the radio hardware frequency correction setting is made by the receiver object. Even though the transmitter object indicates a frequency correction value of 0, the radio transmitter uses the updated value set with rx.FrequencyCorrection
when the transmitter object is executed.
rx.FrequencyCorrection = 50; data1 = rx(); tx(data0); rxFreqCorr = rx.FrequencyCorrection
rxFreqCorr = 50
txFreqCorr = tx.FrequencyCorrection
txFreqCorr = 0
Similarly, update the frequency correction setting to 100 ppm for the transmitter object. This does not update the frequency correction setting for the receiver object, but here master clock rate of the underlying radio hardware is adjusted based on the setting of 100 pmm for the frequency correction when receiving or transmitting. The last update of the radio hardware frequency correction setting is made by the transmitter object. Even though the receiver object indicates a frequency correction value of 50, radio receiver uses the updated value set with tx.FrequencyCorrection
when the receiver object is executed.
tx.FrequencyCorrection = 100; tx(data0); data2 = rx(); rxFreqCorr = rx.FrequencyCorrection
rxFreqCorr = 50
txFreqCorr = tx.FrequencyCorrection
txFreqCorr = 100
Get ADALM-PLUTO Radio Information
Use the info
object function to get information from the connected ADALM-PLUTO radio. The actual values used in the radio are shown by info
and can be vary slightly from the values specified in the object.
rx = sdrrx('Pluto');
info(rx)
## Establishing connection to hardware. This process can take several seconds.
ans = struct with fields:
Status: 'Full information'
CenterFrequency: 2.4000e+09
BasebandSampleRate: 999999
SerialNum: '104473222a870010050020009db5d52277'
GainControlMode: 'AGC Slow Attack'
RadioFirmwareVersion: "0.30"
ExpectedFirmwareVersion: "0.30"
HardwareVersion: "B0"
Capture RF Data to Baseband File Using ADALM-PLUTO Radio
Use the capture
function and an ADALM-PLUTO radio to record RF signals for post-capture processing in MATLAB®. Save an FM broadcast signal to a file as baseband samples. Read the file containing the recorded signal and demodulate the baseband samples.
Configure SDR Hardware
To configure your ADALM-PLUTO radio for host-radio communication, see Guided Host-Radio Hardware Setup.
Attach an antenna suitable for the 88-108 MHz band to the first RX channel. The FM radio band is outside the default tuning range for the ADALM-PLUTO radio. The configurePlutoRadio
function enables you to extend the frequency range and use your ADALM-PLUTO radio outside the qualified tuning range. The extended frequency range includes the full FM radio band.
configurePlutoRadio('AD9364');
## Establishing connection to hardware. This process can take several seconds.
Configure Receiver System Object
Create an SDR receiver System object with the specified properties. The specified center frequency corresponds to a local FM station.
deviceName = 'Pluto'; samplerate = 528e3; fmStationFrequency = 88.9e6; % Adjust to select an FM station nearby rx = sdrrx(deviceName,'BasebandSampleRate',samplerate, ... 'CenterFrequency',fmStationFrequency,'OutputDataType','double');
Initiate Data Capture to File
Call the capture
function, specifying the receiver object, capture duration, and file name. After capturing the FM signal, unlock the receiver object using the release
function.
capture(rx,5,'Seconds','Filename','FMRecording.bb');
## Establishing connection to hardware. This process can take several seconds.
release(rx);
Demodulate FM Recording
Create a comm.BasebandFileReader
System object to read the captured signal and extract frames of data from the file. Set baseband file reader to take 4400 samples per frame when reading the saved baseband signal.
bbr = comm.BasebandFileReader('FMRecording.bb');
bbr.SamplesPerFrame = 4400;
Use the BasebandSampleRate
field of the baseband file reader object to set the SampleRate
property of the demodulator. Find the BasebandSampleRate
field in the MetaData
structure. Create a comm.FMBroadcastDemodulator
System object. Demodulate and play back each frame of the FM data. Use a while
loop to read all frames of the captured data.
fmbDemod = comm.FMBroadcastDemodulator('AudioSampleRate',48e3, ... 'SampleRate',bbr.Metadata.BasebandSampleRate,'PlaySound',true); while ~isDone(bbr) fmbDemod(bbr()); end
Version History
Introduced in R2017a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)