CAT2 Peripheral Driver Library

Functions

int32_t Cy_SysClk_ImoTrim (uint32_t imoFreq, cy_en_sysclk_calib_formula_t order)
 Trims the IMO to be as close to requested frequency as possible. More...
 
int32_t Cy_SysClk_PiloTrim (uint32_t piloFreq, cy_en_sysclk_calib_formula_t order)
 Trims the PILO to be as close to 32,768 Hz as possible. More...
 

Detailed Description

Function Documentation

◆ Cy_SysClk_ImoTrim()

int32_t Cy_SysClk_ImoTrim ( uint32_t  imoFreq,
cy_en_sysclk_calib_formula_t  order 
)

Trims the IMO to be as close to requested frequency as possible.

Parameters
imoFreqcurrent IMO frequency. Call Cy_SysClk_CalibStart and other measurement functions to obtain the current frequency of the IMO.
ordertype of the calibration cy_en_sysclk_calib_formula_t which will be executed.
Returns
Change in trim value - 0 if done; that is, no change in trim value.
Function Usage
#define CLOCK1_VALUE (0xFFFEUL)
/* set clock1 (time window) as HPOSC
* set clock2 (measured frequency) as IMO
* set time window as 0xFFFE counts of the HPOSC
*/
if (retVal == CY_SYSCLK_SUCCESS)
{
/* wait until calibration is done */
/* get calculated IMO frequency */
/*
* measured clock is clock2 = true,
* time window was 0xFFFE counts of the clock1
*/
imo = Cy_SysClk_CalibGetFreq(true, CLOCK1_VALUE);
}

◆ Cy_SysClk_PiloTrim()

int32_t Cy_SysClk_PiloTrim ( uint32_t  piloFreq,
cy_en_sysclk_calib_formula_t  order 
)

Trims the PILO to be as close to 32,768 Hz as possible.

Parameters
piloFreqcurrent PILO frequency. Call Cy_SysClk_CalibStart and other measurement functions to obtain the current frequency of the PILO.
ordertype of the calibration cy_en_sysclk_calib_formula_t which will be executed
Returns
Change in trim value; 0 if done, that is, no change in trim value.
Function Usage
#define CLOCK1_VALUE (0xFFFEUL)
/* set clock1 (time window) as HPOSC
* set clock2 (measured frequency) as PILO
* set time window as 0xFFFE counts of the HPOSC
*/
if (retVal == CY_SYSCLK_SUCCESS)
{
/* wait until calibration is done */
/* get calculated PILO frequency */
/*
* measured clock is clock2 = true,
* time window was 0xFFFE counts of the clock1
*/
pilo = Cy_SysClk_CalibGetFreq(true, CLOCK1_VALUE);
}