PSoC 6 Peripheral Driver Library

General Description

Functions

cy_en_syspm_status_t Cy_SysPm_LdoSetVoltage (cy_en_syspm_ldo_voltage_t voltage)
 Set output voltage on the core LDO regulator. More...
 
__STATIC_INLINE cy_en_syspm_ldo_voltage_t Cy_SysPm_LdoGetVoltage (void)
 Gets the current output voltage value of the core LDO regulator. More...
 
__STATIC_INLINE bool Cy_SysPm_LdoIsEnabled (void)
 Reads the current status of the core LDO regulator. More...
 
cy_en_syspm_status_t Cy_SysPm_LdoSetMode (cy_en_syspm_ldo_mode_t mode)
 Configures the core LDO regulator operating mode to one of three modes. More...
 
cy_en_syspm_ldo_mode_t Cy_SysPm_LdoGetMode (void)
 Returns the current core LDO regulator operating mode. More...
 

Function Documentation

◆ Cy_SysPm_LdoSetVoltage()

cy_en_syspm_status_t Cy_SysPm_LdoSetVoltage ( cy_en_syspm_ldo_voltage_t  voltage)

Set output voltage on the core LDO regulator.

When changing from a higher voltage to a lower voltage as when the device enters system ULP mode, 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 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), calling the Cy_SysLib_SetWaitStates(false, hfClkFreqMz) function to set the wait states is optional, but can be done to improve performance. The clock frequency may now be increased up to LP Limitations.

Note
1. The output is set to 0.9 V (nominal) - the system is in ULP mode and flash works for read-only operation.
2. The output is set to 1.1 V (nominal) - the system is in LP mode and flash works for read and write operations.
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.

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.

Parameters
voltageThe desired output regulator voltage. See cy_en_syspm_ldo_voltage_t voltage
Returns
  • 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 */
/* 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.
*/
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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
*/
}
}
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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_SysPm_LdoGetVoltage()

__STATIC_INLINE cy_en_syspm_ldo_voltage_t Cy_SysPm_LdoGetVoltage ( void  )

Gets the current output voltage value of the core LDO regulator.

Note
The actual device Vccd voltage can be different from the nominal voltage because the actual voltage value depends on conditions including the load current.
Returns
The nominal output voltage of the LDO. See cy_en_syspm_ldo_voltage_t.
Function Usage
/* Scenario: There is a need to increase the core supply voltage */
/* 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.
*/
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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
*/
}
}
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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_SysPm_LdoIsEnabled()

__STATIC_INLINE bool Cy_SysPm_LdoIsEnabled ( void  )

Reads the current status of the core LDO regulator.

Returns
  • True means the LDO is enabled.
  • False means it is disabled.
Function Usage
/* Scenario: There is a need to increase the core supply voltage */
/* 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.
*/
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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
*/
}
}
{
{
uint32_t triesToSetVoltage = 5u;
do
{
/* Call the function until the operation is finished */
--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_SysPm_LdoSetMode()

cy_en_syspm_status_t Cy_SysPm_LdoSetMode ( cy_en_syspm_ldo_mode_t  mode)

Configures the core LDO regulator operating mode to one of three modes.

Disabled - turns off the LDO regulator and should be selected only after the Buck regulator is operating. Normal mode configures the LDO for operation at the maximum output current limit. Minimal current mode optimizes the LDO at a reduced output current limit. Specific device current limits can be found in the device datasheet.

Parameters
modeThe desired LDO regulator operating mode. See cy_en_syspm_ldo_mode_t mode
Returns
  • CY_SYSPM_SUCCESS - Requested regulator current mode was set
  • CY_SYSPM_CANCELED - The power circuits were not ready to enter into minimum current mode. You should try to call the function again
  • CY_SYSPM_TIMEOUT - Timeout occurred because of active reference was not ready to enter into the normal regulator current mode
  • CY_SYSPM_FAIL - incorrect mode value was passed 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.
Side Effects
For PSoC 64 series devices CY_SYSPM_LDO_MODE_DISABLED mode is not supported. Use Cy_SysPm_BuckEnable() instead.

◆ Cy_SysPm_LdoGetMode()

cy_en_syspm_ldo_mode_t Cy_SysPm_LdoGetMode ( void  )

Returns the current core LDO regulator operating mode.

Returns
The LDO regulator operating mode. See cy_en_syspm_ldo_mode_t mode