ARM9 Clocks and timers

Source: Internet
Author: User

Clock

Two kinds the way to provide the clock:

1) Crystal Oscillator

2) PLL (i.e. phase-locked loop): A general-purpose PLL requires a crystal oscillator, and a phase-locked loop circuit that divides or doubles the crystal-specific frequency.

Learn the ARM9 clock Four Steps :

1) Crystal oscillator: 12MHZ

2) number of PLLs: Two, MPLL and UPLL

3) What clocks are produced by the PLL:

MPLL:FCLK HCLK PCLK

Upll:uclk

4) What clocks are used to do:

FCLK: For CPU cores.

HCLK: For AHB bus devices such as CPU cores, storage controllers, interrupt controllers, DMA, etc.

PCLK: Used for APB bus devices, such as Watchdog,i2c,iis.

UCLK: for USB devices.

Below is start -up flowchart :

Note: The frequency of the CPU core is the frequency of the external input clock when the boot is just turned on.

The process of initialization is as follows:

1) set the Locktime.

2) sets the Mpllcon register to set the multiples of the FCLK with fin (external input clock).

3) set the CLKDIVN register to set the proportions of the FCLK,HCLK,PCLK.

4) set the CAMDIVN register to turn the bus mode of the CPU into asynchronous mode (because FCLK and hclk are not equal, this change should be done according to the chip manual).

Timer

As can be seen, arm9 a total of 5 16-bit timers, clock source is PCLK.

Numbers No. 0 and 1th use a prescaler, and the 2,3,4 number uses a prescaler. The second divider function outputs 5 frequencies of clock: 2, 4, 8, 16, or external clock tclk0/tclk1.

The number 0-3 timer has an output pin, so they can output PWM, and the number 4th timer cannot.

The workflow of the timer is as follows:

1) At the beginning of the program, set TCMPBN (the comparison value of the timer), TCNTBN (the initial count value) of the two registers.

2) Set the Tcon start register to start the timer. The value of the TCMPBN,TCNTBN is then loaded into its internal register TCMPN,TCNTN. At the operating frequency of the timer n, the TCNTN begins to subtract a count, and its value can be obtained by reading the Tcnton.

3) when the value of Tcntn equals the value of TCMPN, the output pin of timer n is toutn reversed.

4) when the value of Tcntn equals 0 o'clock, the output pin is reversed again.

5) when the value of Tcntn equals 0 o'clock, if the Tcon register sets timer n to load automatically, the value of TCMPBN,TCNTBN is newly loaded into its internal register TCMPN,TCNTN.

Register Description:

1) TCFG0 Register: Sets the Prescaler.

2) TCFG1 Register, set the crossover.

3) TCNTBN Register: The initial count value.

4) TCMPBN Register: Save comparison value.

5) Tcnton Register: Read this register to know the current value of the counter.

6) Tcon Register: Control Register



From for notes (Wiz)

ARM9 Clocks and timers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.