PSOC E8XXGP Device Support Library

General Description

Functions

cy_en_sysclk_status_t Cy_SysClk_WcoEnable (uint32_t timeoutus)
 Enables the WCO. More...
 
bool Cy_SysClk_WcoOkay (void)
 Reports the status of the WCO_OK bit. More...
 
void Cy_SysClk_WcoDisable (void)
 Disables the WCO. More...
 
void Cy_SysClk_WcoBypass (cy_en_wco_bypass_modes_t bypass)
 Sets whether the WCO is bypassed or not. More...
 

Function Documentation

◆ Cy_SysClk_WcoEnable()

cy_en_sysclk_status_t Cy_SysClk_WcoEnable ( uint32_t  timeoutus)

Enables the WCO.

Parameters
timeoutusamount of time in microseconds to wait for the WCO to be ready. If WCO is not ready, WCO is stopped. To avoid waiting for WCO ready set this to 0, and manually check if WCO is okay using Cy_SysClk_WcoOkay.
Returns
Error / status code:
CY_SYSCLK_SUCCESS - WCO successfully enabled
CY_SYSCLK_TIMEOUT - Timeout waiting for WCO to stabilize
Function Usage
/* Scenario: The WCO needs to source the backup clock for the real-time clock
operation. Timeout of 2ms is tolerable. The WCO pins are configured
using the gpio driver(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* Enable the WCO with a timeout of 2000 microseconds */
{
/* Insert error handling */
}
/* Set the backup clock source to WCO */
@ CY_SYSCLK_BAK_IN_WCO
Backup domain clock input is WCO.
Definition: cy_sysclk.h:4208
void Cy_SysClk_ClkBakSetSource(cy_en_clkbak_in_sources_t source)
Sets the source for the backup domain clock (clk_bak).
Definition: cy_sysclk_v2.c:2351
@ CY_SYSCLK_SUCCESS
Command completed with no errors.
Definition: cy_sysclk.h:497
cy_en_sysclk_status_t Cy_SysClk_WcoEnable(uint32_t timeoutus)
Enables the WCO.
Definition: cy_sysclk_v2.c:3843

◆ Cy_SysClk_WcoOkay()

bool Cy_SysClk_WcoOkay ( void  )

Reports the status of the WCO_OK bit.

Returns
true = okay
false = not okay
Function Usage
/* Scenario: The WCO needs to source the backup clock for the real-time
clock operation. It needs to be enabled in a non-blocking
manner. The WCO pins are configured using the gpio driver
(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* Enable the WCO without timeout */
(void)Cy_SysClk_WcoEnable(0UL);
{
/* WCO is not yet ready. Perform some other operation. */
}
/* Set the backup clock source to WCO */
bool Cy_SysClk_WcoOkay(void)
Reports the status of the WCO_OK bit.
Definition: cy_sysclk_v2.c:3870

◆ Cy_SysClk_WcoDisable()

void Cy_SysClk_WcoDisable ( void  )

Disables the WCO.

Note
We need to set writable option using Cy_RTC_WriteEnable before disabling WCO, and clear writable option after disabling WCO.
Function Usage
/* Scenario: LFCLK needs to be sourced by the PILO instead of the WCO. All
peripherals clocked by the LFCLK are disabled and the Watchdog
timer (WDT) is unlocked. */
/* Disable the WCO */
/* Enable the PILO */
/* Set the LFCLK source to the PILO */
@ CY_SYSCLK_CLKLF_IN_PILO
clkLf is sourced by the precision low speed oscillator (PILO)
Definition: cy_sysclk.h:3976
void Cy_SysClk_ClkLfSetSource(cy_en_clklf_in_sources_t source)
Sets the source for the low frequency clock(clkLf).
Definition: cy_sysclk_v2.c:2378
void Cy_SysClk_PiloEnable(void)
Enables the PILO.
Definition: cy_sysclk_v2.c:3918
void Cy_SysClk_WcoDisable(void)
Disables the WCO.
Definition: cy_sysclk_v2.c:3881

◆ Cy_SysClk_WcoBypass()

void Cy_SysClk_WcoBypass ( cy_en_wco_bypass_modes_t  bypass)

Sets whether the WCO is bypassed or not.

If it is bypassed, then a 32-kHz clock must be provided on the wco_out pin.

Parameters
bypasscy_en_wco_bypass_modes_t
Function Usage
/* Scenario: An external watch crystal oscillator needs to be connected to
the WCO pins instead of a watch crystal. This signal needs
to source the backup clock for the real-time clock operation.
The WCO pins are configured using the gpio driver
(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* WCO bypassed mode - 32768 kHz square-wave supplied through SRSS_WCO_OUT_PIN pin */
/* Enable the WCO with a timeout of 2000 microsecond */
{
/* Insert error handling */
}
/* Set the backup clock source to WCO */
@ CY_SYSCLK_WCO_BYPASSED
WCO is bypassed external clock must be supplied on XTAL pin.
Definition: cy_sysclk.h:2364
void Cy_SysClk_WcoBypass(cy_en_wco_bypass_modes_t bypass)
Sets whether the WCO is bypassed or not.
Definition: cy_sysclk_v2.c:3899