Main Content

System Object Usage

When you program the RFSoC bitstream, a configuration file is uploaded to the board. This file configures the sampling rates and RF settings specified in the HDL Workflow Advisor. By default, this configuration is enough to get the board running at the settings that match the intended design. Properties might need run-time adjustment, such as the center frequency of a mixer or the sampling rate for a digital-to-analog converter (DAC) or analog-to-digital converter (ADC).

The HDL Workflow Advisor generates an example script for you to either use or modify the script as needed. Typically, this script has a name of <HDL Subsystem Name>_setup_rfsoc.m and looks like this example script.

% This script was auto-generated from the HDL Coder 
% Workflow Advisor for the ZCU111 and ZCU216
% Edit this script as necessary to conform to your 
% design specification or settings
 
%% Instantiate object and basic settings
IPAddr = '192.168.1.101';
rfobj = soc.RFDataConverter('ZU49DR',IPAddr);
 
PLLSrc = 'Internal';
ReferenceClock = 245.76; % MHz 
ADCSamplingRate = 2048; % MHz 
DACSamplingRate = 2048; % MHz 
DecimationFactor = 4;
InterpolationFactor = 4;
 
%% User FPGA-logic settings
rfobj.FPGASamplesPerClock = 4;
rfobj.ConverterClockRatio = 1;

If you do not modify this script, it is an exact replica of the configuration file used for the RF data converter. This script applies the main parameters, such as sampling rates, PLL settings, interpolation mode, and decimation mode, on every tile and channel across the ADC and DAC.

%% Setup ADC/DAC Tile sampling and PLL rates
for TileId = 0:(rfobj.TotalADCTiles-1)
    rfobj.configureADCTile(TileId,PLLSrc, ...
            ReferenceClock,ADCSamplingRate);
    for ChId = 0:(rfobj.ADCChannelsPerTile-1)
        rfobj.configureADCChannel(TileId,ChId, ...
            DecimationFactor);
    end
end
 
for TileId = 0:(rfobj.TotalDACTiles-1)
    rfobj.configureDACTile(TileId,PLLSrc, ...
            ReferenceClock,DACSamplingRate);
    for ChId = 0:(rfobj.DACChannelsPerTile-1)        
        rfobj.configureDACChannel(TileId,ChId, ...
            InterpolationFactor,'DUCMode','FullNyquistDUC');        
    end
end

Object functions that require tile ID and channel ID input arguments, such as configureDACChannel, must be zero-based indexed.

The script establishes connection by using the setup routine. When you alter the properties of the object, changes do not actually get applied to the board until you run the applyConfiguration object function.

%% Apply settings to RFTool
applyConfiguration(rfobj)

The applyConfiguration object function applies only these properties to the board:

  • ReferenceClock

  • ADCSamplingRate

  • DACSamplingRate

  • DecimationFactor

  • InterpolationFactor

  • Inverse Sync Mode

  • Mixer Mode (LO, data path type)

  • Enabling MTS SysRef

These object functions handle additional functionality that the applyConfiguration object function does not handle.

To assist in changing the local oscillator (LO) center frequency, use the configureDACLocalOscillator and configureADCLocalOscillator object functions. This code shows an example of the general syntax for configureDACLocalOscillator and configureADCLocalOscillator object functions:

%% DAC Tiles
rfobj.configureDACLocalOscillator(1,3,LO_VALUE+10); 
            % Create a shift in DAC RF NCO of 10 MHz
 
%% ADC Tiles
rfobj.configureADCLocalOscillator(0,0,-LO_VALUE); 

In this code, the arguments represent the tile ID, channel ID, and LO value and arguments use zero-based indexing. For an example, see RF Data Converter IQ Mixer Mode.

Object functions such as configureDACLocalOscillator, applyCalibrationMode, and applyNyquistZone require an active connection to the board. Before using these object functions, make sure that you run the setup function.

See Also

Related Topics