Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

Not applicable
XMC1000 does not provided input for external crystal or oscillator but it is possible to implement a closed-loop control with external reference frequency.
We can use CCU4 to capture the period of reference frequency and adjust the Fractional Divider of the MCLK in register CLKCR.FDIV.
For example, if the reference frequency is 32KHz and CCU4 resolution is configured to 32nsec, capturing the period of the reference frequency will give a value of 1000.
If the captured value is less than 1000, this means the MCLK is slower than it should and we should decrease the fractional divider.
If the captured value is more than 1000, this means the MCLK is faster than it should and we should increase the fractional divider.

Attached is the basic example on the closed loop control via external reference frequency.
One CCU4 slice is used to captured the external frequency (32KHz) and another slice is used to generate a 32KHz PWM.
By varying the reference frequency, the generated PWM output frequency will follow the reference frequency.
This example is tested on XMC1200 and XMC1300 boot kit.
The input pin for the reference frequency is P0.3 and the generated PWM output pin is P0.4.
0 Likes
0 Replies