MTB CAT1 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...
 
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...
 
bool Cy_SysPm_LdoIsEnabled (void)
 Reads the current status of the core LDO regulator. More...
 
void Cy_SysPm_SdrConfigure (cy_en_syspm_sdr_t sdr, cy_stc_syspm_sdr_params_t *config)
 Configures the SDR(Step Down Regulator) More...
 
void Cy_SysPm_SdrSetVoltage (cy_en_syspm_sdr_t sdr, cy_en_syspm_sdr_voltage_t voltage)
 Set the SDR(Step Down Regulator) Voltage. More...
 
cy_en_syspm_sdr_voltage_t Cy_SysPm_SdrGetVoltage (cy_en_syspm_sdr_t sdr)
 Get the SDR(Step Down Regulator) Voltage. More...
 
void Cy_SysPm_SdrEnable (cy_en_syspm_sdr_t sdr, bool enable)
 Enable the SDR(Step Down Regulator) More...
 
bool Cy_SysPm_IsSdrEnabled (cy_en_syspm_sdr_t sdr)
 Checks if SDR(Step Down Regulator) is enabled or not. More...
 
void Cy_SysPm_HvLdoConfigure (cy_stc_syspm_hvldo_params_t *config)
 Configures the HVLDO Regulator. More...
 
void Cy_SysPm_HvLdoSetVoltage (cy_en_syspm_hvldo_voltage_t voltage)
 Set the HVLDO Regulator Voltage. More...
 
cy_en_syspm_hvldo_voltage_t Cy_SysPm_HvLdoGetVoltage (void)
 Get the HVLDO Regulator Voltage. More...
 
void Cy_SysPm_HvLdoEnable (bool enable)
 Enable the HVLDO Regulator. More...
 
bool Cy_SysPm_IsHvLdoEnabled (void)
 Checks if HVLDO Regulator is enabled or not. 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.
Note
This API is available for CAT1A, CAT1B(PSoC C3) devices.
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.
*/
{
if (CY_SYSPM_LDO_VOLTAGE_ULP == Cy_SysPm_LdoGetVoltage())
{
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

◆ Cy_SysPm_LdoIsEnabled()

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.
*/
{
if (CY_SYSPM_LDO_VOLTAGE_ULP == Cy_SysPm_LdoGetVoltage())
{
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_SdrConfigure()

void Cy_SysPm_SdrConfigure ( cy_en_syspm_sdr_t  sdr,
cy_stc_syspm_sdr_params_t config 
)

Configures the SDR(Step Down Regulator)

Note
The CBUCK voltage selection must be 60mV higher than the SDR output or the regulator output may bypass.
Parameters
sdrCY_SYSPM_SDR_0 - for SDR0 CY_SYSPM_SDR_1 - for SDR1
configStructure containing the config parameters, cy_stc_syspm_sdr_params_t
Note
Maintain below conditions when switching th voltages High to Low voltage –> Set TRIM's first , Set Voltage next Low to High voltage –> Set Voltage first , Set TRIM's next
This API is available for CAT1B devices.

◆ Cy_SysPm_SdrSetVoltage()

void Cy_SysPm_SdrSetVoltage ( cy_en_syspm_sdr_t  sdr,
cy_en_syspm_sdr_voltage_t  voltage 
)

Set the SDR(Step Down Regulator) Voltage.

Note
The CBUCK voltage selection must be 60mV higher than the SDR output or the regulator output may bypass.
Parameters
sdrCY_SYSPM_SDR_0 - for SDR0 CY_SYSPM_SDR_1 - for SDR1
voltagePick from cy_en_syspm_sdr_voltage_t
Note
Maintain below conditions when switching th voltages High to Low voltage –> Set TRIM's first , Set Voltage next Low to High voltage –> Set Voltage first , Set TRIM's next
This API is available for CAT1B devices.

◆ Cy_SysPm_SdrGetVoltage()

cy_en_syspm_sdr_voltage_t Cy_SysPm_SdrGetVoltage ( cy_en_syspm_sdr_t  sdr)

Get the SDR(Step Down Regulator) Voltage.

Parameters
sdrCY_SYSPM_SDR_0 - for SDR0 CY_SYSPM_SDR_1 - for SDR1
Returns
Gets Voltage enum value of type cy_en_syspm_sdr_t
Note
This API is available for CAT1B devices.

◆ Cy_SysPm_SdrEnable()

void Cy_SysPm_SdrEnable ( cy_en_syspm_sdr_t  sdr,
bool  enable 
)

Enable the SDR(Step Down Regulator)

Note
Applicable for only SDR1, whereas SDR0 is always enabled.
Parameters
sdrCY_SYSPM_SDR_0 - for SDR0 CY_SYSPM_SDR_1 - for SDR1
enabletrue - enable, false - disable
Note
This function is available for CAT1B devices.

◆ Cy_SysPm_IsSdrEnabled()

bool Cy_SysPm_IsSdrEnabled ( cy_en_syspm_sdr_t  sdr)

Checks if SDR(Step Down Regulator) is enabled or not.

Parameters
sdrCY_SYSPM_SDR_0 - for SDR0 CY_SYSPM_SDR_1 - for SDR1
Returns
True if enabled, False if disabled.
Note
This function is available for CAT1B devices.

◆ Cy_SysPm_HvLdoConfigure()

void Cy_SysPm_HvLdoConfigure ( cy_stc_syspm_hvldo_params_t config)

Configures the HVLDO Regulator.

Parameters
configStructure containing the config parameters, cy_stc_syspm_hvldo_params_t
Note
This function is available for CAT1B devices.

◆ Cy_SysPm_HvLdoSetVoltage()

void Cy_SysPm_HvLdoSetVoltage ( cy_en_syspm_hvldo_voltage_t  voltage)

Set the HVLDO Regulator Voltage.

Parameters
voltagePick from cy_en_syspm_hvldo_voltage_t
Note
This function is available for CAT1B devices.

◆ Cy_SysPm_HvLdoGetVoltage()

cy_en_syspm_hvldo_voltage_t Cy_SysPm_HvLdoGetVoltage ( void  )

Get the HVLDO Regulator Voltage.

Returns
Gets Voltage enum value of type cy_en_syspm_hvldo_voltage_t
Note
This function is available for CAT1B devices.

◆ Cy_SysPm_HvLdoEnable()

void Cy_SysPm_HvLdoEnable ( bool  enable)

Enable the HVLDO Regulator.

Parameters
enabletrue - enable, false - disable
Note
This parameter is available for CAT1B devices.

◆ Cy_SysPm_IsHvLdoEnabled()

bool Cy_SysPm_IsHvLdoEnabled ( void  )

Checks if HVLDO Regulator is enabled or not.

Returns
True if enabled, False if disabled.
Note
This parameter is available for CAT1B devices.