Dialing up flexibility in microcontroller clock systems

February 01, 2012

As microcontroller requirements evolve, so too must the clock systems that manage them.

 

Today, the range of applications for microcontrollers (MCUs) is vast. While these ubiquitous computing engines advance in processing capabilities, peripheral offerings, and more efficient power consumption, the number of applications continues to increase at incredible rates.

As application requirements have expanded, so have key system components that reside on the microcontroller, one of which is the clock system. This system plays a critical role in a microcontroller and is vital to various aspects of overall system performance, including optimized power dissipation, accurate time keeping, communication interface clocking, and internal clocking requirements for other key components within the microcontroller.

Resources and requirements

The clock system can be considered a pool of resources, called clock resources (see Figure 1). Each clock resource is optimized for a primary purpose even though it can be used for various functions within the system. The clock system typically includes various clock sources, called system clocks. These system clocks are used to control various subsystem components such as the CPU, bus interfaces, peripherals, and data converters. Because application requirements can vary considerably, each system clock offers several clock resources.

 

Figure 1: A typical microcontroller clock system offers numerous clock resources to meet a variety of application requirements.


21

 

 

Given that a general-purpose MCU can be used in hundreds if not thousands of applications, the clock system must be highly programmable. This allows the clock system to be reconfigured as needed in a specific application. Some simple applications require only a static configuration, and the clock system is configured only once during initialization. Others require a dynamic configuration that allows the clock system to be reconfigured based on the application’s real-time behavior.

The types of clock resources available in the clock system are important. Applications have different demands needed to implement a particular function. For example, real-time clock systems require an accurate time base for keeping time over the application’s lifespan. Most clock systems have an integrated oscillator that supports the most common watch crystal available, 32,768 Hz. External crystals require the proper load capacitance to center the frequency properly and optimize start-up.

To reduce system cost, some microcontrollers integrate programmable load capacitors that allow for a range of capacitance values to support the most common crystal load requirements. Some systems already have a real-time clock resource available. For these systems, a bypass mode can allow this resource to be shared with the microcontroller. In a similar fashion, the microcontroller clock system can output a buffered real-time clock source to be used elsewhere in the system when required.

Microcontroller frequency range has increased dramatically in the past several years. Processing requirements have driven this expanded frequency range as software complexity levels have increased. Most MCUs have various methods for generating the high-speed clocks required in the system, most commonly with an embedded oscillator that requires no external components. This saves component cost and, more importantly, reduces the microcontroller’s pin requirements. The oscillator is typically designed to have good start-up times, as well as fairly tight tolerances on the order of 1 to 3 percent over voltage and temperature.

Finding faults and preventing errors

One critical aspect of the clock system is the reliability of system clocks, especially the processor clock. Ideally, the processor clock should be readily available at all times to ensure the application can recover from a system error that can lead to a deadlock situation. Because the clock system is highly programmable, it poses some risks by incorrect or inadvertent programming if code execution goes astray.

Most clock systems have password-protected access to all the critical clock system configuration registers. This minimizes the chances of an inadvertent configuration due to errant code execution. In addition, a good clock system should have other hardware mechanisms to prevent a deadlock situation.

A good example of this is proper fail-safe mechanisms for all crystal resources. External crystals or resonators can fail due to board wear, electrostatic discharge events, weak solder joints, and other reasons. If the processor system clock uses a crystal for its resource and it fails, this could cause clock loss, and a deadlock situation could occur.

To prevent this, most microcontrollers have hardware mechanisms that check if the crystal is operating correctly. Checks include non-oscillation or perhaps oscillation at the improper frequency range. Regardless, if a fault is detected, the system clock is automatically switched to a known, good clock resource, allowing the application code to continue to execute. Furthermore, an error condition is reported to the application, such as a non-maskable interrupt or a reset condition where the application can determine which action to take. This known, good clock source is often a fully embedded oscillator that is robust in terms of start-up characteristics and oscillation reliability.

Improving energy efficiency

Most MCU applications demand low or ultra low power. Because many applications use limited energy sources such as small, low-capacity batteries, product longevity depends on efficient energy usage. The best way to conserve energy is to use the proper amount of energy required at a given time and reduce all energy consumption to a minimum at all other times. This is the classic duty-cycle profile. In general, most vendors call this active time versus sleep or standby time. The longer the device can remain in sleep time, the less energy will be consumed overall.

Clock system design is critical to minimize energy requirements during sleep or standby operation. Most standby or sleep modes are characterized by the use of low-frequency clocks. Several options can provide this low-frequency clock operation.

The watch crystal is one such resource. It has a nominal 32 kHz operation, is very precise, and can be designed to operate at very low current consumption on the order of 500 nA or less depending on the crystal type. This is a good option if a watch crystal is already in the system, so no additional cost is incurred. If a crystal is not required, an embedded oscillator is another valid option that can be extremely low power, some as low as 100 nA.

These oscillators typically involve a trade-off in power versus accuracy. Higher accuracy often requires dissipating higher power. The oscillator is affected by temperature and voltage changes that could be important in some applications. Therefore, many microcontrollers have various clock resources for this purpose, some with higher power requirements yet improved accuracy or drift characteristics. These oscillators are robust and low cost and require no external components or pins.

Another important aspect of the clock system that can significantly reduce power is the clock distribution logic, which entails how the various clock systems are routed or distributed inside the MCU. Because clocking is a key factor in dynamic power consumption, it is critical that the clock distribution logic is completed in such a way to minimize unnecessary clock loading and clock switching. All system clocks should be gated off or held static when not required. In addition, only logic that requires a particular system clock should be seen as loads to that respective clock.

Many microcontrollers divide a particular system clock into several individual clocks, which only feed a specific module or peripheral. When a particular module needs the system clock, it will send a request and only the module that has requested the clock receives it, dramatically reducing overall dynamic power.

Flexible design for diverse applications

Many aspects are involved in designing a clock system for microcontrollers. The MSP430 5xx/6xx series of microcontrollers from Texas Instruments Incorporated (TI) contains many of the necessary components described previously. These MCUs support low-frequency watch crystal operation, as well as a broad range of high-frequency crystals. Both crystals have fail-safe logic and can be used in bypass mode. The clock system also contains an embedded oscillator with a Frequency-Locked Loop (FLL) for high-frequency operation with no external components. The FLL allows for any multiple of the low-frequency clock as its reference, providing flexibility in frequency selection.

An extremely low-power embedded oscillator of less than 100 nA is available for low-power, non-accurate, crystal-less clocking applications. A more accurate low-power embedded oscillator is also available for more stringent clocking needs. Furthermore, sophisticated clock distribution logic is offered with a highly flexible clock request system. All of these aspects of the clock system allow TI’s MSP430 5xx/6xx series of microcontrollers to serve a broad range of diverse microcontroller applications in a low-power, cost-effective manner.

Craig Greenberg is a systems developer in the MCU Division at Texas Instruments.

Texas Instruments Incorporated 972-995-2011 www.fb.com/texasinstruments https://plus.google.com/#104292131839044508100/posts @TXInstruments www.ti.com

 

Categories
Industrial