We've seen in our analogy to a town that we can issue different commands and control different things easily in the MSP430. Just as in any town, if the parts aren't working in conjunction then everything winds up in a big mess. When does this switch get flipped? Does it happen before or after that event? What order do I do things, and when? Every town needs a clock, and a microcontroller depends on one.
The 3 Clocks
Each family of MSP430 has a slightly different clock system, though many of the principles are the same for each. The x2xx family uses the BCS+ system, which provides the MSP430 with three separate clocks that can run as quickly as 16 MHz in particular conditions. The reason we have three clocks instead of just one or even two is to compromise between systems that need speed and the ability to minimize power consumption, one of the real hallmarks of the MSP430. Faster clocks consume more power, so to really reduce the power used we need slower clocks. But some functions need to respond and conclude quickly, so we also need fast clocks. You can design around the use of a single clock, but having the flexibility of three is powerful. Let's look at the three clocks available in BCS+:
- MCLK: This is the Master Clock, the one that drives the processor and times the commands in your program. This is typically a high frequency clock, but can be configured for low frequencies if needed.
- SMCLK: The Sub-Main Clock is a secondary clock that is often used by other peripherals. It can be the same frequency as MCLK or different, depending on the application.
- ACLK: The Auxilliary Clock is usually timed outside the MSP430 and is typically used for peripherals. Often, this is a low frequency clock, but can also be used at high frequencies when desired.
The 4 Sources
There are also up to four sources available in BCS+ to drive each of the three clocks:
There are also up to four sources available in BCS+ to drive each of the three clocks:
- LFXT1CLK: The name of this source implies its use with a low-frequency crystal, and this is often the case. A 32,768 Hz crystal can be connected to your MSP430 for low-power, high-accuracy timing. In some x2xx devices, this source also has a high frequency mode that can use crystals from 400 kHz to 16 MHz, assuming the chip is powered with a large enough voltage to handle the frequency. In addition, other resonators and external signals can be used for this source.
- XT2CLK: Again, this source is named for its implied use with a second crystal, but in this case only a high frequency crystal. It can also use other resonators and external signals. This source is not available on every x2xx device. (See page 5-2 of the x2xx Family User's Guide to see which devices use XT2.)
- DCOCLK: The internal source is the digitally controlled oscillator. Though not as accurate and stable as crystal sources, the DCO is still quite good and can be configured to operate at a wide range of frequencies.
- VLOCLK: The MSP430 includes a second internal oscillator for very-low power, very-low frequency applications. The VLO can run slower than the LFXT1 watch crystal, and typically is used at about 12 kHz. This source is not available in all x2xx devices. (Refer to 5-2 in the User's Guide.)
Each clock can also divide the frequency by which it's sourced by a factor of 2, 4, or 8. In addition, many peripherals can further divide their clock by the same factors, giving a large number of possible frequencies available from just one source. While MCLK and SMCLK can use any of the four sources, ACLK uses only LFXT1 or VLO. The default configuration for MCLK and SMCLK is to use the DCO at about 1.1 MHz, and for ACLK is to use LFXT1. In the coming parts for Tutorial 08, we'll look at each source and how to configure them properly. Because it's in every MSP430 device, we'll start with the DCO before taking a look at using crystals.
So the BCS+ provides us three separate clocks with 32 possible ways of sourcing them. The clocks can be divided for operation of different peripherals individually. These varied combinations provide for nearly any conditions needed for an MSP430 project. We should not neglect, however, to note that TI has gone to great effort to make the clock system very reliable; even the VLO and DCO are very well made, accurate, and stable. For precision timing, nothing can surpass well-designed crystal control, but the internal clocks do a great job, and can even change configuration in the middle of a program. Such power available without much sacrifice for quality is one of the real benefits of the MSP430 design.
Look forward to the next post, where we'll examine how we configure the DCO for different operating modes in the MSP430!
6 comments:
Thanks a lot for these tutorials! They have been an excellent source of info on the MSP430 series
Hi David,
Great work with the tutorials.
You refer to the x2xx Family User's Guide. several times throughout the tutorial, however the link for this Guide appears to be broken.
Could you rehost this pdf some place else as I was unable to locate it even after a thorough google search.
The link breaks every time TI releases a new version of the manual. Rehosting is probably a good idea. In the mean time, it's easy to find at their website: just go to http://www.ti.com and search for any x2xx chip, such as the msp430g2211. The product page for every chip in the family has a link to the current version of the family user's guide.
oh man, Great Job on explaining
Reading this guide is like 10 times faster and 10 times more clear from the datasheet
Great job, DON'T STOP ON POSTING TUTORIAL AND PROJECT FOR MSP430
and good news, you just gain a new subscriber =)
The SLAU144E is not anymore available.
I found the slau144i.pdf
Urgentissimo,
Thanks for bringing up the current link. I've just added a set of "important links" on the side of the blog, which I'll do my best to keep updated to the most current version of the documentation.
Post a Comment