
6. Output of System Main Clock
A31G22x Clock Setting Guide
24
6.
Output of System Main Clock
A31G22x provides a function that outputs the system main clock (MCLK) frequency to a port.
1.
Set the PF4 pin as an Alternative Function, and select a CLKO function.
2.
Configure the SCU_COR register to enable the CLKO Divider and set its value:
①
Set CLKOEN bit to 1. This means CLKO is enabled.
②
Set CLKODIV bits to the value that is calculated as shown below:
𝐶𝐿𝐾𝑂 (𝐻𝑧) = 𝑀𝐶𝐿𝐾 (𝐶𝐿𝐾𝑂𝐷𝐼𝑉 = 0)
or,
𝐶𝐿𝐾𝑂 (𝐻𝑧) =
𝑀𝐶𝐿𝐾
2 ∗ (𝐶𝐿𝐾𝑂𝐷𝐼𝑉 + 1)
(𝐶𝐿𝐾𝑂𝐷𝐼𝑉 > 0)
Figure 13 shows an example code that sets LSI as a system main clock and outputs it through CLKO
pin.
* PCLK = MCLK
Figure 13. System Main Clock Output