Application Note
68 of 80
002-26071 Rev. *B
2021-09-07
Clock configuration setup in TRAVEO™ T2G family CYT4D series MCUs
Supplementary information
Table 32
List of clock calibration counter with ILO0 and ECO settings functions
Functions
Description
Value
GetILOClockFreq()
Get the ILO 0 frequency.
–
Cy_SysClk_StartClk
MeasurementCounters
(clk1, count1,clk2)
Set and start calibration.
[Set the counter]
Clk1: Reference clock
clk1 = CY_SYSCLK_MEAS_CLK_ECO =
0x101ul
Count1: Measurement period
count1 = counter1
Clk2: measurement clock
clk2 = clockMeasuredInfo[].name
Cy_SysClk_ClkMeasurement
CountersDone()
Check if counter measurement is
done.
–
Cy_SysClk_ClkMeasurement
CountersGetFreq
(MesauredFreq, refClkFreq)
Get the measurement clock
frequency
MesauredFreq: Stored
measurement clock frequency
MesauredFreq =
clockMeasuredInfo[].measuredFreq
refClkFreq: Reference clock
frequency
refClkFreq = CLK_FREQ_ECO
6.2.1.3
Sample code for the initial configuration of the clock calibration
counter with ILO0 and ECO settings
show the sample code.
Code Listing 58
General configuration of the clock calibration counter with ILO0 and ECO settings
#define CY_SYSCLK_DIV_ROUND(a, b) (((a) + ((b) / 2ull)) / (b))
#define ILO_0 0ul
#define ILO_1 1ul
#define ILONo ILO_0
#define CLK_FREQ_ECO (16000000ul)
int32_t ILOFreq;
stc_clock_measure clockMeasuredInfo[] =
{
#if(ILONo == ILO_0)
{.name = CY_SYSCLK_MEAS_CLK_ILO0, .measuredFreq= 0ul},
#else
{.name = CY_SYSCLK_MEAS_CLK_ILO1, .measuredFreq= 0ul},
#endif
};
int main(void)
{
:
/* Enable interrupt */
__enable_irq();
/* Set Clock Configuring registers */
AllClockConfiguration();
/* return: Frequency of ILO */
ILOFreq = GetILOClockFreq();
/* Please check clock output using oscilloscope after CPU reached here. */
for(;;);
}
Define the measurement clock (ILO0).
(1) ECO and ILO0 setting. See
Get the clock frequency. See
Define the CY_SYSCLK_DIV_ROUND function.