Offset and Slope Trim Functions

group group_ctb_functions_trim

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.

Functions

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

Override 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

    /* 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. */
    }
Function Usage

Parameters
Returns

None

uint32_t Cy_CTB_OpampGetOffset(const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)

Return the current CTB opamp offset trim value.

    /* Scenario: Save the factory offset trim before changing it. */
    uint32_t factoryOffset;
    factoryOffset = Cy_CTB_OpampGetOffset(CTBM0, CY_CTB_OPAMP_0);
Function Usage

Parameters
Returns

Offset trim value

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

Override the CTB opamp slope factory trim.

The offset of the opamp will vary across 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

    /* 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. */
    }
Function Usage

Parameters
Returns

None

uint32_t Cy_CTB_OpampGetSlope(const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)

Return the CTB opamp slope trim value.

    /* Scenario: Save the factory slope trim before changing it. */
    uint32_t factorySlope;
    factorySlope = Cy_CTB_OpampGetSlope(CTBM0, CY_CTB_OPAMP_0);
Function Usage

Parameters
Returns

Slope trim value