Logo
NGFC_PLL_Demo

Demo program for PLL IP Core.

The Usage() function shows how to execute the test program, options available and default values set for different configuration variables. The Variables section specifies variables used in the test program, what they specify, the values it holds and can take. The main() function specifies sequence of api calls executed and tested.

Functions

void PLLUsage ()
 
int main (int argc, char *argv[])
 

Variables

fpgawb_ipcore_t ip_core
 fpgawb_ipcore_t struct which stores useful information about the IP Core after executing get IP Info api call. Check fpgawb_lib.h or api call documentation for more information
 
int channel =-1
 Channel number for the PLL IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
double pll = 4.5f
 Frequency in MHz for the PLL IP Core channel. It takes value 4.5 MHz to 20 MHz in increments of 0.5 MHz for Fast SIO and 0.5 MHz to 4.5 MHz in increments of 0.0625 MHz for Standard SIO.
 
fpgawb_ipcore_pll_configure_t pll_config
 fpgawb_ipcore_pll_configure_t struct passed as argument to the Config api call for configuring the parameters for the respective PLL IP Core channel. Check fpgawb_lib.h or api call documentation for more information
 
int m = 0
 m specifies the multiply factor of M-counter. It takes value 0 to (2^18 - 1).
 
int n = 0
 n specifies the divide factor of N-counter. It takes value 0 to (2^18 - 1).
 
int c0 = 0
 c0 specifies the divide factor for the output clock(C-counter). It takes value 0 to (2^23 - 1).
 
int c1 = 0
 c1 specifies the divide factor for the output clock(C-counter). It takes value 0 to (2^23 - 1).
 
int bw = 0
 bandwidth takes value 0 to 15.
 
int charge_pump = 0
 charge_pump takes value 0 to 7.
 
uint pll_mode = 0
 pll_mode is the mode in which PLL is programmed. It takes value 0 to 2. 0 - User programs the m,n,c0,c1,charge_pump and bw value, 1 - m,n,c0,c1,charge_pump and bw is calculated using equation based on the frequency specified, 2 - m,n,c0,c1,charge_pump and bw is programmed via table lookup based on the frequency specified.
 
uint sio_mode = 0
 sio_mode is used in mode 2. It takes value 0 or 1, 0 indicates Fast SIO and 1 indicates Standard SIO.
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Step 1: OPEN DEVICE
ccrtNGFC_Open(&handle,board_no,oflags)
Before using any API calls, the user needs to open the device and get a handle. This handle is then used as the first argument in most of the following APIs.

Step 2: GET DRIVER INFO
ccrtNGFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccrtngfc_driver_info_t structure for later use.

Step 3: GET LIBRARY INFO
ccrtNGFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccrtngfc_library_info_t structure for later use.

Step 4: GET IP INFO
fpgawb_PLL_Get_Ip_Info(handle, &ip_core)
This call returns useful IP Core information and saves in the fpgawb_ipcore_t structure for later use.

Step 5: GET IP INFO
fpgawb_PLL_Configure_Ch(handle, chan, &pll_config)
This call programs the M, N, C0, C1, BW and Charge pump for the PLL IP Core channel.

Step 6: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle.

void PLLUsage ( )

Usage:
./fpgawb_ipcore_pll [-b BoardNumber] [-c channelNumber] [-m Mode] [-f PLLFrequency] [-s SIOMode] [-x InputVector]

Options Default value
-b Board Number 0
-c channel Number -1 (all channels)
-m Mode (0-User programmable/1-Equation/2-Table lookup) 0
-f PLL Frequency (4.5 MHz to 20 MHz in 0.5 MHz steps for Fast SIO and 0.5 MHz to 4.5 MHz in 0.0625 MHz steps for Standard SIO) 12.5f
-s SIO Mode (0-Fast SIO/1-Standard SIO) 0
-x comma separated list specifying m,n,c0,c1,charge_pump,bandwidth null


Examples:
./fpgawb_ipcore_pll -s0 -m2 -f12.5
./fpgawb_ipcore_pll -s0 -m0 -xFF,FF,FF,FF,7,F
./fpgawb_ipcore_pll -s1 -m2 -f1.125
./fpgawb_ipcore_pll -s1 -m0 -xFF,FF,FF,FF,7,F