Resolver Interface#
The ResolverIP interface implements communication between the Ultrazohm PS and PL and the AD2S1210 resolver-to-digital converter IC on the Encoder Board.
Introduction#
The Ultrazohm PL and the IC interact via a \(12.5MHz\) SPI Bus. New position or velocity values can be obtained with a maximum frequency of \(400kHz\). The delay between triggering and a new value becoming valid is \(2.48 \mu s\).
As illustrated by figure Fig. 366, the AD2S1210 continously outputs an excitation signal on Pins 5 and 6 of J1 of the Encoder Board. A resolver connected to J1 will return two differential signals (Cos +/-, Sin +/-). Upon triggering via the N_SAMPLE signal, these analog signals are converted. Position and velocity values are stored in registers of the AD2S1210. Depending on the user’s need, either position or velocity or both values can be read out by the PL via SPI. Raw values are made available in the PL as IPCore outputs. Also, raw values can be transfered to the PS via the AXI-Bus. Functions for post-processing of the raw values in the PS are implemented.
![../../_images/structure_resolverIP1.png](../../_images/structure_resolverIP1.png)
Fig. 366 Block diagram of resolverIP IP Core#
The ResolverIP interface also allows for reading and writing register values of the AD2S1210. This fuctionality can be used to modify i.e. the resolver excitation frequency. For more details on register functionalities, er to the AD2S1210 Datasheet and the documentation below.
Setup#
To use the ResolverIP interface, set up your hardware as described in the respective adapter board documentation, set up your Vivado project as described below in Vivado Setup and use the Vitis functions as described further below in Vitis Setup.
Vivado Setup#
For successful SPI communication, make sure that the following pins of the AD2S1210 are routed from the Encoder Board to the PL via the CPLD:
AD2S1210 Pin |
---|
SPI_MOSI |
SPI_MISO |
SPI_CLK |
SPI_SS |
N_SAMPLE |
N_RESET |
F_SYNC |
A0 |
A1 |
The IP core shown in figure Fig. 367 can be added to the project’s block design. The source files can be found in ip_cores\uz_resolverIP\src
.
![../../_images/pic_ResolverIPCore1.png](../../_images/pic_ResolverIPCore1.png)
Fig. 367 Resolver IP Core in Vivado Block design#
The pins of the IP Core have the following functionalities:
Pin |
Functionality |
---|---|
s00_axi |
AXI-Interface, connect to to AXI-SmartConnect |
SPI_MISO |
SPI Interface, connect to pin DIG_IO_09 of Encoder Board |
sample_trigger |
if sample_trigger = ‘1’ and SPI Communication is not busy, a position and/or velocity conversion of the AD2S1210 is triggered via the N_SAMPLE signal. SPI Communication reads in position and/or velocity values to the PL. Values are made available to the PL via position_out_m and/or velocity_out_m pins. Values are made available to the PS via AXI registers. Connect to trigger source. |
s00_axi_aclk |
Clock, connect to respective global clock, this clock is used for AXI and for clocking of all processes of the IPCore |
s00_axi_aresetn |
Reset, connect to respective global reset, this Reset is used for AXI and for resetting of all processes of the IPCore |
SPI_MOSI |
SPI Interface, connect to pin DIG_IO_08 of Encoder Board |
SPI_SCLK |
SPI Interface, connect to pin DIG_IO_07 of Encoder Board |
SPI_SS |
SPI Interface, connect to pin DIG_IO_10 of Encoder Board |
busy |
indicates busy SPI communication |
error |
indicates internal State Machine failure, never happened during testing |
AD2S1210_n_reset |
AD2S1210 Interface, connect to pin DIG_IO_13 of Encoder Board |
AD2S1210_n_sample |
AD2S1210 Interface, connect to pin DIG_IO_12 of Encoder Board |
AD2S1210_n_fsync |
AD2S1210 Interface, connect to pin DIG_IO_11 of Encoder Board |
AD2S1210_mode_A0 |
AD2S1210 Interface, connect to pin DIG_IO_15 of Encoder Board |
AD2S1210_mode_A1 |
AD2S1210 Interface, connect to pin DIG_IO_14 of Encoder Board |
position_out_m |
16 bit position value as read out from AD2S1210 register, new values available with rising edge of valid_m |
velocity_out_m |
16 bit velocity value as read out from AD2S1210 register, new values available with rising edge of valid_m |
valid_m |
LOW, if since last conversion triggered by sample_trigger new value is not yet available at position_out_m and/or velocity_out_m |
AD2S1210 Interface#
An example conversion triggered by sample_trigger with the IPCore in POSITION_MODE
is shown below. In POSITION_MODE
only the position register of the AD2S1210 is read out.
![../../_images/timing_POSMODE.png](../../_images/timing_POSMODE.png)
Fig. 368 Conversion in POSITION_MODE#
Note that the conversion is triggered by a 1 tick long HIGH on sample_trigger. The next tick, AD2S1210_n_sample is pulled LOW for a defined time and the busy indicator is HIGH. Valid_m goes LOW. After a defined time, the data is available for SPI read out. SPI communication starts with AD2S1210_n_fsync going LOW and data being clocked out of the AD2S1210 on SPI_MISO with SPI_CLK. As soon as all data is transmitted, the new value is made available on position_out_m or velocity_out_m and valid_m goes HIGH.
In POSITION_VELOCITY_MODE
, the ResolverIP interface can also read out both position and velocity with one SPI interaction. An example conversion is shown below in figure Fig. 369. Note that AD2S1210_n_sample goes to zero only once. This means that position and velocity values are both sampled by the AD2S1210 at the moment of tiggering via sample_trigger. Then both velocity and position registers of the AD2S1210 are read out with two 16 bit transmissions. Between the two transmissions the AD2S1210 pin A1 is switched to make velocity register entries available via the SPI Interface. Valid_m only goes high after both values are transmitted.
![../../_images/timing_POSVELMODE.png](../../_images/timing_POSVELMODE.png)
Fig. 369 Conversion in POSITION_VELOCITY_MODE#
Warning
If you plan to only use the PL output ports of the resolverIP, then you have to set
the mode_after_init
in your config struct to e.g. POSITION_VELOCITY_MODE
. Do not set it to CONFIG_MODE
, since then the IP Core will not update speed and position values.
Vitis Setup#
To integrate AXI communication between your PS project and the PL IP Core follow the instructions below.
Initialization#
Important constant configuration parameters are stored in the struct uz_resolverIP_config_t
:
-
struct uz_resolverIP_config_t#
Configuration struct for resolverIP.
Public Members
-
uint32_t base_address#
Base address of the IP-Core
-
uint32_t ip_clk_frequency_Hz#
Clock frequency of the IP-Core, tested for 100MHz
-
uint32_t resolution#
Resolution setting of AD2S1210. Determined by RES pins, tested for 16bit
-
float freq_clockin#
External Clock of AD2S1210. Determined by Crystal Frequency, tested for 8.192MHz
-
float zero_position_mechanical#
Mechanical zero position
-
float pole_pairs_machine#
Number of machine pole pairs (for conversion from mechanical to electrical position/velocity)
-
float pole_pairs_resolver#
Number of resolver pole pairs (for conversion of measured to mechanical velocity)
-
uint32_t mode_after_init#
IP-Core operating mode after init. See enum uz_resolverIP_mode for possible options
-
uint32_t base_address#
Note
The member
base_address
needs to be set to the AXI base address assgined to the IPCore by Vivado. This value is stored inXPAR_RESOLVER_INTERFACE_V_0_BASEADDR
in thexparameters.h
file. Make sure you include this file.The member
ip_clk_frequency_Hz
needs to be set to the clock frequency of the clock input at pins00_axi_aclk
. The tested value was 100MHz (100000000U
).The member
resolution
is determined by the hardware configuration RES pins of the AD2S1210. Tests were conducted for 16 bits.The member
freq_clockin
needs to be set to the frequency of the external crystal of the AD2S1210. By default the adapter boards come with a 8.192MHz (8192000U
) crystal.The member
pole_pairs_machine
needs to be set according to the electric machine the resolver is attached to. It influences the conversion from mechanical to electrical position and velocity.The member
pole_pairs_resolver
needs to be set according to the resolver data. It influences the conversion from measured to mechanical velocity.The member
zero_Position
allows for setting an initial position that corresponds to position = 0. All mechanical and electrical positions returned by the functionsuz_resolverIP_readElectricalPosition
anduz_resolverIP_readMechanicalPosition
are with reference tozero_Position
.zero_Position
can be set via the functionuz_resolverIP_setZeroPosition
.The member
mode_after_init
defines the operating mode of the ip core after init. This is important when the IP Core shall be used in the PL without using the software driver functions that read position and velocity values via AXI. Set the mode to the intended operating mode that you’d like to use the IP Core in the PL. Every mode exceptCONFIG_MODE
is allowed. When using the resolverIP just in the processor, set the mode toCONFIG_MODE
. Switching modes during operation is handled via the read functions for position and velocity.
#include "xparameters.h"
#define CRYSTAL_FREQUENCY 8192000U
#define IP_CLK_FREQ 100000000U
struct uz_resolverIP_config_t resolver_config={
.base_address=XPAR_RESOLVER_INTERFACE_V_0_BASEADDR,
.ip_clk_frequency_Hz=IP_CLK_FREQ,
.resolution = 16,
.freq_clockin = CRYSTAL_FREQUENCY,
.pole_pairs_machine = 4.0f,
.pole_pairs_resolver = 1.0f,
.zero_position_mechanical = 0.3964f,
.mode_after_init = CONFIG_MODE,
};
With a parameter of type uz_resolverIP_config_t
, the function uz_resolverIP_init
in vitis\software\Baremetal\src\IP_Cores\uz_resolverIP\uz_resolverIP.c
is called. It returns a pointer to an instance of the struct uz_resolverIP_t
.
-
typedef struct uz_resolverIP_t uz_resolverIP_t#
Data type for object resolverIP.
-
uz_resolverIP_t *uz_resolverIP_init(struct uz_resolverIP_config_t config)#
Initializes an instance of the resolverIP driver and sets it into Config Mode.
- Parameters:
config – Configuration values for the IP-Core
- Returns:
Pointer to initialized instance
Because doxygen can’t display nested structs, here is the declaration of uz_resolverIP_t
as code snippet:
/**
* @brief Data type for object resolverIP
*
*/
struct uz_resolverIP_t {
bool is_ready;/**< Boolean that indicates successful initialization */
struct uz_resolverIP_config_t config;/**< Configuration struct with members seen below */
uz_resolverIP_mode mode;/**< enum that indicates current mode of AD2S1210 between Configuration Mode, Position Mode, Velocity Mode or PositionAndVelocityMode */
float bitToRpsFactor = 0;
uint32_t bit_offset = 0;
union{
int32_t registerValue; /** RESDAT Value 32bit*/
uint16_t pos_Vel[2]; /** 16bit position value in pos_Vel[0], 16bit velocity value in pos_Vel[1]*/
};
};
Note that the member mode
coincides with the AD2S1210’s modes (see datasheet), with the exception of the POSITION_VELOCITY_MODE
. Here the IP Core manages the timely transition between POSITION_MODE
and VELOCITY_MODE
for reading both position and velocity.
The member union
is used for buffering the position and velocity values read in via AXI from the RESDAT register. Position values are written to bits 0 to 15, velocity values are written to bits 16 to 31.
A pointer to an instance of type uz_resolverIP_t can be stored in GlobalData.objects.resolverIP
.
Global_Data.objects.resolver_IP = uz_resolverIP_init(resolver_config)
uz_resolverIP_setZeroPosition(Global_Data.objects.resolver_IP,0.45F);
uz_resolverIP_setMachinePolePairs(Global_Data.objects.resolver_IP,2.F);
uz_resolverIP_setResolverPolePairs(Global_Data.objects.resolver_IP,1.F);
Data Aquistition#
The ResolverIP interface was designed for time critical applications like motor control. As illustrated by figure Fig. 370, it is recommended to trigger the conversion via the sample_trigger input of the IPCore with the same trigger, that calls the corresponding data aquistition function. The data aquisition function will load in position and/or velocity values as soon as new values are valid. For uz_resolverIP_readMechanicalPosition
and uz_resolverIP_readMechanicalVelocity
, this is after \(2.48 \mu s\) which allows for a maximal sampling frequency of 400kS/s, for uz_resolverIP_readMechanicalPositionAndVelocity
it is after \(4.98 \mu s\) which allows for a maximal sampling frequency of 200kS/s.
![../../_images/timing3_resolverIP1.png](../../_images/timing3_resolverIP1.png)
Fig. 370 Illustration of recommended triggering setup#
-
float uz_resolverIP_readMechanicalPosition(uz_resolverIP_t *self)#
Reads Resolver Mechanical Position, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Float Mechanial Position Data in range 0 .. 2*PI
-
float uz_resolverIP_readMechanicalVelocity(uz_resolverIP_t *self)#
Reads Resolver Mechanical Velocity, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Float Mechanical Velocity Data in rad per second
Note that the two functions above return the position or velocity value as float.
The function uz_resolverIP_readMechanicalPositionAndVelocity
returns a struct of type uz_resolverIP_position_velocity_t
where position and velocity are stored in members.
-
struct uz_resolverIP_position_velocity_t#
struct for returning both position and velocity (in float)
-
struct uz_resolverIP_position_velocity_t uz_resolverIP_readMechanicalPositionAndVelocity(uz_resolverIP_t *self)#
Reads Resolver Mechanical Position and Velocity, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Struct of type uz_resolverIP_position_velocity_t with float members for mechanical position (0..2*PI) and velocity in rad per second
Note that similar functions for aquisition of electrical position and/or velocity are available:
-
float uz_resolverIP_readElectricalPosition(uz_resolverIP_t *self)#
Reads Resolver Electrical Position, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Float Electrical Position Data in range 0 .. 2*PI
-
float uz_resolverIP_readElectricalVelocity(uz_resolverIP_t *self)#
Reads Resolver Electrical Velocity, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Float Electrical Velocity Data in rad per second
-
struct uz_resolverIP_position_velocity_t uz_resolverIP_readElectricalPositionAndVelocity(uz_resolverIP_t *self)#
Reads Resolver Electrical Position and Velocity, returns after SPI Communication is done and value is read in via AXI. External trigger connected to IPCore is neccessary.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
Struct of type uz_resolverIP_position_velocity_t with float members for electrical position (0..2*PI) and velocity in rad per second
Exemplary implementations for one connected resolver that write to the GlobalData
struct are shown below and could be called in isr.c
:
void update_position_of_resolverIP(DS_Data* const data){
data->av.theta_mech = uz_resolverIP_readMechanicalPosition(data->objects.resolver_IP);
data->av.theta_elec = (data->av.theta_mech * uz_resolverIP_getMachinePolePairs(data->objects.resolver_IP)) - 2 * UZ_PIf * floor(data->av.theta_mech * uz_resolverIP_getMachinePolePairs(data->objects.resolver_IP) / (2* UZ_PIf));
}
void update_speed_of_resolverIP(DS_Data* const data){
data->av.mechanicalRotorSpeed = uz_resolverIP_readMechanicalVelocity(data->objects.resolver_IP) * 60.f; //in rpm
}
void update_position_and_speed_of_resolverIP(DS_Data* const data){
uz_resolverIP_position_velocity_t mechanical = uz_resolverIP_readMechanicalPositionAndVelocity(data->objects.resolver_IP);
data->av.theta_mech = mechanical.position;
data->av.mechanicalRotorSpeed = mechanical.velocity * 60.F; //rpm
data->av.theta_elec = (data->av.theta_mech * uz_resolverIP_getMachinePolePairs(data->objects.resolver_IP)) - 2.0f * UZ_PIf * floorf(data->av.theta_mech * uz_resolverIP_getMachinePolePairs(data->objects.resolver_IP) / (2.0f * UZ_PIf));
}
More functioniality#
The ResolverIP Interface comes with a wide range of functions to write or read configuration registers of the AD2S1210. A list of all registers can be seen in figure Fig. 371.
![../../_images/register_table1.png](../../_images/register_table1.png)
Fig. 371 List of all configuration registers of the AD2S1210#
For all possible read and write operations, high level functions have been implemented. For applicable write funcitons, the user only needs to input the desired value in float format, the function will take over the conversion to the 8 bit register value. For applicable read functions, values are returned in float format. A list of all functions is given below.
If the user wants to manually write a definded integer value to a register, the function writeRegister
can be used.
-
void uz_resolverIP_writeRegister(uz_resolverIP_t *self, int32_t addr, int32_t val)#
Writes Resolver Register.
- Parameters:
self – instance of uz_resolverIP_t
addr – Register address
val – Register write value
For reading of a register readRegister
can be used.
-
int32_t uz_resolverIP_readRegister(uz_resolverIP_t *self, int32_t addr)#
Reads Resolver Register.
- Parameters:
self – instance of uz_resolverIP_t
addr – Register address (see Datasheet)
- Returns:
int32_t Read Register Data
High Level Register Operation Functions#
-
void uz_resolverIP_setLOSThresh(uz_resolverIP_t *self, float thresh)#
Sets Loss Of Signal Threshold of AD2S1210. From AD2S1210 Datasheet: The LOS threshold register determines the loss of signal threshold of the AD2S1210. The AD2S1210 allows the user to set the LOS threshold to a value between 0 V and 4.82 V. The resolution of the LOS threshold is seven bits, that is, 38 mV. Note that the MSB, D7, should be set to 0. The default value of the LOS threshold on power-up is 2.2 V.
- Parameters:
self – instance of uz_resolverIP_t
thresh – Loss Of Signal Threshold of AD2S1210 in Volts. Valid threshold values are in the range [0V, 4.82V]
-
float uz_resolverIP_getLOSThresh(uz_resolverIP_t *self)#
Returns Loss Of Signal Threshold of AD2S1210 in Volts. From AD2S1210 Datasheet: The LOS threshold register determines the loss of signal threshold of the AD2S1210. The AD2S1210 allows the user to set the LOS threshold to a value between 0 V and 4.82 V. The resolution of the LOS threshold is seven bits, that is, 38 mV. Note that the MSB, D7, should be set to 0. The default value of the LOS threshold on power-up is 2.2 V.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Loss Of Signal Threshold of AD2S1210 in Volts
-
void uz_resolverIP_setDOSOverrangeThresh(uz_resolverIP_t *self, float thresh)#
Sets Degradation Of Signal Threshold of AD2S1210. From AD2S1210 Datasheet: The DOS overrange threshold register determines the degradation of signal threshold of the AD2S1210. The AD2S1210 allows the user to set the DOS overrange threshold to a value between 0 V and 4.82 V. The resolution of the DOS overrange threshold is 7 bits, that is, 38 mV. The MSB, D7, must be set to 0. The default value of the DOS overrange threshold on power-up is 4.1 V.
- Parameters:
self – instance of uz_resolverIP_t
thresh – Degradation Of Signal Threshold of AD2S1210 in Volts. Valid threshold values are in the range [0V, 4.82V]
-
float uz_resolverIP_getDOSOverrangeThresh(uz_resolverIP_t *self)#
Returns Degradation Of Signal Threshold of AD2S1210 in Volts. From AD2S1210 Datasheet: The DOS overrange threshold register determines the degradation of signal threshold of the AD2S1210. The AD2S1210 allows the user to set the DOS overrange threshold to a value between 0 V and 4.82 V. The resolution of the DOS overrange threshold is 7 bits, that is, 38 mV. The MSB, D7, must be set to 0. The default value of the DOS overrange threshold on power-up is 4.1 V. *.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Degradation Of Signal Threshold of AD2S1210 in Volts
-
void uz_resolverIP_setDOSMismatchThresh(uz_resolverIP_t *self, float thresh)#
Sets Degradation Of Signal Mismatch Threshold of AD2S1210. From AD2S1210 Datasheet: The DOS mismatch threshold register determines the signal mismatch threshold of the AD2S1210. The AD2S1210 allows the user to set the DOS mismatch threshold to a value between 0 V and 4.82 V. The resolution of the DOS mismatch threshold is seven bits, that is, 38 mV. Note that the MSB, D7, should be set to 0.The default value of the DOS mismatch threshold on power-up is 380 mV.
- Parameters:
self – instance of uz_resolverIP_t
thresh – Degradation Of Signal Mismatch Threshold of AD2S1210 in Volts. Valid threshold values are in the range [0V, 4.82V]
-
float uz_resolverIP_getDOSMismatchThresh(uz_resolverIP_t *self)#
Returns Degradation Of Signal Mismatch Threshold of AD2S1210 in Volts. From AD2S1210 Datasheet: The DOS mismatch threshold register determines the signal mismatch threshold of the AD2S1210. The AD2S1210 allows the user to set the DOS mismatch threshold to a value between 0 V and 4.82 V. The resolution of the DOS mismatch threshold is seven bits, that is, 38 mV. Note that the MSB, D7, should be set to 0.The default value of the DOS mismatch threshold on power-up is 380 mV.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Degradation Of Signal Mismatch Threshold of AD2S1210 in Volts
-
void uz_resolverIP_setDOSResetMax(uz_resolverIP_t *self, float max)#
Sets Degradation Of Signal Reset Threshold of AD2S1210. From AD2S1210 Datasheet: The AD2S1210 continuously stores the minimum and maximum magnitude of the monitor signal in internal registers. The difference between the minimum and maximum is calculated to determine if a DOS mismatch has occurred. The initial values for the minimum and maximum internal registers must be defined by the user. When the fault register is cleared, the registers that store the maximum and minimum amplitudes of the monitor signal are reset to the values stored in the DOS reset maximum and minimum threshold registers. The resolution of the DOS reset maximum and minimum thresholds is seven bits each, that is, 38 mV. Note that the MSB, D7, should be set to 0. To ensure correct operation, it is recommended that the DOS reset minimum threshold register be set to at least 1 LSB less than the DOS overrange threshold, and the DOS reset maximum threshold register be set to at least 1 LSB greater than the LOS threshold register. The default value of the DOS reset minimum threshold register and the DOS reset maximum threshold register are 3.99 V and 2.28 V, respectively.
- Parameters:
self – instance of uz_resolverIP_t
max – Degradation Of Signal Reset Maximum Threshold of AD2S1210 in Volts. Valid threshold values are in the range [0V, 4.82V]
-
void uz_resolverIP_setDOSResetMin(uz_resolverIP_t *self, float min)#
Sets Degradation Of Signal Reset Threshold of AD2S1210. From AD2S1210 Datasheet: The AD2S1210 continuously stores the minimum and maximum magnitude of the monitor signal in internal registers. The difference between the minimum and maximum is calculated to determine if a DOS mismatch has occurred. The initial values for the minimum and maximum internal registers must be defined by the user. When the fault register is cleared, the registers that store the maximum and minimum amplitudes of the monitor signal are reset to the values stored in the DOS reset maximum and minimum threshold registers. The resolution of the DOS reset maximum and minimum thresholds is seven bits each, that is, 38 mV. Note that the MSB, D7, should be set to 0. To ensure correct operation, it is recommended that the DOS reset minimum threshold register be set to at least 1 LSB less than the DOS overrange threshold, and the DOS reset maximum threshold register be set to at least 1 LSB greater than the LOS threshold register. The default value of the DOS reset minimum threshold register and the DOS reset maximum threshold register are 3.99 V and 2.28 V, respectively.
- Parameters:
self – instance of uz_resolverIP_t
min – Degradation Of Signal Reset Maximum Threshold of AD2S1210 in Volts. Valid threshold values are in the range [0V, 4.82V]
-
float uz_resolverIP_getDOSResetMin(uz_resolverIP_t *self)#
Returns Degradation Of Signal Reset Minimum Threshold of AD2S1210. From AD2S1210 Datasheet: The AD2S1210 continuously stores the minimum and maximum magnitude of the monitor signal in internal registers. The difference between the minimum and maximum is calculated to determine if a DOS mismatch has occurred. The initial values for the minimum and maximum internal registers must be defined by the user. When the fault register is cleared, the registers that store the maximum and minimum amplitudes of the monitor signal are reset to the values stored in the DOS reset maximum and minimum threshold registers. The resolution of the DOS reset maximum and minimum thresholds is seven bits each, that is, 38 mV. Note that the MSB, D7, should be set to 0. To ensure correct operation, it is recommended that the DOS reset minimum threshold register be set to at least 1 LSB less than the DOS overrange threshold, and the DOS reset maximum threshold register be set to at least 1 LSB greater than the LOS threshold register. The default value of the DOS reset minimum threshold register and the DOS reset maximum threshold register are 3.99 V and 2.28 V, respectively.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Degradation Of Signal Reset Minimum Threshold of AD2S1210 in Volts
-
float uz_resolverIP_getDOSResetMax(uz_resolverIP_t *self)#
Returns Degradation Of Signal Reset Maximum Threshold of AD2S1210. From AD2S1210 Datasheet: The AD2S1210 continuously stores the minimum and maximum magnitude of the monitor signal in internal registers. The difference between the minimum and maximum is calculated to determine if a DOS mismatch has occurred. The initial values for the minimum and maximum internal registers must be defined by the user. When the fault register is cleared, the registers that store the maximum and minimum amplitudes of the monitor signal are reset to the values stored in the DOS reset maximum and minimum threshold registers. The resolution of the DOS reset maximum and minimum thresholds is seven bits each, that is, 38 mV. Note that the MSB, D7, should be set to 0. To ensure correct operation, it is recommended that the DOS reset minimum threshold register be set to at least 1 LSB less than the DOS overrange threshold, and the DOS reset maximum threshold register be set to at least 1 LSB greater than the LOS threshold register. The default value of the DOS reset minimum threshold register and the DOS reset maximum threshold register are 3.99 V and 2.28 V, respectively.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Degradation Of Signal Reset Maximum Threshold of AD2S1210 in Volts
-
void uz_resolverIP_setLOTHighThresh(uz_resolverIP_t *self, float thresh)#
Sets Loss Of Tracking High Threshold of AD2S1210. From AD2S1210 Datasheet: The LOT high threshold register determines the loss of position tracking threshold for the AD2S1210. The LOT high threshold is a 7-bit word. The MSB, D7, must be set to 0. The range of the LOT high threshold, the LSB size, and the default value of the LOT high threshold on power-up are dependent on the resolution setting of the AD2S1210, and are outlined in Table 19.
- Parameters:
self – instance of uz_resolverIP_t
thresh – Loss Of Tracking High Threshold of AD2S1210 in degrees
-
float uz_resolverIP_getLOTHighThresh(uz_resolverIP_t *self)#
Returns Loss Of Tracking High Threshold of AD2S1210 in Volts. From AD2S1210 Datasheet: The LOT high threshold register determines the loss of position tracking threshold for the AD2S1210. The LOT high threshold is a 7-bit word. The MSB, D7, must be set to 0. The range of the LOT high threshold, the LSB size, and the default value of the LOT high threshold on power-up are dependent on the resolution setting of the AD2S1210, and are outlined in Table 19.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Loss Of Tracking High Threshold of AD2S1210 in Degrees
-
void uz_resolverIP_setLOTLowThresh(uz_resolverIP_t *self, float thresh)#
Sets Loss Of Tracking Low Threshold of AD2S1210. From AD2S1210 Datasheet: The LOT low threshold register determines the level of hysteresis on the loss of position tracking fault detection. Loss of tracking (LOT) occurs when the internal error signal of the AD2S1210 exceeds the LOT high threshold. LOT has hysteresis and is not cleared until the internal error signal is less than the value defined in the LOT low threshold register. The LOT low threshold is a 7-bit word. The MSB, D7, must be set to 0. The range of the LOT low threshold, the LSB size, and the default value of the LOT low threshold on power-up are dependent on the resolution setting of the AD2S1210 and are outlined in Table 19.
- Parameters:
self – instance of uz_resolverIP_t
thresh – Loss Of Tracking High Threshold of AD2S1210 in degrees
-
float uz_resolverIP_getLOTLowThresh(uz_resolverIP_t *self)#
Returns Loss Of Tracking Low Threshold of AD2S1210 in Volts. From AD2S1210 Datasheet: The LOT low threshold register determines the level of hysteresis on the loss of position tracking fault detection. Loss of tracking (LOT) occurs when the internal error signal of the AD2S1210 exceeds the LOT high threshold. LOT has hysteresis and is not cleared until the internal error signal is less than the value defined in the LOT low threshold register. The LOT low threshold is a 7-bit word. The MSB, D7, must be set to 0. The range of the LOT low threshold, the LSB size, and the default value of the LOT low threshold on power-up are dependent on the resolution setting of the AD2S1210 and are outlined in Table 19.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float Loss Of Tracking High Threshold of AD2S1210 in Degrees
-
void uz_resolverIP_setExcitationFrequency(uz_resolverIP_t *self, float excFreq)#
Sets Excitation Frequency Register of AD2S1210. From AD2S1210 Datasheet: The excitation frequency register determines the frequency of the excitation outputs of the AD2S1210. A 7-bit frequency control word is written to the register to set the excitation frequency. The MSB, D7, must be set to 0. fCW = (Excitation frquency * 2^15) / fCLKIN where fCW is the frequency control word and fCLKIN is the clock frequency of the AD2S1210. The specified range of the excitation frequency is from 2 kHz to 20 kHz and can be set in increments of 250 Hz. To ensure that the AD2S1210 is operated within the specified frequency range, the frequency control word should be a value between 0x4 and 0x50.
- Parameters:
self – instance of uz_resolverIP_t
excFreq – Excitation Frequency AD2S1210 in Herz.
-
float uz_resolverIP_getExcitationFrequency(uz_resolverIP_t *self)#
Returns Excitation Frequency Register of AD2S1210. From AD2S1210 Datasheet: The excitation frequency register determines the frequency of the excitation outputs of the AD2S1210. A 7-bit frequency control word is written to the register to set the excitation frequency. The MSB, D7, must be set to 0. fCW = (Excitation frequency * 2^15) / fCLKIN where fCW is the frequency control word and fCLKIN is the clock frequency of the AD2S1210. The specified range of the excitation frequency is from 2 kHz to 20 kHz and can be set in increments of 250 Hz. To ensure that the AD2S1210 is operated within the specified frequency range, the frequency control word should be a value between 0x4 and 0x50.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
float ExcitationFrequency of AD2S1210 in Herz
-
void uz_resolverIP_setCTRLReg(uz_resolverIP_t *self, int32_t register_value)#
Sets Control Register of AD2S1210. From AD2S1210 Datasheet: The control register is an 8-bit register that sets the AD2S1210 control modes. The default value of the control register on power-up is 0x7E.
- Parameters:
self – instance of uz_resolverIP_t
register_value – Control Register Value
-
int32_t uz_resolverIP_getCTRLReg(uz_resolverIP_t *self)#
Returns Control Register of AD2S1210. From AD2S1210 Datasheet: The control register is an 8-bit register that sets the AD2S1210 control modes. The default value of the control register on power-up is 0x7E.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
int32_t Control Register Value
-
void uz_resolverIP_resetSoftware(uz_resolverIP_t *self)#
Resets Software of AD2S1210 From AD2S1210 Datasheet: Addressing the software reset register, that is writing the 8-bit address, 0xF0, of the software reset register to the AD2S1210 while in configuration mode, allows the user to initiate a software reset of the AD2S1210. The software reset reinitializes the excitation frequency outputs and the internal Type II tracking loop. The data stored in the configuration registers is not overwritten by a software reset. However, note that the data in the fault register is reset. In an application that uses two or more resolver-to-digital converters, which are both driven from the same clock source, the software reset can be used to synchronize the phase of the excitation frequencies across the converters.
- Parameters:
self – instance of uz_resolverIP_t
-
int32_t uz_resolverIP_getFLTRegister(uz_resolverIP_t *self)#
Reads Fault Register of AD2S1210 From AD2S1210 Datasheet: The AD2S1210 has the ability to detect eight separate fault condi- tions. When a fault occurs, the DOS and/or the LOT output pins are taken low. By reading the fault register, the user can determine the cause of the triggering of the fault detection output pins. Note that the fault register bits are active high, that is, the fault bits are taken high to indicate that a fault has occurred.
- Parameters:
self – instance of uz_resolverIP_t
- Returns:
int32_t Fault Register Value