2330 views|2 replies

6547

Posts

0

Resources
The OP
 

MSP430 power saving mode wake-up method [Copy link]

1 Introduction to MSP430 power saving methods

MSP430 is famous for its low power consumption. It can connect to two external clock sources - XIN and XT2IN. It also has an internal DC0 oscillator that can generate an internal clock of up to 8 MHz. Generally, the frequency of XT2IN is high frequency, which is selected according to the requirements of actual application; XIN is low frequency, which can be 32 768Hz. The purpose of XIN is mainly to keep the system "alive" at low power consumption. MSP430 has 5 power saving modes, namely LPM0~4. Among them,

LPM0: CPU, MCLK off, SMCLK, ACLK on, power consumption 79uA;
LPM1: CPU, MCLK, DCO off, SMCLK, ACLK on, power consumption 4luA;
LPM2: CPU, MCLK, SMCLK, DC0 off, DC generator, ACLK on, power consumption 17uA;
LPM3: CPU, MCLK, SMCLK, DC0, DC generator off, ACLK on. Power consumption 2uA;
LPM4: CPU and all modules are off, power consumption 0.1 uA.

The system can be awakened in LPMO-3 mode, but not in LPM4. Most applications want the MSP430 to enter sleep mode to reduce power consumption, and then wake up at a fixed time or by an external interrupt, execute the corresponding program, enter sleep mode again, and then wake up again. Among them, LPM3 is the most commonly used mode because it meets the requirements and has the lowest power consumption. This article discusses sleep and wake-up in this mode.

2 Sleep and wake up

The main program loop running process is shown in Figure 1.

In each loop, it is necessary to determine whether the sleep condition is met. If so, the clock is switched and the system enters sleep mode. At this point, the CPU no longer executes any program until it is awakened. The awakening condition can be a timer interrupt, an external I/O interrupt, or a serial port interrupt. The following PowerManagement code is the corresponding operation performed before and after entering sleep mode and after being awakened. The SerialReceiveInterrupt code is the corresponding operation performed after the serial port receives a character interrupt, and the TimerBInterrupt code is the corresponding operation performed after the timer B5 timer expires. In both interrupt programs, before waking up the CPU, the clock is adjusted to the high-speed clock source during normal operation, the corresponding flag is set, and then the wake-up subroutine clrLPM3 is executed. The compilation software is IAR embedded workbench 1.26.

3. Sleep duration

If the sleep state is awakened by a serial port interrupt, the sleep duration is indefinite, and it will wake up when an interrupt comes. Therefore, we only discuss the case where the timer generates an interrupt to wake up.

The description of the control register of Timer B is shown in Figure 2.


Figure 2 Control register of timer B

CNTLx: Counter length, 00=16 bits, the maximum TBR of the counter of MSP430 timer B is 0xFFFF; 01=12 bits, the maximum TBR is 0x0FFF, 10=10 bits, the maximum TBR is 0x03FF, 11=8 bits, the maximum TBR is 0xFF.

TBSSELx: Clock source selection for timer B, 00=TBCLK, 01=ACLK, 10=SMCLK, 11=INCLK.

IDx: The clock source division factor of timer B, 00 = no division, 01 = 2 division, 10 = 4 division, 11 = 8 division.

MCx: Counting mode selection bit of timer B, 00 = pause counting, 01 = add counting mode, 10 = continuous counting mode, 11 = add and subtract counting mode. For details, please refer to the MSP430 data sheet.

In the above program, the control word of timer B is TBCTL = TBSSEL0 + ID0 + ID1 + MC1 + TBCLR. The clock source of timer B is selected as TBSSEL0, which is defined as 0x0100 in the MSP430x14x.h header file, that is, the selected clock source is ACLK (32768hz). ID0 is defined as 0x40 in MSP430x14x.h, and ID1 is defined as 0x80 in MSP430x14x.h. The sum of the two is 0xC0, that is, the clock source of timer B is divided by 8. MC1 is defined as 0x20 in MSP430x14x.h, that is, timer B uses continuous counting mode.

The clock selected above is ACLK as 32 768, and then divided by 8, which is equal to 4 096. The final running frequency of the clock of timer B is 4 096 Hz, and the time required to count one number is (1/4 096) s. Since the count value of timer B5 is set to TBR-10=0xFFFF-10=0xFFF0=65 536-10=65 526, the time required to count 65 526 numbers is 65 526×(1/4 096) s=15.997 s≈16 s. Therefore, the maximum sleep time does not exceed 16 s when the timer is used to generate an interrupt as the wake-up source. If the task does not need to be executed so quickly, you can not execute the task every time you wake up, but add 1 to a counting variable, and then continue to enter the sleep state until the counting variable is equal to the desired duration.

Conclusion

MSP430 is a very good low-power microcontroller. By using its power-saving function, the battery life can be greatly extended. Therefore, this product is widely used in battery-powered industrial control products. The codes in this article are all program codes in actual applications and have been tested in practice.

This post is from Microcontroller MCU

Latest reply

The low power consumption of 430, the sleep and wake-up program operation is very important, otherwise it will not be low power consumption   Details Published on 2020-7-29 07:36
 

4817

Posts

4

Resources
2
 

Can you make a serial ZIP and see

This post is from Microcontroller MCU
 
 

2w

Posts

341

Resources
3
 

The low power consumption of 430, the sleep and wake-up program operation is very important, otherwise it will not be low power consumption

This post is from Microcontroller MCU
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list