
A31G22x Clock Setting Guide
4. Clock Sources
19
4.5.3.
F/W Configuration
Example 1
Figure 10 and the procedure listed below show an example code that outputs PLL 48MHz frequency
using the HSI clock source.
Figure 10. PLL Clock F/W Configuration Example 1
1.
Enable the HSI clock source. If f
PLLINCLK
(32MHz) is used without change, since the f
IN
ranges
from 1MHz to 3MHz and the value of PREDIV (R) can be between 0 and 7 at this time, the
f
PLLINCLK
clock that is HSI clock is divided by 2 in the SCU_CSCR<HSICON[7:4]> register to
result in 16MHz frequency.
f
PLLINCLK
= 32MHz / 2 = 16MHz (SCU_CSCR<HSICON[7:4]> = 0x09)
2.
Configure the SCU_SCCR register:
①
Set PLLINCLKSEL bit to 0 (0x00).
②
Set MCLKSEL bits to 10 (0x10).
3.
Set R to 7. This allows the f
IN
value to be between 1MHz and 3MHz.
f
IN
/ (R + 1) = 16MHz / (7 + 1) = 2MHz