CC2530 's Clock

Source: Internet
Author: User
Tags sleep

Crystal oscillator and Clock

The cc2530 has an internal system clock, or a master clock. The system clock Source is a 16Mhz rc crystal oscillator or 32MHz crystal oscillator. The clock can be controlled using the Clkconcmd special function register.

In addition, the chip also has a 32KHz clock source can be RC oscillator or crystal oscillator, also can be controlled with clkconcmd register.

Where the read-only register Clkconsta can be used to obtain the current clock state. A high-precision crystal oscillator or a low-power RC oscillator can be chosen as an oscillator, and it is important to note that the RF receiver requires the use of a 32MHz crystal oscillator. As shown in the figure below is the clock structure diagram:

Crystal oscillator

Inside the chip, there are 2 high frequency oscillators, one is a 32MHz crystal oscillator and the other is a 16MHz RC crystal. The start-up time of the 32MHz crystal is somewhat long for some applications, so the chip can run on the 16MHz RC Crystal first until the crystal oscillator is stable. The 16MHZD RC oscillator consumes less energy than a crystal oscillator, but is more accurate than a crystal oscillator and cannot be used as a running clock for RF transmissions.

In addition, the chip also has 2 low-frequency oscillators are 32KHz crystal oscillator and 32KHz RC oscillator. The 32KHz Xosc is designed to operate at 32.768KHz frequencies and provides a stable clock signal for systems that require time accuracy. After calibration, the 32KHz Rcosc operates on a 32.753KHz frequency.

It is important to note that the checksum is allowed only if the 32MHz Xosc is enabled. Compared to the 32KHz Xosc oscillator, the 32KHz RC oscillator is more suitable for less cost and energy consumption.

Please note: These 2 32KHz oscillators cannot be used at the same time.

System clock

The system clock comes from the selected system clock source, It can be a 32MHz Xosc (crystal oscillator) or a 16MHz Rcosc (RC oscillator). The OSC bit in the register Clkconcmd selects the system clock source, it should be pointed out that if the RF transmission, then the 32MHz crystal oscillator must be selected as the main clock and stable.

Changing the OSC bit in the Clkconcmd does not immediately change the system clock, only if the OSC bit in the Clkconsta register is the same as the OSC bit in the clkconcmd. This is attributed to the need to have a stable clock prior to changing the clock source. In addition, the CLKSPD bit in clkconcmd reflects the Clkconcmd.osc bit as a mirror.

When the 32MHz Xosc Crystal is selected as the system clock and stabilized, the 16MHZ RC oscillator is calibrated, e.g. the OSC bit of the Clkconsta register changes from 1 to 0. 32KHz clock selection as described above, there are 2 32KHz clock sources on the device, after the reset by default will enable 32KHz RC oscillator, and as a 32KHz clock source, 32KHz RC Oscillator Energy consumption is small, but compared with the 32KHz crystal oscillator precision is much worse. The selected 32KHz clock source is used to drive the sleep clock, generates a tick clock for the watchdog, and can be used as a gate for the timer TIM2 (strobe) to calculate the sleep time of the sleep timer. The osc32k bit in the Timer control register is used to select the oscillator as the 32KHz clock source. The osc32k bit of the Clkconcmd register can be written at any time. The oscillator will not work before the active system clock source. When the system clock changes from 16MHz to 32MHz Crystal oscillator (Clkconcmd.osc from 1 to 0) once the 32KHz RC oscillator is selected its checksum is started and executed. During calibration, a crossover amount of the 32MHz crystal oscillator is used. The result of the 32KHzRCOSC oscillator calibration is that it will work on 32.753kHz. 32KHZ RC Oscillator Calibration time may take 2ms time to complete. If you set the Sleepcmd.osc32k_caldis bit to 1, the calibration will be turned off. At the end of the calibration, an additional pulse will be generated on the 32KHz clock source, resulting in a 1 increase in the sleep timer. Note: When switching to a 32KHz crystal oscillator and waking from the PM3 mode set by the 32KHz crystal oscillator, the oscillator stabilizes to an accurate frequency of more than a time of more than. Sleep timers, watchdog timers, and clock loss detectors cannot be used until the 32KHz crystal oscillator is stable.




cc2530 clock Source is mainly 4: for the high-frequency clock (System clock) can be an external 32MHz crystal, it can also be an internal 16MHz RC oscillator, for the low-frequency clock (32kHz), can be external 32.768kHz crystal oscillator, can also be internal 32.768kHz RC oscillator.

Refer to the post can be known, quartz crystal precision, but the power consumption, start slowly, and the chip internal RC oscillator Although the accuracy is slightly lower, but the startup speed, low power consumption, is very suitable for low-energy applications, and no need for external electronic devices can work, reduce costs. The internal RC oscillator is used by default on power-on.

In order to freely configure the required clock, mainly with the help of Clkconcmd.osc Select the system master clock, and the use of clkconcmd.osc32k is used to select the chip 32K clock source.

While the low-power mode setting requires the help of the Sleepcmd register, the sleepcmd second function is not described in swru191e (Cc2530datasheet), as follows:

However, refer to the CC2430 chip manual can be found, corresponding to the sleep register is described, as shown below, the small part of the understanding is that Ti acquired Chipcon company, with the cc2430 2.4GHz ZigBee Solution also revenue, further optimize the chip, update circuit IC design, c2530 compared with the previous 2430 chip, should have a lot of similarities, may be cc2530 introduced shortly, the documentation is not detailed enough, of course, does not rule out ti intentionally hide the possibility of chip details, the literal explanation is, when SLEEPCMD.OSC_PD is 0 o'clock, 32MHz Crystal oscillator and 16MHz RC oscillator will be vibrating


For the bit6/bit5 description in the Sleepsta register in the cc2530 manual is also not stated, you can refer to the cc2430 instructions, wherein the 6th XOSC_STB indicates whether the external high-speed 32M crystal oscillator is power-up and stabilize the vibration, when stable when the bit is 1 The same for the 5th bit HFRC_STB indicates whether the internal 16MHz high-speed RC oscillator is vibrating and stable, and when the 16MHz RC oscillator is stable, the bit is 1, as shown in the following figure:


When the system clock needs to be set, with the help of the Clkconcmd register can choose the chip master clock and 32K clock source, when the setting is stable, you can use the Clkconsta register in the 6th and 7th position to reflect the current clock selection, when the clock is stable after the corresponding bit, This allows you to determine the current clock setting.





In addition, when the Sleepcmd register is configured, the OSC_PD can be placed to turn off the high-speed clock (16MHz EC oscillator or 32MHz crystal oscillator) that is not selected (the third bit may be write 1 to achieve this function for CC2530), as shown below


As a demonstration, small wrote a sample code to configure the cc2530 clock system as follows: void Wg_sys_clk_config (Uint8 mclk,uint8 lclk) {uint16 i;   Sleepcmd &= ~osc_pd; /* Turn on 16MHz RC and 32MHz Xosc */* wait for 32MHz Xosc stable */while (! Sleepsta & Xosc_stb) | |!     (Sleepsta &hfrc_stb));           ASM ("NOP"); /* Chip Bug Workaround */for (i=0; i<504; i++) asm ("NOP"); /* Require 63us delay for all revs */* Select system clock and the source for 32K clock */clkconcmd = (MCLK | lclk)   ;     /* Wait for the change to be effective */while (Clkconsta! = (MCLK | lclk));   Sleepcmd |= osc_pd; /* Turn off the oscillator not used*/}


of which: #ifndef bv#define BV (n) (1 << (n)) #endif/* Sleepcmd and Sleepsta bit definitions */#define OSC_PD BV (2) /* 0:both oscillators powered up and stable * 1:oscillators not stable */#define XOSC_STB B V (6)/* xosc:powered, stable=1 */#define HFRC_STB BV (5)/* Hfrc:powerd, stable=1 */





The cc2530 has an internal system clock, or a master clock. The system clock Source is a 16Mhz rc crystal oscillator or 32MHz crystal oscillator. The clock can be controlled using the Clkconcmd special function register.

In addition, the chip also has a 32KHz clock source can be RC oscillator or crystal oscillator, also can be controlled with clkconcmd register.

Where the read-only register Clkconsta can be used to obtain the current clock state.

clkconcmd: Clock frequency control register.

D7

D6

D5~d3

D2~d0

32KHZ Time Oscillator Selection

System Clock Selection

Timer output Marker

System Master Clock Selection

D7 bit for 32KHZ time oscillator selection, 0 for 32KRC Oscillation, 1 for 32K crystal oscillator. The default is 1.
The D6 bit is selected for the system clock. 0 is a 32M crystal oscillator and 1 is a 16M RC oscillator. When the D7 bit is 0 o'clock D6 must be 1.
D5~D3 the timer output flag. 000 for 32mhz,001 for 16mhz,010 for 8mhz,011 for 4mhz,100 for 2mhz,101 for 1mhz,110 for 500khz,111 for 250KHZ. The default is 001. It is important to note that when the D6 is 1 o'clock, the timer frequency can be used up to 16MHZ.
D2~D0: System master Clock Selection: 000 for 32mhz,001 for 16mhz,010 for 8mhz,011 for 4mhz,100 for 2mhz,101 for 1mhz,110 for 500khz,111 for 250KHZ. When the D6 is 1 o'clock, the system master clock can be used at a maximum frequency of 16MHZ.


Clkconsta: Time frequency status register.

D7

D6

D5~d3

D2~d0

Current 32KHZ time oscillator

Current system clock

Current Timer output marker

Current system Master Clock

The D7 bit is the current 32KHZ time oscillator frequency. 0 is 32KRC oscillator, 1 is 32K crystal oscillator.
The D6 bit is selected for the current system clock. 0 is a 32M crystal oscillator and 1 is a 16M RC oscillator.
The D5~D3 is marked for the current timer output. 000 for 32mhz,001 for 16mhz,010 for 8mhz,011 for 4mhz,100 for 2mhz,101 for 1mhz,110 for 500khz,111 for 250KHZ.
The d2~d0 is the current system master clock. 000 for 32mhz,001 for 16mhz,010 for 8mhz,011 for 4mhz,100 for 2mhz,101 for 1mhz,110 for 500khz,111 for 250KHZ.


A high-precision crystal oscillator or a low-power RC oscillator can be chosen as an oscillator, and it is important to note that the RF receiver requires the use of a 32MHz crystal oscillator. As shown in the figure below is the clock structure diagram:


Inside the chip, there are 2 high frequency oscillators, one is a 32MHz crystal oscillator and the other is a 16MHz RC crystal. The start-up time of the 32MHz crystal is somewhat long for some applications, so the chip can run on the 16MHz RC Crystal first until the crystal oscillator is stable. The 16MHZD RC oscillator consumes less energy than a crystal oscillator, but is more accurate than a crystal oscillator and cannot be used as a running clock for RF transmissions.

In addition, the chip also has 2 low-frequency oscillators are 32KHz crystal oscillator and 32KHz RC oscillator. The 32KHz Xosc is designed to operate at 32.768KHz frequencies and provides a stable clock signal for systems that require time accuracy. After calibration, the 32KHz Rcosc operates on a 32.753KHz frequency.

It is important to note that the checksum is allowed only if the 32MHz Xosc is enabled. Compared to the 32KHz Xosc oscillator, the 2KHz RC oscillator is more suitable for less cost and energy consumption.

Please note: These 2 32KHz oscillators cannot be used at the same time. As shown below

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.