# Reference Current Mode Functions¶

group group_ctb_functions_aref

This set of functions impacts all opamps on the chip.

Notice how some of these functions do not take a base address input. When calling Cy_CTB_SetCurrentMode for a CTB instance on the device, it should be called for all other CTB instances as well. This is because there is only one IPTAT level (1 uA or 100 nA) chip wide.

Functions

void Cy_CTB_SetCurrentMode(CTBM_Type *base, cy_en_ctb_current_mode_t currentMode)

High level function to configure the current modes of the opamps.

This function configures all opamps of the CTB to the same current mode. These modes are differentiated by the reference current level, the opamp input range, and the Deep Sleep mode operation.

• The reference current level is set using Cy_CTB_SetIptatLevel

• When 1 uA current level is used in Deep Sleep,

• All generators in the AREF must be enabled in Deep Sleep. That is, Cy_SysAnalog_SetDeepSleepMode is called with CY_SYSANALOG_DEEPSLEEP_IPTAT_IZTAT_VREF.

• When 100 nA current level is used,

• Cy_CTB_EnableRedirect is called to route the AREF IPTAT reference to the opamp IZTAT and disable the opamps IPTAT.

• The IPTAT generator is enabled in Deep Sleep. That is, Cy_SysAnalog_SetDeepSleepMode is called with CY_SYSANALOG_DEEPSLEEP_IPTAT_2 unless it is already configured for CY_SYSANALOG_DEEPSLEEP_IPTAT_IZTAT_VREF.

note

The IPTAT level is a chip wide configuration so multiple opamps cannot operate at different IPTAT levels. When calling Cy_CTB_SetCurrentMode for a CTB instance on the device, it should be called for all other CTB instances as well.

 Current Mode IPTAT Level Input Range Deep Sleep Operation 1 uA Rail-to-Rail (charge pump enabled) Disabled in Deep Sleep 1 uA 0 - VDDA-1.5 V (charge pump disabled) Enabled in Deep Sleep 100 nA 0 - VDDA-1.5 V (charge pump disabled) Enabled in Deep Sleep

note

The output range of the opamp is 0.2 V to VDDA - 0.2 V (depending on output load).

    /* Scenario: Configure all CTBs on the device to use a 1 uA IPTAT reference.
* Enable the charge pump and disable Deep Sleep operation for both opamps in the specified CTB block. */

Cy_CTB_SetCurrentMode(CTBM0, CY_CTB_CURRENT_HIGH_ACTIVE);

Function Usage

Parameters
• base – Pointer to structure describing registers

• currentMode – Current mode selection

Returns

None

__STATIC_INLINE void Cy_CTB_SetIptatLevel (cy_en_ctb_iptat_t iptat)

Set the IPTAT reference level to 1 uA or 100 nA.

The IPTAT generator is used by the CTB for slope offset drift.

    /* Scenario: Configure all CTBs on the device to use a 100 nA IPTAT reference
* for ultra low power. In order for the opamps to function with a 100 nA
* IPTAT reference, Cy_CTB_EnableRedirect() must be called.
*
* This is a low level function that only configures the IPTAT reference level.
* The preferred method is the Cy_CTB_SetCurrentMode() as it is a high
* level function that configures both the IPTAT reference and the current
* redirection. */

Cy_CTB_SetIptatLevel(CY_CTB_IPTAT_LOW);

Function Usage

Parameters

iptat – Value from enum cy_en_ctb_iptat_t

Returns

None

__STATIC_INLINE void Cy_CTB_SetPumpClkSource (PASS_Type *base, cy_en_ctb_clk_pump_source_t pumpClk)

Set the clock source for both charge pumps in the CTB.

Recall that each opamp has its own charge pump. The clock can come from:

Function Usage

    /* Scenario: Use a 24 Mhz clock from the SRSS for the charge pump clock. */

/* Set the source to clock Path 0, which has been configured for 100 MHz FLL. */
Cy_SysClk_ClkPumpSetSource(CY_SYSCLK_PUMP_IN_CLKPATH0);

/* Divide the 100 Mhz by 4. */
Cy_SysClk_ClkPumpSetDivider(CY_SYSCLK_PUMP_DIV_4);
Cy_SysClk_ClkPumpEnable();

/* Select the source for the pump clock to be from the SRSS. */

    /* Scenario: Use a 25 Mhz clock from the PeriClk dividers for the charge pump clock. */
uint32_t dividerNum = 1UL;
uint32_t dividerValue = 1UL;

/* Use the 8-bit divider type and divider number 1 from the PeriClk, which has been configured for 50 MHz. */
Cy_SysClk_PeriphAssignDivider(PCLK_PASS_CLOCK_PUMP_PERI, CY_SYSCLK_DIV_8_BIT, dividerNum);

/* Divide the 50 MHz PeriClk by 2 (dividerValue + 1). */
Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, dividerNum, dividerValue);
Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, dividerNum);

/* Select the source for the pump clock to be from the PeriClk dividers. */
Cy_CTB_SetPumpClkSource(PASS, CY_CTB_CLK_PUMP_PERI);

    /* Scenario: Use a 2 Mhz MF clock for the charge pump clock. */
Cy_SysClk_MfoEnable(true);
Cy_SysClk_ClkMfSetDivider(1UL);
Cy_SysClk_ClkMfEnable();
Cy_CTB_SetPumpClkSource(PASS, CY_CTB_CLK_PUMP_DEEPSLEEP);


Parameters
• base – Pointer to the PASS register structure.

• pumpClk – Clock source selection (PumpClk, PeriClk or Deep Sleep Clock) for the pump. Select a value from cy_en_ctb_clk_pump_source_t

Returns

None

__STATIC_INLINE void Cy_CTB_EnableRedirect (void)

Normally, the AREF IZTAT is routed to the CTB IZTAT and the AREF IPTAT is routed to the CTB IPTAT:

• CTB.IZTAT = AREF.IZTAT

• CTB.IPTAT = AREF.IPTAT

However, the AREF IPTAT can be redirected to the CTB IZTAT and the CTB IPTAT is off.

• CTB.IZTAT = AREF.IPTAT

• CTB.IPTAT = HiZ

The redirection applies to all opamps on the device and should be used when the IPTAT bias level is set to 100 nA (see Cy_CTB_SetIptatLevel).

When the CTB.IPTAT is HiZ, the CTB cannot compensate for the slope of the offset across temperature.

    /* Scenario: All CTBs on the device have been configured to use
* a 100 nA IPTAT reference. Redirect the AREF IPTAT current to the CTB IZTAT
* for proper functionality.
*
* This is a low level function that only enables the current redirection.
* The preferred method is the Cy_CTB_SetCurrentMode() as it is a high
* level function that configures both the current redirection and the
* IPTAT reference. */

Cy_CTB_EnableRedirect();

Function Usage

Returns

None

__STATIC_INLINE void Cy_CTB_DisableRedirect (void)

Disable the redirection of the AREF IPTAT to the CTB IZTAT for all opamps on the device as enabled by Cy_CTB_EnableRedirect.

Returns

None