Logo
SynchroRx_Demo

Demo program for Synchro Rx 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 SynchroRxUsage ()
 
int main (int argc, char *argv[])
 

Variables

uint enable =1
 enable mode bit for the Synchro Rx IP Core Channel. Toggling the enable signal will cause the registers to revert to default power-on states. It takes values 0 or 1 and defaults to 1
 
uint activate =0
 output enable for the Synchro Rx IP Core Channel. Enable this after configuring the registers associated with api calls starting with C. It takes values 0 or 1 and defaults to 0
 
double external_input_excitation_frequency = 1001
 The external_input_excitation_frequency input aids in the selection of the clock for the FIR filter. If the frequency of the External Input Excitation is in the range of 0-800 Hz then 2.44 Khz clock will be selected.If the frequency of the External Input Excitation is in the range of 801-2000 Hz then 9.77 Khz clock will be selected. If the frequency of the External Input Excitation is in the range of 2001-8000 Hz then 19.53 Khz clock will be selected. If the frequency of the External Input Excitation is in the range of 8001-13000 Hz then 78.125 Khz clock will be selected.
 
uint negate_input =0
 negate_input negates the four input ports a, b, c and excitation. This is accomplised by using a four bit one-hot parameter whereby LSB bit negates a, second bit negates b, third bit negates c and MSB negates excitation_input.
 
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 Synchro Rx IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
uint config_mode =0
 Configuration mode for the test program. Indicates to run the program in configure/setup IP mode or get angular_position and speed on the fly mode. It takes values 0-Static configuration/1-Get data on the fly. It defaults to 0.
 
fpgawb_ipcore_synchro_rx_configure_t config
 fpgawb_ipcore_synchro_rx_configure_t struct passed as argument for setting the static parameters if the Synchro Rx IP Core channel. Check fpgawb_lib.h or api call documentation for more information
 
fpgawb_ipcore_synchro_rx_info_t info
 fpgawb_ipcore_synchro_rx_info_t struct passed as argument for getting the speed of the Synchro Rx IP Core channel. Check fpgawb_lib.h or api call documentation for more information
 
uint gate_mode =0
 gate_mode enables the zeroing of lower bits of the angular position prior to velocity computation. It takes value 0 or 1 and defaults to 0
 
uint gate_threshold =0
 gate_threshold determines how many lower bits of the angular position will be zeroed. It takes value 6 to 20 and defaults to 0
 
double phase_delay = 0
 phase_delay is used to align the carrier signal to the input. It takes value -360 to +360 in degrees and defaults to 0.
 
uint auto_calibration = 1
 auto_calibration takes value 0 or 1 and defaults to 1, a value of 1 indicates automatic calibration is enabled to align the carrier signal to the input.
 

Function Documentation

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

Step 1: OPEN DEVICE
ccurPMFC_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
ccurPMFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccurpmfc_driver_info_t structure for later use.

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

Step 4: GET IP INFO
fpgawb_Synchro_Rx_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: ACTIVATE Synchro RX CHANNEL
fpgawb_Synchro_Rx_Activate_Ch(handle,chan,enable,activate)
This call activates the Synchro Rx IP Core Channel. Note to set activate to 0 because we will be using the Config api calls which requires activate be 0. The default for activate is 0 in this test program. It is set to 1 at the end. Please be careful to give in the value as 0 when running the test program.

Step 6: CONFIGURE CHANNEL
C_fpgawb_Synchro_Rx_Configure_Ch(handle,chan,&config)
This call configures the static parameters like clock for the FIR Filter, negate input signals for Synchro Rx IP Core Channel.

Step 7: ACTIVATE Synchro RX CHANNEL
fpgawb_Synchro_Rx_Activate_Ch(handle,chan,1,1)
This call activates the Synchro Rx channel for Running after the configuration phase. Note that you set the activate to 0 before configuration so make it 1 now.

Step 8: GET SYNCHRO RX CHANNEL ANGULAR POSITION
fpgawb_Synchro_Rx_Get_Ch_Angular_Position(handle,chan,&angular_position)
This call returns the current angular position of the Synchro Rx IP Core Channel.

Step 9: GET SYNCHRO RX CHANNEL SPEED
fpgawb_Synchro_Rx_Get_Ch_Speed(handle,chan,&info)
This call returns the current speed of the Synchro Rx IP Core Channel.

Step 10: CLOSE DEVICE
ccurPMFC_Close(handle)
Closes the device with the handle.

void SynchroRxUsage ( )

Usage:
./fpgawb_ipcore_synchro_rx [-A Activate] [-a AutoCalibration] [-b BoardNumber] [-c channelNumber] [-C config_mode] [-e Enable] [-E IIREnable] [-f ExternalInputExcitationFrequency] [-g GateMode] [-n NegateInput] [-t GateThreshold] [-w IIRBandwidth] [-x IIRClearFeedback]

Options Default value
-A Activate (0/1) 0
-a Auto calibration (0/1) 1
-b Board Number 0
-c channel Number (0-(Numchans-1) -1 (all channels)
-C Config Mode (0-Static Configuration/ 1-Get Data) 0
-e Enable (0/1) 1
-E IIR Enable (0/1) 1
-f External Input Excitation Frequency in Hz (0 to 13000) 1001 Hz
-g Gate Mode (0/1) 0
-n Negate Input Negate Input Four bit one-hot parameter whereby LSB bit negates a, second bit negates b, third bit negates c and MSB negates excitation_input 0
-t Gate Threshold (6 to 20) 0
-w IIR Bandwidth 4
-x IIR Clear Feedback (0/1) 0


Examples:
STATIC: ./fpgawb_ipcore_synchro_rx -C0 -f1001
DYNAMIC: ./fpgawb_ipcore_synchro_rx -C1