RF Data Recording and Playback for RFSoC Devices
This example shows how to capture real-world radio frequency (RF) data from RFSoC devices, and then use that data in MATLAB® and Simulink® for simulation and analysis.
There are situations where you need to use real-world RF data to develop and verify your application algorithms. This example demonstrates two approaches to bring real-world RF data into Simulink and MATLAB.
Record the data to a file and use it later.
Read live data from hardware in your simulation.
Prepare for RF Data Capture
To capture RF data from an RFSoC device, you must run data capture logic on the hardware. In this example, you use the model from the example Transmit and Receive Tone Using AMD RFSoC Device - Part 1 System Design. The model includes a tone generator that transmits tones through an RFDC DAC channel and loops them back to an RFDC ADC channel.
To open the data capture model, run the command
open_system('soc_rfsoc_datacapture')
.To deploy the design on your RFSoC hardware, follow the instructions in Transmit and Receive Tone Using AMD RFSoC Device - Part 1 System Design.
Reboot the hardware board. After this step, the data capture logic is running on FPGA and is accessible from processor.
Record RF Data
To open the MATLAB script for recording the RF data, run the command
open('soc_rfsoc_datacapture_record')
. For more information about recording live data from the FPGA, see example Record I/O Data from SoC Device. The scriptsoc_rfsoc_datacapture_record.m
calls another scriptRFDC_configuration.m
for RFDC configuration.Change the IP address in both scripts to match your hardware board IP address.
Run the command
soc_rfsoc_datacapture_record
to record RF data. A data filesine_wave_data.tgz
is generated in your current MATLAB folder after you run the script.
To access the recorded data in MATLAB, use socFileReader
.
h = socFileReader('sine_wave_data.tgz'); data = getData(h,'AXI4 stream interface'); plot(data.Time, data.Data);
Play Back Recorded RF Data in Simulink
To open the playback model, run the command
open_system('soc_rfsoc_datacapture_playback')
. This model uses the IO Data Source block to parse the data file.Open the IO Data Source block mask. Click the Browsing button and select the data file
sine_wave_data.tgz
that you generated earlier. This example includes a pregenerated data filesine_wave_data_pregen.tgz
for your convenience.Click the Play button to run the simulation. Observe the tone frequency in the Spectrum Analyzer.
open_system('soc_rfsoc_datacapture_playback')
Simulate with live RF data in Simulink
To open the example model, run the command
open_system('soc_rfsoc_datacapture_live')
. This model uses the AXI4-Stream IIO Read block to read live data from the RFSoC device.Change the IP address of all host AXI IIO Read or Write blocks to match your hardware board IP address.
Click the Play button to run the simulation. Observe the tone frequency in the Spectrum Analyzer.
open_system('soc_rfsoc_datacapture_live')
Simulate with Live RF Data in MATLAB
To open the MATLAB script for capturing the live RF data, run the command
open('soc_rfsoc_datacapture_mlive')
. The scriptsoc_rfsoc_datacapture_mlive.m
calls the scriptsoc_rfsoc_datacapture_mlive_setup.m
for DUT AXI interface definition.Run the command
soc_rfsoc_datacapture_mlive
and observe the tone frequency in the Spectrum Analyzer.
Try Different Sources
Modify the data capture logic by removing the data transmission logic and configuring the RFDC ADC channel to capture RF signals from different sources.