Application Note
22 of 80
002-26071 Rev. *B
2021-09-07
Clock configuration setup in TRAVEO™ T2G family CYT4D series MCUs
Configuration of the clock resources
Code Listing 12
AllClockConfiguration () function
static void AllClockConfiguration(void)
{
:
/***** WCO setting ******/
{
cy_en_sysclk_status_t wcoStatus;
wcoStatus = Cy_SysClk_WcoEnable(WAIT_FOR_STABILIZATION*10ul);
CY_ASSERT(wcoStatus == CY_SYSCLK_SUCCESS);
}
return;
}
Code Listing 13
Cy_Sysclk_WcoEnable() function
:
__STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable(uint32_t timeoutus)
{
cy_en_sysclk_status_t rtnval = CY_SYSCLK_TIMEOUT;
BACKUP->unCTL.stcField.u1WCO_EN = 1ul;
/* now do the timeout wait for STATUS, bit WCO_OK */
for (; (Cy_SysClk_WcoOkay() == false) && (timeoutus != 0ul); timeoutus--)
{
Cy_SysLib_DelayUs(1u);
}
if (timeoutus != 0ul)
{
rtnval = CY_SYSCLK_SUCCESS;
}
return (rtnval);
}
3.3
Configuring IMO
By default, the IMO is enabled so that all functions work properly. The IMO will automatically be disabled
during DeepSleep, Hibernate, and XRES modes. Therefore, it is not required to set the IMO explicitly.
3.4
Configuring ILO0/ILO1
The ILO0 is enabled by default.
Note that the ILO0 is used as the operating clock of the watchdog timer (WDT). Therefore, if the ILO0 is disabled,
it is necessary to disable the WDT. To disable the
ILO0, write ‘
0b01
’ to the WDT_LOCK bit of the WDT_CTL
register, and then write ‘
0b00
’ to the ENABLE bit of the CLK_ILO0_CONFIG register.
The ILO1 is disabled by default. To enable the ILO1
, write ‘
0b01
’ to
the ENABLE bit of the CLK_ILO1_CONFIG
register.
WCO enable. See
(2) Check the state of WCO_OK and
the state of TIMEOUT.
(1) Write “1” to the WCO_EN bit, and
make the WCO available.
Check the state of ECO_OK and the
state of TIMEOUT"1"
(3) Subtract the TIMEOUT value.
(4) Check whether the processing exited
the loop at TIMEOUT.
valueCheck whether the processing
exited the loop at TIMEOUT
Wait for 1 us.