Buck

group group_syspm_functions_buck

Functions

cy_en_syspm_status_t Cy_SysPm_BuckEnable(cy_en_syspm_buck_voltage1_t voltage)

Switch the core supply regulator to Buck core regulator instead of the LDO regulator.

The Buck core regulator provides output voltage(s) using one external inductor and can supply Vccd with higher efficiency than the LDO under some conditions, such as high external supply voltage.

Before changing from LDO to Buck, ensure that the circuit board has connected Vccbuck1 to Vccd and also populated the necessary external components for the Buck regulator, including an inductor and a capacitor for each output. Refer to the device TRM for more detail.

When changing from a higher voltage to a lower voltage (from system LP = LDO 1.1 V (nominal) to system ULP = Buck 0.9 V (nominal)), ensure that:

  • The device maximum operating frequency for all the Clk_HF paths, peripheral, and slow clock are under the ULP Limitations.

  • The total current consumption is under the ULP Limitations.

  • The appropriate wait states values are set for the flash using the Cy_SysLib_SetWaitStates() function as explained below.

Setting wait states values for flash

The flash access time when the core output voltage is 0.9 V (nominal) is longer than at 1.1 V (nominal). Therefore, the number of the wait states must be adjusted. Use the Cy_SysLib_SetWaitStates() function to set the appropriate wait state values for flash.

To change from a higher voltage (LDO 1.1 V) to a lower voltage (Buck 0.9 V), call the Cy_SysLib_SetWaitStates(true, hfClkFreqMz) function before changing the voltage, where hfClkFreqMz is the frequency of HfClk0 in MHz.

To change from a lower voltage (LDO 0.9 V (nominal) to a higher voltage (Buck 1.1 V (nominal)), call the Cy_SysLib_SetWaitStates(false, hfClkFreqMz) function to set the wait states after the voltage change. It is optional, but can be done to improve performance. The clock frequency may now be increased up to system LP mode limits for the new voltage.

note

1. If the final Buck output is set to 0.9 V (nominal) - the system is in ULP mode and flash allows read-only operations.

note

2. If the final Buck output is set to 1.1 V (nominal) - the system is in LP mode flash allows the read and write operations.

note

3. The actual device Vccd voltage can be different from the nominal voltage because the actual voltage value depends on conditions including the load current.

warning

There is no safe way to go back to the LDO after the Buck regulator supplies a core. The function enabling the Buck regulator switches off the LDO.

warning

Buck converter requires additional external components populated on dedicated pins. Refer to device datasheet for details.

For more detail, refer to the

Switching the System into Ultra Low Power and Switching the System into Low Power sections. Refer to the SysLib (System Library) driver for more detail about setting wait states.

note

The function is applicable only for devices with a Buck regulator.

Function uses a critical section to prevent interrupting the regulators switch.

Return

  • CY_SYSPM_SUCCESS - The voltage is set as requested. (There is no change if the new voltage is the same as the previous voltage.)

  • CY_SYSPM_INVALID_STATE - The voltage was not set. The voltage cannot be set because the protection context value is higher than zero (PC > 0) or the device revision does not support modifying registers via syscall.

  • CY_SYSPM_CANCELED - Operation was canceled. Call the function again until the function returns CY_SYSPM_SUCCESS. See cy_en_syspm_status_t. For the PSoC 64 devices there are possible situations when function returns the PRA error status code. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to cy_en_pra_status_t for more details.

Parameters

Function Usage

    /* Scenario: There is a need to switch the power supply regulator to Buck regulator */
    cy_en_syspm_status_t retVal;

    uint32_t triesToSetVoltage = 10u;
    
    /* Need to parse the error value. The function can return two types of error.
    *  CY_SYSPM_INVALID_STATE - The operation cannot be executed, because  
    *  the application runs in protection context higher than zero (PC > 0),  
    *  or device revision does not support modifying registers via syscall.
    *  CY_SYSPM_CANCELED - The operation was canceled, and you need to 
    *  call the function again to successfully finish the operation. 
    */ 
    do
    {
        /* Call the function until the operation is finished */
        retVal = Cy_SysPm_BuckEnable(CY_SYSPM_BUCK_OUT1_VOLTAGE_ULP);
        --triesToSetVoltage;
    } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
    
    if (triesToSetVoltage == 0)
    {
        /* The operation was not performed */
    }

cy_en_syspm_status_t Cy_SysPm_BuckSetVoltage1(cy_en_syspm_buck_voltage1_t voltage)

Sets the output 1 voltage for the Buck regulator that can supply the device core.

This output can supply the device core instead of the LDO regulator.

When changing from a higher voltage 1.1 V (nominal) to a lower voltage 0.9 V (nominal), ensure that:

  • The device maximum operating frequency for all the Clk_HF paths, peripheral, and slow clock are under the ULP Limitations.

  • The total current consumption is under the ULP Limitations.

  • The appropriate wait states values are set for the flash using the Cy_SysLib_SetWaitStates() function as explained below.

Setting wait states values for flash

The flash access time when the core output voltage is 0.9 V (nominal) is longer than at 1.1 V (nominal). Therefore, the number of the wait states must be adjusted. Use the Cy_SysLib_SetWaitStates() function to set the appropriate wait state values for flash.

To change from a higher voltage to a lower voltage 0.9 V (nominal), call the Cy_SysLib_SetWaitStates(true, hfClkFreqMz) function before changing the voltage, where hfClkFreqMz is the frequency of HfClk0 in MHz.

To change from a lower voltage to a higher voltage 1.1 V (nominal), call the Cy_SysLib_SetWaitStates(false, hfClkFreqMz) function to set the wait states. It is optional, but can be done to improve the performance. The clock frequency may now be increased up to LP Limitations for a new voltage.

note

1. The output is set to 0.9 V (nominal) - the system is in ULP mode flash allows read-only operations.

note

2. The output is set to 1.1 V (nominal) - the system is in LP mode and flash allows the read and write operations.

note

3. The actual device Vccd voltage can be different from the nominal voltage because the actual voltage value depends on the conditions including the load current.

warning

Buck converter requires additional external components populated on dedicated pins. Refer to device datasheet for details.

For more detail, refer to the

Switching the System into Ultra Low Power and Switching the System into Low Power sections. Refer to the SysLib (System Library) driver for more detail about setting the wait states.

Return

  • CY_SYSPM_SUCCESS - The voltage is set.

  • CY_SYSPM_INVALID_STATE - The voltage was not set. The voltage cannot be set because the protection context value is higher than zero (PC > 0) or the device revision does not support modifying registers via syscall.

  • CY_SYSPM_CANCELED - Operation was canceled. Call the function again until the function returns CY_SYSPM_SUCCESS. See cy_en_syspm_status_t. For the PSoC 64 devices there are possible situations when function returns the PRA error status code. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to cy_en_pra_status_t for more details.

Function Usage

    /* Scenario: There is a need to increase the core supply voltage  */
    cy_en_syspm_status_t retVal;

    /* Need to parse the error value for Cy_SysPm_LdoSetVoltage and 
    *  Cy_SysPm_BuckSetVoltage1 functions. The functions can return two types
    *  of error:
    *  CY_SYSPM_INVALID_STATE - The operation cannot be executed, because  
    *  the application runs in protection context higher than zero (PC > 0),  
    *  or device revision does not support modifying registers via syscall.
    *  CY_SYSPM_CANCELED - The operation was canceled, and you need to 
    *  call the function again to successfully finish the operation. 
    */ 

    if (Cy_SysPm_LdoIsEnabled())
    {
        if (CY_SYSPM_LDO_VOLTAGE_ULP == Cy_SysPm_LdoGetVoltage())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_LdoSetVoltage(CY_SYSPM_LDO_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }
            
            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the core frequency in MHz
             */
        }
    }
    else if (Cy_SysPm_BuckIsEnabled())
    {
        if (CY_SYSPM_BUCK_OUT1_VOLTAGE_ULP == Cy_SysPm_BuckGetVoltage1())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_BuckSetVoltage1(CY_SYSPM_BUCK_OUT1_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }

            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the CPU frequency in MHz
             */
        }
    }

Side Effects

For PSoC 64 series devices Cy_SysPm_BuckSetVoltage1() has the same functional behavior as Cy_SysPm_BuckEnable() function.

Parameters

void Cy_SysPm_BuckSetVoltage2(cy_en_syspm_buck_voltage2_t voltage, bool waitToSettle)

This function sets output voltage 2 (Vbuckrf) of the SIMO Buck regulator.

warning

You must enable the delay (waitToSettle = true) while changing from a lower voltage to a higher voltage.

note

The 200 us delay is required only when changing from a lower voltage to a higher voltage. When changing from a higher voltage to a lower one, the delay is not required.

warning

The function works only on devices with the SIMO Buck regulator. Refer to the device datasheet for information on whether the device contains SIMO Buck.

warning

Buck converter requires additional external components populated on dedicated pins. Refer to device datasheet for details.

Function Usage

    /* Scenario: There is a need to set the SIMO Buck output 2 voltage to 1.35 V */
    Cy_SysPm_BuckSetVoltage2(CY_SYSPM_BUCK_OUT2_VOLTAGE_1_35V, true);

Parameters
  • voltage: The voltage of the Buck regulator output 2 (Vbuckrf). See cy_en_syspm_buck_voltage2_t.

  • waitToSettle:

    • True to enable the 200 us delay after setting a higher voltage.

    • False to disable the 200 us delay after setting a higher voltage.

void Cy_SysPm_BuckEnableVoltage2(void)

Enable the output 2 voltage (Vbuckrf) of the SIMO Buck regulator.

The output 2 voltage (Vbuckrf) of the Buck regulator is typically used to supply the BLE radio. This function does following actions, when the Buck regulator does not supply the core:

  • Enables the Buck regulator

  • Enables the output 2, but do not enables the output 1.

note

The function does not affect Buck output 1 that typically supplies core.

warning

The function does not select the Buck output 2 voltage and does not set/clear the HW-controlled bit for Buck output 2. Call Cy_SysPm_BuckSetVoltage2() or Cy_SysPm_BuckSetVoltage2HwControl() to configure the Buck output 2.

warning

The function works only on devices with the SIMO Buck regulator. Refer to the device datasheet for information on whether the device contains the SIMO Buck.

warning

Buck converter requires additional external components populated on dedicated pins. Refer to device datasheet for details.

Function Usage

    /* Scenario: There is a need to enable the SIMO Buck output 2 */
    Cy_SysPm_BuckEnableVoltage2();

bool Cy_SysPm_BuckIsOutputEnabled(cy_en_syspm_buck_out_t output)

This function gets the current output status of the Buck outputs.

Return

  • True if the requested output is enabled.

  • False if the requested output is disabled.

Function Usage

    /* Scenario: There is a need to check the status of the SIMO Buck output 2 (Vbuckrf) */
    if (Cy_SysPm_BuckIsOutputEnabled(CY_SYSPM_BUCK_VRF))
    {
        /* The SIMO Buck output 2 is enabled */
    }

Parameters

bool Cy_SysPm_BuckIsEnabled(void)

Get the current status of the Buck regulator.

Return

  • True if the Buck regulator is enabled.

  • False if it is disabled.

Function Usage

    /* Scenario: There is a need to increase the core supply voltage  */
    cy_en_syspm_status_t retVal;

    /* Need to parse the error value for Cy_SysPm_LdoSetVoltage and 
    *  Cy_SysPm_BuckSetVoltage1 functions. The functions can return two types
    *  of error:
    *  CY_SYSPM_INVALID_STATE - The operation cannot be executed, because  
    *  the application runs in protection context higher than zero (PC > 0),  
    *  or device revision does not support modifying registers via syscall.
    *  CY_SYSPM_CANCELED - The operation was canceled, and you need to 
    *  call the function again to successfully finish the operation. 
    */ 

    if (Cy_SysPm_LdoIsEnabled())
    {
        if (CY_SYSPM_LDO_VOLTAGE_ULP == Cy_SysPm_LdoGetVoltage())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_LdoSetVoltage(CY_SYSPM_LDO_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }
            
            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the core frequency in MHz
             */
        }
    }
    else if (Cy_SysPm_BuckIsEnabled())
    {
        if (CY_SYSPM_BUCK_OUT1_VOLTAGE_ULP == Cy_SysPm_BuckGetVoltage1())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_BuckSetVoltage1(CY_SYSPM_BUCK_OUT1_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }

            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the CPU frequency in MHz
             */
        }
    }

cy_en_syspm_buck_voltage1_t Cy_SysPm_BuckGetVoltage1(void)

Gets the current nominal output 1 voltage (Vccbuck1) of the Buck regulator.

note

The actual device output 1 voltage (Vccbuck1) can be different from the nominal voltage because the actual voltage value depends on conditions including load current.

note

CAT1B devices, function always returns 0.

Return

The nominal output voltage 1 (Vccbuck1) of the Buck regulator. See cy_en_syspm_buck_voltage1_t.

Function Usage

    /* Scenario: There is a need to increase the core supply voltage  */
    cy_en_syspm_status_t retVal;

    /* Need to parse the error value for Cy_SysPm_LdoSetVoltage and 
    *  Cy_SysPm_BuckSetVoltage1 functions. The functions can return two types
    *  of error:
    *  CY_SYSPM_INVALID_STATE - The operation cannot be executed, because  
    *  the application runs in protection context higher than zero (PC > 0),  
    *  or device revision does not support modifying registers via syscall.
    *  CY_SYSPM_CANCELED - The operation was canceled, and you need to 
    *  call the function again to successfully finish the operation. 
    */ 

    if (Cy_SysPm_LdoIsEnabled())
    {
        if (CY_SYSPM_LDO_VOLTAGE_ULP == Cy_SysPm_LdoGetVoltage())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_LdoSetVoltage(CY_SYSPM_LDO_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }
            
            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the core frequency in MHz
             */
        }
    }
    else if (Cy_SysPm_BuckIsEnabled())
    {
        if (CY_SYSPM_BUCK_OUT1_VOLTAGE_ULP == Cy_SysPm_BuckGetVoltage1())
        {
            uint32_t triesToSetVoltage = 5u;
            
            do
            {
                /* Call the function until the operation is finished */
                retVal = Cy_SysPm_BuckSetVoltage1(CY_SYSPM_BUCK_OUT1_VOLTAGE_1_1V);
                --triesToSetVoltage;
            } while ((CY_SYSPM_SUCCESS != retVal) && (triesToSetVoltage != 0));
            
            if (0U == triesToSetVoltage)
            {
                /* The operation was not performed */
            }

            /* Call Cy_SysLib_SetWaitStates(false, clkMHz);
             * where clkMHz is the CPU frequency in MHz
             */
        }
    }

cy_en_syspm_buck_voltage2_t Cy_SysPm_BuckGetVoltage2(void)

Gets the current output 2 nominal voltage (Vbuckrf) of the SIMO Buck regulator.

note

The actual device output 2 voltage (Vbuckrf) can be different from the nominal voltage because the actual voltage value depends on conditions including load current.

note

Function returns zero for devices without a SIMO Buck regulator. Refer to the device datasheet about information on whether device contains a SIMO Buck.

Return

The nominal output voltage of the Buck SIMO regulator output 2 voltage (Vbuckrf). See cy_en_syspm_buck_voltage2_t.

Function Usage

    /* Scenario: There is a need to get the nominal output 2 voltage of the SIMO Buck regulator */
    cy_en_syspm_simo_buck_voltage2_t voltage = Cy_SysPm_BuckGetVoltage2();

void Cy_SysPm_BuckDisableVoltage2(void)

Disables the output 2 voltage (Vbuckrf) of the SIMO Buck regulator.

The output 2 voltage (Vbuckrf) of the Buck regulator is typically used to supply the BLE radio.

note

The function does not have effect, if the Buck regulator is switched off.

note

If you are switching the voltage supply source for BLE radio, ensure that the new voltage supply for the BLE HW block is settled and is stable before calling the Cy_SysPm_BuckDisableVoltage2() function.

This function is applicable for devices with the SIMO Buck regulator. Refer to the device datasheet for information about whether the device contains a SIMO Buck.

Function Usage

    /* Scenario: There is a need to disable the output 2 voltage of the SIMO Buck regulator */
    Cy_SysPm_BuckDisableVoltage2();

void Cy_SysPm_BuckSetVoltage2HwControl(bool hwControl)

Sets the hardware control for SIMO Buck output 2 (Vbuckrf).

When hardware control is enabled for the Vbuckrf output, the firmware controlled enable register setting is ignored and the hardware signal is used instead. If the product has supporting hardware like BLE radio, it can directly control the enable signal for Vbuckrf.

Function does not have an effect if SIMO Buck regulator is disabled.

Parameters
  • hwControl: Enables/disables hardware control for the SIMO Buck output 2.

The function is applicable for devices with the SIMO Buck regulator. Refer to the device datasheet for information about whether the device contains a SIMO Buck.

Function Usage

    /* Scenario: There is a need to enable the hardware control for the SIMO Buck output 2 */
    Cy_SysPm_BuckSetVoltage2HwControl(true);
    
    /* Scenario: There is a need to disable the hardware control for the SIMO Buck output 2 */
    Cy_SysPm_BuckSetVoltage2HwControl(false);

bool Cy_SysPm_BuckIsVoltage2HwControlled(void)

Returns the hardware control state for Buck output 2 (Vbuckrf).

When hardware control is enabled for the Vbuckrf output, the firmware controlled enable register setting is ignored and the hardware signal is used instead. If the product has supporting hardware like BLE radio, it can directly control the enable signal for Vbuckrf.

The function is applicable for devices with the SIMO Buck regulator. Refer to device datasheet about information if device contains SIMO Buck.

Return

  • True if HW control is set.

  • False if FW control is set for the Buck output 2.

Function Usage

    /* Scenario: There is a need to check if the hardware control for 
    *  Buck output 2 (Vbuckrf) is enabled
    */
    if (Cy_SysPm_BuckIsVoltage2HwControlled())
    {
        /* The hardware control for Vbuckrf is enabled */
    }