Logo
FOCX1

API calls to access the Field Oriented Control IP Core.

The API calls in this module provide functionality to configure and read Field Oriented Control IP Core. The calls prefixed with C are used to configure the static registers and can be invoked only after setting the activate bit to 0 using fpgawb_FOC_X1_Activate api call. Set back the activate to 1 after the configuration. Every api call in this module returns int indicating error status.

Functions

int fpgawb_FOC_X1_Activate (void *handle, uint enable, uint activate)
 
int fpgawb_FOC_X1_Get_Ip_Info (void *handle, fpgawb_ipcore_t *ip_core)
 
int C_fpgawb_FOC_X1_Configure (void *handle, fpgawb_ipcore_foc_x1_configure_t *config)
 
int fpgawb_FOC_X1_Set_Speed (void *handle, double rpm)
 
int fpgawb_FOC_X1_Set_Frequency (void *handle, double frequency)
 

Function Documentation

int C_fpgawb_FOC_X1_Configure ( void *  handle,
fpgawb_ipcore_foc_x1_configure_t *  config 
)

This api call provides functionality to configure the static registers for the Field Oriented Control IP Core. Input is a handle to the board and fpgawb_ipcore_foc_x1_configure_t struct which has five fields angle_shift, pwm_gain, number_of_pole_pairs, pi_controller_proportional and pi_controller_integral. angle_shift shifts the angle increment input to extend the range of acceptable increment angles inside of the 3-phase PWM logic. Thus a smaller shift will support the slower RPM's and a larger shift will support very large RPM's. The maximum acceptable value is 12. The pwm_gain sets the amplitude of the internally generated triangular wave. This triangular wave is used to generate the PWM signal which will control the IGBT switches in the Inverter. Ideally the amplitude of triangular wave will be set relative to the expected current of the * motor it is designed to control. pi_controller_proportional is the proportional gain of the PI Controller. The PI Controller's purpose is to filter the angular speed error between the user desired speed and the instantaneous speed of the PMSM ensuring the correct steady state value is achieved as required by the algorithm. pi_controller_integral is the integral gain of the PI Controller. he PI Controller's purpose is to filter the angular speed error between the user desired speed and the instantaneous speed of the PMSM ensuring the correct steady state value is achieved as required by the algorithm. number_of_pole_pairs indicates the number of pole pairs in the PMSM Model.

Parameters
[in]void*handle (Handle pointer)
[in]fpgawb_ipcore_foc_x1_configure_t*config
uint angle_shift
double pwm_gain
uint number_of_pole_pairs
double pi_controller_proportional
double pi_controller_integral
Returns
int
         #DRIVERNAME_LIB_NO_ERROR (successful)
         #DRIVERNAME_LIB_BAD_HANDLE (no/bad handler supplied)
         #DRIVERNAME_LIB_NOT_OPEN (device not open)
         #DRIVERNAME_LIB_INVALID_ARG (invalid argument)
         #DRIVERNAME_LIB_NO_LOCAL_REGION (local region not present)
         #DRIVERNAME_LIB_NO_RESOURCE (Field Oriented Control IP Core not present)
         #FPGAWB_LIB_FPGAWB_ERROR_INVALID_ARG (Invalid argument specified in the api call)
int fpgawb_FOC_X1_Activate ( void *  handle,
uint  enable,
uint  activate 
)

This api call provides functionality to configure enable and activate for the Field Oriented Control IP Core. Input is a handle to the board, enable and activate. The parameters enable and activate takes values 0 or 1. enable when set to 0 sets the IP registers to power-on reset values and it must be set to 1 to start configuring the IP Core Channel. The api call prefixed with C requires that the activate be set to 0 before configuring the parameters associated with them and then set to 1. The activate parameter functions as output enable for the IP Core Channel.

Parameters
[in]void*handle (Handle pointer)
[in]uintenable
[in]uintactivate
Returns
int
         #DRIVERNAME_LIB_NO_ERROR (successful)
         #DRIVERNAME_LIB_BAD_HANDLE (no/bad handler supplied)
         #DRIVERNAME_LIB_NOT_OPEN (device not open)
         #DRIVERNAME_LIB_INVALID_ARG (invalid argument)
         #DRIVERNAME_LIB_NO_LOCAL_REGION (local region not present)
         #DRIVERNAME_LIB_NO_RESOURCE (Field Oriented Control IP Core not present)
         #FPGAWB_LIB_FPGAWB_ERROR_INVALID_ARG (Invalid argument specified in the api call)
int fpgawb_FOC_X1_Get_Ip_Info ( void *  handle,
fpgawb_ipcore_t *  ip_core 
)

This api call returns Field Oriented Control IP Core information. Input is a handle to the board and fpgawb_ipcore_t struct which is an inout parameter and has four fields IpCoreCode, MajorRevision, MinorRevision, IpCoreOffset and NumChans. It returns the IP Core information in the fpgawb_ipcore_t struct.

Parameters
[in]void*handle (Handle pointer)
[out]fpgawb_ipcore_t*ip_core (pointer to fpgawb_ipcore_t struct)
uint IpCoreCode
uint MajorRevision
uint MinorRevision
uint IpCoreOffset
uint NumChans
Returns
int
         #DRIVERNAME_LIB_NO_ERROR (successful)
         #DRIVERNAME_LIB_BAD_HANDLE (no/bad handler supplied)
         #DRIVERNAME_LIB_NOT_OPEN (device not open)
         #DRIVERNAME_LIB_INVALID_ARG (invalid argument)
         #FPGAWB_LIB_FPGAWB_ERROR_INVALID_ARG (Invalid argument specified in the api call)
int fpgawb_FOC_X1_Set_Frequency ( void *  handle,
double  frequency 
)

This api call provides functionality to set the phase increment of the Field Oriented Control IP Core. Input is a handle to the board and frequency. Phase increment is used to generate the triangular wave inside of the 3-phase PWM logic. It represents the amount of rotation of the waveform per 10MHz clock cycle.

Parameters
[in]void*handle (Handle pointer)
[in]doublefrequency
Returns
int
         #DRIVERNAME_LIB_NO_ERROR (successful)
         #DRIVERNAME_LIB_BAD_HANDLE (no/bad handler supplied)
         #DRIVERNAME_LIB_NOT_OPEN (device not open)
         #DRIVERNAME_LIB_INVALID_ARG (invalid argument)
         #DRIVERNAME_LIB_NO_LOCAL_REGION (local region not present)
         #DRIVERNAME_LIB_NO_RESOURCE (Field Oriented Control IP Core not present)
         #FPGAWB_LIB_FPGAWB_ERROR_INVALID_ARG (Invalid argument specified in the api call)
int fpgawb_FOC_X1_Set_Speed ( void *  handle,
double  rpm 
)

This api call provides functionality to set the speed of the motor. Input is a handle to the board and rpm. The parameter rpm is the speed of the motor in revolutions per minute and converted to radians per second and programmed to the Field Oriented Control IP Core.

Parameters
[in]void*handle (Handle pointer)
[in]doublerpm
Returns
int
         #DRIVERNAME_LIB_NO_ERROR (successful)
         #DRIVERNAME_LIB_BAD_HANDLE (no/bad handler supplied)
         #DRIVERNAME_LIB_NOT_OPEN (device not open)
         #DRIVERNAME_LIB_INVALID_ARG (invalid argument)
         #DRIVERNAME_LIB_NO_LOCAL_REGION (local region not present)
         #DRIVERNAME_LIB_NO_RESOURCE (Field Oriented Control IP Core not present)
         #FPGAWB_LIB_FPGAWB_ERROR_INVALID_ARG (Invalid argument specified in the api call)