I think power management and monitoring is a very complex and difficult part to master. It not only involves the selection of source mode, but also involves complex interrupts and how to handle interrupts, etc. Although learning this part well is very helpful to achieve the goal of reducing power consumption, it seems that the term "power consumption" is still a little far away for us at present. In addition, this part of the control is very helpful to prevent and deal with power supply accidents (too high, too low, etc.). However, it seems that if this development board is not used independently for projects but is only connected to the computer USB for power supply, there will generally be no problems. Therefore, I also only plan to learn it briefly. (I will learn it carefully later if I have the opportunity). The
I/O port and all analog units including the crystal oscillator are powered by DVCC. The memory (flash and RAM) and digital units are powered by the core voltage VCORE.
DVCC: wide power supply voltage range 1.8V-3.6V;
VCORE: DVCC generates a secondary core voltage through a low dropout voltage regulator (LDO), which is specifically used to power the CPU digital logic. There are four levels: 1.4V (0-12MHZ), 1.6V (0-16MHZ), 1.8V (0-20MHZ) and 1.9V (0-25MHZ). The minimum allowable voltage of VCORE depends on the selected MCLK size, which means that a higher VCORE is required for high main frequency.
Management will generate a reset (mainly during power-on), and monitoring will generate an interrupt (monitoring whether the voltage is too high or too low).
The most common function we use is to set the core voltage VCORE. Fortunately, there is a special function library HAL_PMM.c/h.
In addition to some setting definitions in this function library, the most important thing is to define three functions:
SetVCoreDown(uint8_t level): lower the core voltage
SetVCoreUp(uint8_t level): increase the core voltage
SetVCore(uint8_t level): directly set the core voltage value (0-3, a total of four levels)
/*This function is the most important, or in other words, with this one, the previous two are not needed*/
V. System working mode
In Chapter 4, we mentioned that we can start from the power layer to achieve the purpose of controlling power consumption from the source. In this chapter, we will talk about the CPU working mode and how to control power consumption from the next level.
In different working modes, the CPU will disable some modules to achieve the purpose of controlling power consumption.
(PS: The same sentence, "power consumption is too far", generally will not change the working mode, so it is simple to learn)
A few words of introduction: ① Changing the working mode will take effect immediately;
② When an interrupt occurs, the current mode setting information will be saved for recovery (unless the working mode is changed in the interrupt service program);
③ When in LPM4.5 mode, PMM's power supervision will not take effect, all RAM and registers will be lost, but the I/O port status will be locked;
④ There is a special process for waking up from LPM4.5, go and see if you are interested;
the following picture is very interesting, you can clearly see the process and direction of conversion between working modes, as well as how each working mode is set and what parts are controlled.
BOR: Brown-Out Reset Low Voltage Detection Reset (Undervoltage Reset)
POR: Power-On Reset
PUC: Power-Up Clear
The light-colored part indicates an event, and the dark-colored part indicates an operation or setting.
① Setting the working mode mainly involves setting the SCG0, SCG1, OSCOFF, and CPUOFF bits of the register SR.
In the AM (Active Mode) mode, all four bits are set to zero, and the system defaults to the AM mode;
② Except for AM, the rest are low-power modes. After the processor enters the low-power mode, it is generally awakened by an interrupt. It can be an external interrupt or an internal timer interrupt; ③
In the LPM0-LPM4 mode, the peripheral modules will work normally, and the RTC clock will not stop;
④ To enter the LPM4.5 mode (less commonly used), you only need to set one more PMMREGOFF on the basis of LPM4. In this mode, all the system clocks, memories, and supervision and management mechanisms are stopped, and even the real-time clock RTC is prohibited from operating.
⑤LPM0 and LPM1 are a group. In addition to the features shown in the figure above, SMCLK is enabled (SMCLKOFF = 0) in this mode. If the clock source of DCO is ACLK or SMCLK, DCO is also valid.
⑥LPM2 and LPM3 are a group. In addition to the features shown in the figure above, SMCLK is disabled in this mode. If the clock source of DCO is ACLK, DCO is also valid.
⑦The header file of MSP430 has a detailed definition of low power mode. For example, to enter low power mode 0, you can directly write LPM0 in the program; to enter low power mode 4, you can directly write LMP4. Exit low power mode as follows:
LPM0_EXIT; //Exit low power mode 0 //It's so convenient, isn't it?
LPM4_EXIT; //Exit low power mode 4 (except LPM4.5)
Summary of the experiment: A very interesting program
/*The embodiment of low power mode, no infinite loop, the program will not terminate*/
/*You will find that the statements after LPM3 will not be executed, the program will only execute the interrupt service program periodically, this is because MCLK, SMCLK and FLL are disabled in LPM3 mode*/
#include
void main(void)
{
WDTCTL=WDTPW+WDTCNTCL+WDTTMSEL+WDTIS1+WDTIS0;//WDT is used as a timer
SFRIE1|=WDTIE; //Open watchdog interrupt
P1DIR|=BIT1+BIT2; //P1.1 is connected to LED and set to output direction
P1OUT=BIT1+BIT2;
__enable_interrupt(); //Open general interrupt
//_BIS_SR(GIE); This sentence also means opening general interrupt
/*Here is a usage_BIS_SR(): set the variable in brackets*/
LPM3; //Enter LPM3 low power mode, SMCLK is disabled in this mode
P1OUT&=~BIT2;//This sentence cannot be executed, so P1.2 will remain on and will not dim
}
#pragma vector=WDT_VECTOR
__interrupt void WatchTimer(void)
{
P1OUT^=BIT1; //Timed flip to achieve flashing
}
Keywords:MSP430F5529
Reference address:MSP430F5529 (IV) Power Supply &&& (V) Operating Mode
I/O port and all analog units including the crystal oscillator are powered by DVCC. The memory (flash and RAM) and digital units are powered by the core voltage VCORE.
DVCC: wide power supply voltage range 1.8V-3.6V;
VCORE: DVCC generates a secondary core voltage through a low dropout voltage regulator (LDO), which is specifically used to power the CPU digital logic. There are four levels: 1.4V (0-12MHZ), 1.6V (0-16MHZ), 1.8V (0-20MHZ) and 1.9V (0-25MHZ). The minimum allowable voltage of VCORE depends on the selected MCLK size, which means that a higher VCORE is required for high main frequency.
Management will generate a reset (mainly during power-on), and monitoring will generate an interrupt (monitoring whether the voltage is too high or too low).
The most common function we use is to set the core voltage VCORE. Fortunately, there is a special function library HAL_PMM.c/h.
In addition to some setting definitions in this function library, the most important thing is to define three functions:
SetVCoreDown(uint8_t level): lower the core voltage
SetVCoreUp(uint8_t level): increase the core voltage
SetVCore(uint8_t level): directly set the core voltage value (0-3, a total of four levels)
/*This function is the most important, or in other words, with this one, the previous two are not needed*/
V. System working mode
In Chapter 4, we mentioned that we can start from the power layer to achieve the purpose of controlling power consumption from the source. In this chapter, we will talk about the CPU working mode and how to control power consumption from the next level.
In different working modes, the CPU will disable some modules to achieve the purpose of controlling power consumption.
(PS: The same sentence, "power consumption is too far", generally will not change the working mode, so it is simple to learn)
A few words of introduction: ① Changing the working mode will take effect immediately;
② When an interrupt occurs, the current mode setting information will be saved for recovery (unless the working mode is changed in the interrupt service program);
③ When in LPM4.5 mode, PMM's power supervision will not take effect, all RAM and registers will be lost, but the I/O port status will be locked;
④ There is a special process for waking up from LPM4.5, go and see if you are interested;
the following picture is very interesting, you can clearly see the process and direction of conversion between working modes, as well as how each working mode is set and what parts are controlled.
BOR: Brown-Out Reset Low Voltage Detection Reset (Undervoltage Reset)
POR: Power-On Reset
PUC: Power-Up Clear
The light-colored part indicates an event, and the dark-colored part indicates an operation or setting.
① Setting the working mode mainly involves setting the SCG0, SCG1, OSCOFF, and CPUOFF bits of the register SR.
In the AM (Active Mode) mode, all four bits are set to zero, and the system defaults to the AM mode;
② Except for AM, the rest are low-power modes. After the processor enters the low-power mode, it is generally awakened by an interrupt. It can be an external interrupt or an internal timer interrupt; ③
In the LPM0-LPM4 mode, the peripheral modules will work normally, and the RTC clock will not stop;
④ To enter the LPM4.5 mode (less commonly used), you only need to set one more PMMREGOFF on the basis of LPM4. In this mode, all the system clocks, memories, and supervision and management mechanisms are stopped, and even the real-time clock RTC is prohibited from operating.
⑤LPM0 and LPM1 are a group. In addition to the features shown in the figure above, SMCLK is enabled (SMCLKOFF = 0) in this mode. If the clock source of DCO is ACLK or SMCLK, DCO is also valid.
⑥LPM2 and LPM3 are a group. In addition to the features shown in the figure above, SMCLK is disabled in this mode. If the clock source of DCO is ACLK, DCO is also valid.
⑦The header file of MSP430 has a detailed definition of low power mode. For example, to enter low power mode 0, you can directly write LPM0 in the program; to enter low power mode 4, you can directly write LMP4. Exit low power mode as follows:
LPM0_EXIT; //Exit low power mode 0 //It's so convenient, isn't it?
LPM4_EXIT; //Exit low power mode 4 (except LPM4.5)
Summary of the experiment: A very interesting program
/*The embodiment of low power mode, no infinite loop, the program will not terminate*/
/*You will find that the statements after LPM3 will not be executed, the program will only execute the interrupt service program periodically, this is because MCLK, SMCLK and FLL are disabled in LPM3 mode*/
#include
void main(void)
{
WDTCTL=WDTPW+WDTCNTCL+WDTTMSEL+WDTIS1+WDTIS0;//WDT is used as a timer
SFRIE1|=WDTIE; //Open watchdog interrupt
P1DIR|=BIT1+BIT2; //P1.1 is connected to LED and set to output direction
P1OUT=BIT1+BIT2;
__enable_interrupt(); //Open general interrupt
//_BIS_SR(GIE); This sentence also means opening general interrupt
/*Here is a usage_BIS_SR(): set the variable in brackets*/
LPM3; //Enter LPM3 low power mode, SMCLK is disabled in this mode
P1OUT&=~BIT2;//This sentence cannot be executed, so P1.2 will remain on and will not dim
}
#pragma vector=WDT_VECTOR
__interrupt void WatchTimer(void)
{
P1OUT^=BIT1; //Timed flip to achieve flashing
}
Previous article:MSP430F5529 (VI) Timer Timer_A-1
Next article:MSP430F5529 (III) Unified Clock System UCS-2
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
Guess you like
- Please tell me how to use the IS pin of BTS7960
- Share a summary of CNC power supply solutions, very detailed
- DIY flapping-wing aircraft, focusing on the mechanical structure and flight control system principles (including open source materials)
- Hongmeng Development Board Neptune (Part 2) - Development Environment
- Main steps when configuring the EMIFA module using CSL
- Hi guys!
- ST MEMS Creative Competition Post 4 - Robotic Arm Control
- Detailed explanation of the national standard GB/T 17626 for EMC testing
- Allwinner V853 Modify UART pins and UART ports in Tina Linux (2)
- Bluetooth 5 standard