MTB CAT1 Peripheral driver library

General Description

Functions

void Cy_SysClk_PiloEnable (void)
 Enables the PILO. More...
 
bool Cy_SysClk_PiloIsEnabled (void)
 Reports the Enabled/Disabled status of the PILO. More...
 
void Cy_SysClk_PiloDisable (void)
 Disables the PILO. More...
 
void Cy_SysClk_PiloSetTrim (uint32_t trimVal)
 Sets the PILO trim bits, which adjusts the PILO frequency. More...
 
uint32_t Cy_SysClk_PiloGetTrim (void)
 Reports the current PILO trim bits value. More...
 
void Cy_SysClk_PiloBackupEnable (void)
 Enables the PILO as always on if Backup Domain is present. More...
 
void Cy_SysClk_PiloBackupDisable (void)
 Disables the PILO as always on if Backup Domain is present. More...
 
bool Cy_SysClk_PiloOkay (void)
 Reports the status of the PILO. More...
 
void Cy_SysClk_PiloTcscEnable (void)
 Enables the PILO TCSC(Second order temperature curvature correction) Feature. More...
 
void Cy_SysClk_PiloTcscDisable (void)
 Disables the PILO TCSC(Second order temperature curvature correction) Feature. More...
 

Function Documentation

◆ Cy_SysClk_PiloEnable()

void Cy_SysClk_PiloEnable ( void  )

Enables the PILO.

Note
This function blocks for 1 millisecond between enabling the PILO and releasing the PILO reset.
Function Usage
/* Scenario: PILO needs to source the LFCLK. All peripherals clocked by
the LFCLK are disabled and the Watchdog timer (WDT) is unlocked. */
/* Enable the PILO. Note: Blocks for 1 millisecond. */
/* Set the LFCLK source to the PILO */

◆ Cy_SysClk_PiloIsEnabled()

bool Cy_SysClk_PiloIsEnabled ( void  )

Reports the Enabled/Disabled status of the PILO.

Returns
Boolean status of PILO: true - Enabled, false - Disabled.
Function Usage
/* Scenario: LFCLK needs to be sourced by the ILO instead of the PILO. All
peripherals clocked by the LFCLK are disabled and the Watchdog
timer (WDT) is unlocked. */
{
/* Disable the PILO */
/* Enable the ILO */
#if (defined (CY_IP_MXS40SRSS) && (CY_IP_MXS40SRSS_VERSION < 2))
#endif
/* Set the LFCLK source to the ILO */
}

◆ Cy_SysClk_PiloDisable()

void Cy_SysClk_PiloDisable ( void  )

Disables the PILO.

Function Usage
/* Scenario: LFCLK needs to be sourced by the ILO instead of the PILO. All
peripherals clocked by the LFCLK are disabled and the Watchdog
timer (WDT) is unlocked. */
{
/* Disable the PILO */
/* Enable the ILO */
#if (defined (CY_IP_MXS40SRSS) && (CY_IP_MXS40SRSS_VERSION < 2))
#endif
/* Set the LFCLK source to the ILO */
}

◆ Cy_SysClk_PiloSetTrim()

void Cy_SysClk_PiloSetTrim ( uint32_t  trimVal)

Sets the PILO trim bits, which adjusts the PILO frequency.

This is typically done after measuring the PILO frequency; see Cy_SysClk_StartClkMeasurementCounters().

Function Usage
/* Scenario: PILO needs to be trimmed to +/- 2% of nominal 32.768 kHz using
the ECO as the source. */
#define ECO_FREQ 24000000UL /* 24 MHz ECO */
#define PILO_NOMINAL 32768UL /* 32.768 kHz PILO */
#define PILO_ACCURACY 655UL /* PILO_NOMINAL * 0.02 */
bool trimStatus = false;
while(!trimStatus)
{
/* Start the PILO clock measurement using the ECO */
(void)Cy_SysClk_StartClkMeasurementCounters(CY_SYSCLK_MEAS_CLK_PILO, /* Counter 1 clock = PILO */
0x3FFUL, /* Counter 1 init value = 1024 */
CY_SYSCLK_MEAS_CLK_ECO); /* Counter 2 clock = ECO */
/* Wait for counter 1 to reach 0 */
/* Measure clock 1 with the ECO clock cycles (counter 2) */
uint32_t measuredFreq = Cy_SysClk_ClkMeasurementCountersGetFreq(false, ECO_FREQ);
/* Increment/decrement the trim depending on the returned result */
if ((PILO_NOMINAL + PILO_ACCURACY) < measuredFreq)
{
}
else if (measuredFreq < (PILO_NOMINAL - PILO_ACCURACY))
{
}
else
{
/* Trimmed within limits */
trimStatus = true;
}
}

◆ Cy_SysClk_PiloGetTrim()

uint32_t Cy_SysClk_PiloGetTrim ( void  )

Reports the current PILO trim bits value.

Function Usage
/* Scenario: PILO needs to be trimmed to +/- 2% of nominal 32.768 kHz using
the ECO as the source. */
#define ECO_FREQ 24000000UL /* 24 MHz ECO */
#define PILO_NOMINAL 32768UL /* 32.768 kHz PILO */
#define PILO_ACCURACY 655UL /* PILO_NOMINAL * 0.02 */
bool trimStatus = false;
while(!trimStatus)
{
/* Start the PILO clock measurement using the ECO */
(void)Cy_SysClk_StartClkMeasurementCounters(CY_SYSCLK_MEAS_CLK_PILO, /* Counter 1 clock = PILO */
0x3FFUL, /* Counter 1 init value = 1024 */
CY_SYSCLK_MEAS_CLK_ECO); /* Counter 2 clock = ECO */
/* Wait for counter 1 to reach 0 */
/* Measure clock 1 with the ECO clock cycles (counter 2) */
uint32_t measuredFreq = Cy_SysClk_ClkMeasurementCountersGetFreq(false, ECO_FREQ);
/* Increment/decrement the trim depending on the returned result */
if ((PILO_NOMINAL + PILO_ACCURACY) < measuredFreq)
{
}
else if (measuredFreq < (PILO_NOMINAL - PILO_ACCURACY))
{
}
else
{
/* Trimmed within limits */
trimStatus = true;
}
}

◆ Cy_SysClk_PiloBackupEnable()

void Cy_SysClk_PiloBackupEnable ( void  )

Enables the PILO as always on if Backup Domain is present.

Note
This API is available for CAT1B & CAT1D devices.

◆ Cy_SysClk_PiloBackupDisable()

void Cy_SysClk_PiloBackupDisable ( void  )

Disables the PILO as always on if Backup Domain is present.

Note
This API is available for CAT1B & CAT1D devices.

◆ Cy_SysClk_PiloOkay()

bool Cy_SysClk_PiloOkay ( void  )

Reports the status of the PILO.

Returns
true = okay
false = not okay
Note
This API is available for CAT1B(20829) devices.

◆ Cy_SysClk_PiloTcscEnable()

void Cy_SysClk_PiloTcscEnable ( void  )

Enables the PILO TCSC(Second order temperature curvature correction) Feature.

Note
This API is available for CAT1B devices.

◆ Cy_SysClk_PiloTcscDisable()

void Cy_SysClk_PiloTcscDisable ( void  )

Disables the PILO TCSC(Second order temperature curvature correction) Feature.

Note
This API is available for CAT1B devices.