2. Introduction Introduction A31G22x has an SCU (System Control Unit) that can control the system settings flexibly to meet the requirements of an application. Specifically the SCU allows users to configure a main system clock by selecting and setting a clock source for the user system.
3.1. SCU Block Diagram A31G22x series has two main operating clocks. One is HCLK which produces a clock signal both for CPU and AHB bus. The other is PCLK using APB bus which produces a clock signal for peripheral systems.
3. Clock System A31G22x Clock Setting Guide 3.2. Clock Sources for Peripherals Figure 2 shows how to set the peripheral clock. Selecting a peripheral clock is a typical method of MCCRn and PCLK. Exceptionally WT, WDT, LCD use other clocks besides MCCRn and PCLK. (n = 1, 2, 3, 4, 5, 6 and 7).
A31G22x Clock Setting Guide 3. Clock System Table 3 shows the Clock Buses and Clock Sources that A31G22x supports for each peripheral. Table 3. Clock Sources of Peripherals Peripheral Clock Clock Bus Clock Source Core HCLK CFMC HCLK / PCLK...
4. Clock Sources Clock Sources A31G22x allows users to configure the main clock and peripheral clock by using the clock sources listed in Table 4 . Various functions of user application can be implemented using these clock sources. Table 4. Definition of Clock Sources...
4. Clock Sources A31G22x Clock Setting Guide 4.1. LSI Clock LSI is an internal oscillator operating at a low speed of 500kHz, and begins to oscillate when power is first applied to the initialized MCU. It is used as a clock source in Low Power mode too.
A31G22x Clock Setting Guide 4. Clock Sources 4.3. LSE Clock The LSE is an auxiliary external crystal (SXTAL) that operates at a low speed of 32.768kHz. The LSE clock can be used as a system clock or peripheral clock. It is used as a clock source in Low Power mode too.
4. Clock Sources A31G22x Clock Setting Guide 4.3.2. F/W Configuration SXIN and SXOUT pins of the LSE clock must be set before enabling the LSE clock. After enabling the LSE clock, stabilization time for the SXTAL is required. Next, users must set the LSE clock source as the system clock and update the global variables representing HCLK and PCLK to have the system operation frequency value.
A31G22x Clock Setting Guide 4. Clock Sources 4.4. HSE Clock HSE clock is a main external crystal (XTAL) that operates at the high speed ranging from 1MHz to 16MHz. It can be used as an input source setting the main clock and PLL clock or a peripheral clock.
4. Clock Sources A31G22x Clock Setting Guide 4.4.2. F/W Configuration XIN and XOUT pins of the HSE clock must be set before enabling the HSE clock. After enabling the HSE clock, stabilization time for the XTAL is required. Next, users must set the HSE clock source as the system clock and update the global variables representing HCLK and PCLK to have the system operation frequency value.
PLLINCLK Pre-Divider Value 0 to 7 POSTDIV1 Post Multiplier Value 0 to 255 POSTDIV2 Post Divider Value 0 to 15 OUTDIV Output Divider Value 0 to 15 PLLMODE Frequency Doubler Value 0 to 11 Figure 9. PLL Block Diagram of A31G22x Series...
4. Clock Sources A31G22x Clock Setting Guide 4.5.2. Calculating PLL Output Frequency PLL of A31G22x series can set the output frequency, f , in 1MHz increments accurately. The formula for the f is introduced below. Input range of the f...
A31G22x Clock Setting Guide 4. Clock Sources 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 Enable the HSI clock source.
Page 20
4. Clock Sources A31G22x Clock Setting Guide Set N1 to the value that allows f to be less than 200MHz. * (N1 + 1) = 2MHz * (47 + 1) = 96MHz Set D to the value that allows f to be less than 250MHz.
A31G22x Clock Setting Guide 4. Clock Sources Example 2 Figure 11 and the procedure listed below describe an example code that outputs PLL 48MHz frequency using the HSE clock source that operates with 8MHz XTAL. Figure 11. PLL Clock F/W Configuration Example 2 Set XIN and XOUT pins and enable HSE clock source.
Page 22
4. Clock Sources A31G22x Clock Setting Guide Set N1 to the value that allows f to be less than 200MHz. * (N1 + 1) = 2MHz * (47 + 1) = 96MHz Set D to the value that allows f to be less than 250MHz.
Flash Access Timing 5.1. Wait Time Configuration Users of A31G22x can set the Wait-time in WAIT field (CFMC_CFG[10:8]) of the CFMC_CFG register after setting the system main clock. The Wait-time settings implies the Flash access speed and affects system performance.
A31G22x Clock Setting Guide Output of System Main Clock A31G22x provides a function that outputs the system main clock (MCLK) frequency to a port. Set the PF4 pin as an Alternative Function, and select a CLKO function. Configure the SCU_COR register to enable the CLKO Divider and set its value: ①...
A31G22x Clock Setting Guide 6. Output of System Main Clock Users can measure the signal at the CLKO pin (PF4) by connecting an oscilloscope probe. The signal is about 50kHz Pulse Wave resulted from the LSI clock divided by 10.
7. Examples A31G22x Clock Setting Guide Examples A31G22x provides an example code setting the system clock for each clock source. This can be viewed in Keil uVISION 5 and IAR Embedded Workbench compiler. Example Code_A31G22x\Examples\ClkChange\* Each example project changes the system clock to the clock that users want to use after clock initialization.
Revision History A31G22x Clock Setting Guide Revision History Version Date Description 1.00 20.12.10 Initial preliminary version created 1.01 21.01.18 Revised description in 3.1, Figure 2, 4.3, 4.4, and 4.5. Added CLKO formula in Chapter 6.
Page 29
ABOV Semiconductor ("ABOV") reserves the right to make changes, corrections, enhancements, modifications, and improvements to ABOV products and/or to this document at any time without notice. ABOV does not give warranties as to the accuracy or completeness of the information included herein. Purchasers should obtain the latest relevant information of ABOV products before placing orders.