element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog AirMobile - 2- Power management
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: amgalbu
  • Date Created: 10 Nov 2014 1:54 PM Date Created
  • Views 839 views
  • Likes 2 likes
  • Comments 6 comments
  • iot_distributed
  • in_the_air
Related
Recommended

AirMobile - 2- Power management

amgalbu
amgalbu
10 Nov 2014

Power management

Low power mode is a feature for which the MSP430 is designed for. It is useful because it shuts down certain areas of the CPU in order to save power. Since most embedded systems need to be energy efficient, low power modes of operation are employed.

Some microcontrollers may provide a sleep mode that shuts down the CPU clock. The MCU comes out of sleep mode when an interrupt is detected. The program resumes execution following the SLEEP instruction and returns to sleep mode after executing another SLEEP instruction.

TI MSP430 does things a bit differently. The bit settings which select the requested sleep mode are part of the status register (SR). When an interrupt occurs, the mcu stores away the SR and goes into full operational mode, Active Mode (AM). At the end of the interrupt service routine (ISR) the MCU retrieves the saved SR and returns to the previous low power mode.

I want my sensor to be as energy efficient as possible. So my purpose is to put the MCU in sleep for 30 seconds, wake up for the time required to make measurements(about 2 seconds) and then put it back to sleep. During the 30 seconds of sleep the energy generated by the Peltier cell is stored in the super-capacitor to provided extra energy to feed the dust sensor heating cycle


The first step is to get familiar with clocks, timers and low power modes

 

Clocks and timers

In the MSP430FR5969 MCU, the two main clock generation mechanisms are internal RC type oscillators and internal oscillators using external crystals.

The MSP430FR5969 can contain several internal oscillators. Of particular note are the Digital Controlled Oscillator (DCO) and the low frequency oscillator (VLO). Both of these are based on an RC network. RC networks can be rather inaccurate in generating precise clocks, so TI has trimmed and calibrated them to reach close to 1% accuracy. These type of oscillators are heavily affected by temperature and cannot be always be used for interfaces requiring accurate timing such as UART without causing errors. The DCO is digitally controlled because its frequency can be selected from a given set of frequencies that are calibrated at the factory.

The MSP430FR5969 can also use external crystals with internal oscillator circuitry to generate both low frequency (32kHz) and high frequency (Up to 16MHz) clocks that are as accurate as the crystal used.


The clocks available are the following:

  • DCOCLK - Internal Digitally Controlled Oscillator capable of generating a factory-calibrated set of frequencies.
  • VLOCLK - Internal low frequency and low accuracy oscillator for low power
  • LFXTCLK - Low frequency mode of the XT1 oscillator, typically used with watch crystals or clocks of 32.768kHz.
  • HFXTCLK - High frequency mode of the XT1 oscillator, used with High Frequency crystals. Not available in all MSP430 (not present in G2553 device)


The clock tree in the MSP430FR5969 is actually composed of several signals whose source is selectable. This flexibility helps power CPU and peripherals using different clocks to achieve either speed or low power. The main signals in the MSP430FR5969 include:

  • Master clock (MCLK). MCLK is software selectable as a sub-frequency of LFXTCLK, VLOCLK, HFXTCLK or DCOCLK. MCLK. MCLK is used by the CPU and system.
  • Sub-main clock (SMCLK). SMCLK is software selectable as a sub-frequency of LFXT1CLK, VLOCLK or DCOCLK. SMCLK. SMCLK is software selectable for individual peripheral modules.
  • Auxiliary clock (ACLK). ACLK is software selectable as a sub-frequency of LFXT1CLK or VLOCLK. ACLK is software selectable for individual peripheral modules.

 

The CPU of the MSP430FR5969 runs only from MCLK, while other peripheral modules can be sourced by any of the clock signals or in some cases from other clock sources brought in on specific pins.

 

Power modes

The MSP430 features five modes of operation, yet the most popular 3 are the following (the others can be found in the datasheet):

1. Active mode (AM), I ≈ 300 uA
      a. All clocks are active


2. Low-power mode 0 (LPM0), I ≈ 85uA
      a. CPU is disabled
      b. ACLK and SMCLK remain active, MCLK is disabled


3. Low-power mode 3 (LPM3), I ≈ 1uA
      a. CPU is disabled
      b. MCLK and SMCLK disabled
      c. ACLK remains active
      d. DCO’s dc-generator is disabled

 

Let's code

After this overview, let's write a simple test application.

Texas Instruments provides a great graphical tool integrated into its Code Composer Studio IDE for configuring MCU peripherals: Grace.

Using Grace is very easy: just click on the sub system you want to configure..


image

.. and this will lead you to a form where peripheral settings can be easily changed


 

In the same way we can configure Timer 0 to generate an interrupt every second


image

and GPIOs



The main function is very easy


int main(void)

{

    Grace_init();                  // Activate Grace-generated configuration

 

     /* Entering low power mode 3 */

  __enable_interrupt();

  __bis_SR_register(LPM3_bits);

}

 

I simply invoke the initialization code generated by Grace, then I enable the interrupt and finally I enter the power mode 3. Because in power mode 3 the CPU is not running (only peripherals are active) a infinte loop is not required. The only code that is going to be executed is the code in the Timer 0 interrupt routine


#pragma vector=TIMER0_A0_VECTOR

__interrupt void TIMER0_A0_ISR_HOOK(void)

{

    /* USER CODE START (section: TIMER0_A0_ISR_HOOK) */

      P1OUT ^= BIT5;

    /* USER CODE END (section: TIMER0_A0_ISR_HOOK) */

}

  • Sign in to reply
  • dimonic
    dimonic over 10 years ago in reply to amgalbu

    Both very good reasons. I look forward to reading about your progress.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • amgalbu
    amgalbu over 10 years ago in reply to dimonic

    Hi Dominic

    I have chosen Peltier for two reasons

    1. because I wanted to locate the sensor near a car radiator, and there is a lot of wasted heat there

    2. because I never made any project using Peltier cell and I'm always curious to experiment new things image

     

    Bye

    Ambrogio

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dimonic
    dimonic over 10 years ago

    Good overview. Curious - why peltier - over, say, solar cell? (Thinking to scavenge some discount Noma lights for battery/solar cell combos).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • xever
    xever over 10 years ago

    Thanks, this is very useful especially that I haven't done any work with the MSP430 in the past.  Will definitely look into this.  Again, thanks... image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • tomaja
    tomaja over 10 years ago

    I used msp430 in the past but this is the first time I hear about Grace! Looks like a great tool.

    Thanks for sharing it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube