Selects the RTC pre-scaler value and changes its clock frequency.
If the external 32.768 kHz WCO is absent on the board, the RTC can be driven by a 32.768kHz square clock source or an external 50-Hz or 60-Hz sine-wave clock source, for example the wall AC frequency.
- Parameters
-
In addition to generating the 32.768 kHz clock from external crystals, the WCO can be sourced by an external clock source (50 Hz or 60Hz), even the wall AC frequency as a timebase. The API helps select between the RTC sources:
- A 32.768 kHz digital clock source.
- An external 50-Hz or 60-Hz sine-wave clock source.
If you want to use an external 50-Hz or 60-Hz sine-wave clock source to drive the RTC, the next procedure is required:
- Disable the WCO
- Bypass the WCO using the Cy_SysClk_WcoBypass() function.
- Configure both wco_out and wco_in pins. Note that only one of the wco pins should be driven and the other wco pin should be floating, which depends on the source that drives the RTC (*1).
- Call Cy_RTC_SelectFrequencyPrescaler(CY_RTC_FREQ_60_HZ), if you want to drive the WCO, for example, with a 60 Hz source.
- Enable the WCO.
If you want to use the WCO after using an external 50-Hz or 60-Hz sine-wave clock source:
- Disable the WCO.
- Switch-off the WCO bypass using the Cy_SysClk_WcoBypass() function.
- Drive off the wco pin with an external signal source.
- Call Cy_RTC_SelectFrequencyPrescaler(CY_RTC_FREQ_WCO_32768_HZ).
- Enable the WCO.
(1) - Refer to the device TRM to know how to configure the wco pins properly and which wco pin should be driven/floating.
- Warning
- There is a limitation to the external clock source frequencies. Only two frequencies are allowed - 50 Hz or 60 Hz. Note that this limitation is related to the RTC pre-scaling feature presented in this function. This limitation is not related to WCO external clock sources which can drive the WCO in Bypass mode.