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
Cy_SysClk_StartClk
MeasurementCounters
(clk1, count1,clk2)
Set and start calibration.
clk1 = CY_SYSCLK_MEAS_CLK_ECO =
0x101ul
Count1: Measurement period
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
Code Listing 58 to Code Listing 62 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 3.1 Setting the ECO and 3.4 Configuring ILO0/ILO1.
Get the clock frequency. See Code Listing 59.
Define the CY_SYSCLK_DIV_ROUND function.