Main Content

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 Xilinx 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.

  1. To open the data capture model, run the command open_system('soc_rfsoc_datacapture').

  2. To deploy the design on your RFSoC hardware, follow the instructions in Transmit and Receive Tone Using Xilinx RFSoC Device - Part 1 System Design.

  3. Reboot the hardware board. After this step, the data capture logic is running on FPGA and is accessible from processor.

Record RF Data

  1. 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 script soc_rfsoc_datacapture_record.m calls another script RFDC_configuration.m for RFDC configuration.

  2. Change the IP address in both scripts to match your hardware board IP address.

  3. Run the command soc_rfsoc_datacapture_record to record RF data. A data file sine_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

  1. 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.

  2. 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 file sine_wave_data_pregen.tgz for your convenience.

  3. 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

  1. 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.

  2. Change the IP address of all host AXI IIO Read or Write blocks to match your hardware board IP address.

  3. 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

  1. To open the MATLAB script for capturing the live RF data, run the command open('soc_rfsoc_datacapture_mlive'). The script soc_rfsoc_datacapture_mlive.m calls the script soc_rfsoc_datacapture_mlive_setup.m for DUT AXI interface definition.

  2. 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.

See Also

Blocks