CAT2 Peripheral Driver Library
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
Offset and Slope Trim Functions

These are advanced functions for trimming the offset and slope of the opamps. More...

Functions

void Cy_CTB_OpampSetOffset (CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum, uint32_t trim)
 Overrides the CTB opamp offset factory trim. More...
 
uint32_t Cy_CTB_OpampGetOffset (const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)
 Returns the current CTB opamp offset trim value. More...
 
void Cy_CTB_OpampSetSlope (CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum, uint32_t trim)
 Overrides the CTB opamp slope factory trim. More...
 
uint32_t Cy_CTB_OpampGetSlope (const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)
 Returns the CTB opamp slope trim value. More...
 
void Cy_CTB_DSAB_SetSource (CTBM_Type *base, cy_en_ctb_dsab_bias_source_t biasSource)
 Overrides the Deep Sleep Amplifier Bias current bias sources from factory trim settings. More...
 
cy_en_ctb_dsab_bias_source_t Cy_CTB_DSAB_GetSource (const CTBM_Type *base)
 Returns the Deep Sleep Amplifier Bias current bias source. More...
 
void Cy_CTB_DSAB_SetCurrent (CTBM_Type *base, uint32_t biasCurrent)
 Overrides the Deep Sleep Amplifier Bias current value from factory trim settings. More...
 
uint32_t Cy_CTB_DSAB_GetCurrent (const CTBM_Type *base)
 Returns the Deep Sleep Amplifier Bias current value. More...
 

Detailed Description

These are advanced functions for trimming the offset and slope of the opamps.

Most users do not need to call these functions and can use the factory trimmed values.

Function Documentation

◆ Cy_CTB_OpampSetOffset()

void Cy_CTB_OpampSetOffset ( CTBM_Type *  base,
cy_en_ctb_opamp_sel_t  opampNum,
uint32_t  trim 
)

Overrides the CTB opamp offset factory trim.

The trim is a six-bit value and the MSB is a direction bit.

Bit 5 Bits 4:0 Note
0 00000 Negative trim direction - minimum setting
0 11111 Negative trim direction - maximum setting
1 00000 Positive trim direction - minimum setting
1 11111 Positive trim direction - maximum setting
Parameters
baseThe pointer to structure-describing registers.
opampNumCY_CTB_OPAMP_0, CY_CTB_OPAMP_1, or CY_CTB_OPAMP_BOTH
trimThe trim value is from 0 to 63.
Function Usage
/* Scenario: Calibrate the offset trim by iterating through all the possible trim values. */
uint8_t trim;
for (trim = 0u; trim <= 0x3F; trim++)
{
Cy_CTB_OpampSetOffset(CTBM0, CY_CTB_OPAMP_0, trim);
/* Do something after changing the offset trim. */
}

◆ Cy_CTB_OpampGetOffset()

uint32_t Cy_CTB_OpampGetOffset ( const CTBM_Type *  base,
cy_en_ctb_opamp_sel_t  opampNum 
)

Returns the current CTB opamp offset trim value.

Parameters
baseThe pointer to structure-describing registers.
opampNumCY_CTB_OPAMP_0 or CY_CTB_OPAMP_1. CY_CTB_OPAMP_NONE and CY_CTB_OPAMP_BOTH are invalid options.
Returns
Offset trim value
Function Usage
/* Scenario: Save the factory offset trim before changing it. */
uint32_t factoryOffset;
factoryOffset = Cy_CTB_OpampGetOffset(CTBM0, CY_CTB_OPAMP_0);

◆ Cy_CTB_OpampSetSlope()

void Cy_CTB_OpampSetSlope ( CTBM_Type *  base,
cy_en_ctb_opamp_sel_t  opampNum,
uint32_t  trim 
)

Overrides the CTB opamp slope factory trim.

The offset of the opamp will vary across the temperature. This trim compensates for the slope of the offset across temperature. This compensation uses a bias current from the Analog Reference block. To disable it, set the trim to 0.

The trim is a six-bit value and the MSB is a direction bit.

Bit 5 Bits 4:0 Note
0 00000 Negative trim direction - minimum setting
0 11111 Negative trim direction - maximum setting
1 00000 Positive trim direction - minimum setting
1 11111 Positive trim direction - maximum setting
Parameters
baseThe pointer to structure-describing registers.
opampNumCY_CTB_OPAMP_0, CY_CTB_OPAMP_1, or CY_CTB_OPAMP_BOTH
trimThe trim value is from 0 to 63.
Function Usage
/* Scenario: Calibrate the slope trim by iterating through all the possible trim values. */
uint8_t trim;
for (trim = 0u; trim <= 0x3F; trim++)
{
Cy_CTB_OpampSetSlope(CTBM0, CY_CTB_OPAMP_0, trim);
/* Do something after changing the slope trim. */
}

◆ Cy_CTB_OpampGetSlope()

uint32_t Cy_CTB_OpampGetSlope ( const CTBM_Type *  base,
cy_en_ctb_opamp_sel_t  opampNum 
)

Returns the CTB opamp slope trim value.

Parameters
baseThe pointer to structure-describing registers.
opampNumCY_CTB_OPAMP_0 or CY_CTB_OPAMP_1. CY_CTB_OPAMP_NONE and CY_CTB_OPAMP_BOTH are invalid options.
Returns
Slope trim value
Function Usage
/* Scenario: Save the factory slope trim before changing it. */
uint32_t factorySlope;
factorySlope = Cy_CTB_OpampGetSlope(CTBM0, CY_CTB_OPAMP_0);

◆ Cy_CTB_DSAB_SetSource()

void Cy_CTB_DSAB_SetSource ( CTBM_Type *  base,
cy_en_ctb_dsab_bias_source_t  biasSource 
)

Overrides the Deep Sleep Amplifier Bias current bias sources from factory trim settings.

If the default (CY_CTB_SRSS_ZTC_DSAB_PTAT) DSAB setting is changed then a periodic re-trim of CTB(m) offset must be performed.

Parameters
baseThe pointer to structure-describing registers.
biasSourcecy_en_ctb_dsab_bias_source_t
Function Usage
/* Scenario: Select ZTC output from DSAB and PTAT output from SRSS */

◆ Cy_CTB_DSAB_GetSource()

cy_en_ctb_dsab_bias_source_t Cy_CTB_DSAB_GetSource ( const CTBM_Type *  base)

Returns the Deep Sleep Amplifier Bias current bias source.

Parameters
baseThe pointer to structure-describing registers.
Returns
biasSource cy_en_ctb_dsab_bias_source_t
Function Usage
/* Scenario: Verify the DSAB bias sources */
biasSource = Cy_CTB_DSAB_GetSource(CTBM0);

◆ Cy_CTB_DSAB_SetCurrent()

void Cy_CTB_DSAB_SetCurrent ( CTBM_Type *  base,
uint32_t  biasCurrent 
)

Overrides the Deep Sleep Amplifier Bias current value from factory trim settings.

Periodic re-trim of CTB(m) offset must be performed if these settings are overridden.

Parameters
baseThe pointer to structure-describing registers.
biasCurrentThe bias current value.
Function Usage
/* Scenario: Set the bias current value to 3.6uA */
Cy_CTB_DSAB_SetCurrent(CTBM0, 0x30u);

◆ Cy_CTB_DSAB_GetCurrent()

uint32_t Cy_CTB_DSAB_GetCurrent ( const CTBM_Type *  base)

Returns the Deep Sleep Amplifier Bias current value.

Parameters
baseThe pointer to structure-describing registers.
Returns
The bias current value.
Function Usage
/* Scenario: Save the factory current value before changing it. */
factoryCurrent = Cy_CTB_DSAB_GetCurrent(CTBM0);