Since the product is a mobile device, the power consumption requirement is relatively strict. Currently, a large MCU + small MCU is used. The small MCU mainly controls the power supply of the large MCU to achieve the lowest power consumption of the system. Of course, it is also required that the small microcontroller enters a low power consumption state when not working.
The large MCU currently uses LPC1788, and the theoretical minimum power consumption in power-down mode is 65uA, but it is not that low in actual debugging (because the peripherals are not completely powered off). Therefore, the small MCU is used to control the power supply of the large MCU, and supply power to the large MCU when needed.
The small MCU uses LPC111x (lpc1112/28pin), and the theoretical value of deep sleep mode is about 6uA (this.).
Without any peripherals connected, the deep sleep power consumption of Lpc1112 is first tested, and currently reaches about 5uA.
The following is the source code:
#include "nxplpc11xx.h"
#include "pmu.h"
#define NVIC_LP_SLEEPDEEP 1<<2
extern int key_value;
void WAKEUP6_IRQHandler(void)
{
//PMU->PCON = (1<<8); //Clear flag
SYSCON->STARTRSRP0CLR = 1<<6; /*Clear wake-up interrupt flag */
__nop();
key_value=2;
}
void WAKEUP5_IRQHandler(void)
{
//PMU->PCON = (1<<8); //Clear flag
SYSCON->STARTRSRP0CLR = 1<<5; /*Clear wake-up interrupt flag */
__nop();
key_value=1;
}
void config_ios(void);
void PMU_DeepSleep(void)
{
//reset IOs
config_ios();
/* Specify peripherals to be powered up again when returning from deep sleep mode */
SYSCON->PDAWAKECFG = SYSCON->PDRUNCFG;
SYSCON->PDRUNCFG |=(1<<3); //BOD power down
/* Switch MAINCLKSEL to IRC */
SYSCON->MAINCLKSEL = 0;
SYSCON->MAINCLKUEN = 0;
SYSCON->MAINCLKUEN = 1;
while (!(SYSCON->MAINCLKUEN & 0x01));
/* Ensure DPDEN is disabled in the power control register */
PMU->PCON = (1<<11); //Clear DPDFLAG if it was set
/* Clear the Deep Sleep Flag */
PMU->PCON = (1<<8);
/* All OFF */
//SYSCON->PDSLEEPCFG = 0x000018FF;
SYSCON->PDSLEEPCFG = 0x0000ffFF;
/* Specify peripherals to be powered up again when returning from deep sleep mode */
//SYSCON->PDAWAKECFG = SYSCON->PDRUNCFG;
///GPIO0-6
IOCON->PIO0_6 &= ~0x07;
IOCON->PIO0_6 |= 0x20;
GPIO0->DIR &= ~(0x01 << 6);
IOCON->PIO0_5 &= ~0x07;
IOCON->PIO0_5 |= 0x20;
GPIO0->DIR &= ~(0x01 << 5);
/* Only edge trigger. activation polarity on P0.5 p0.6 is FALLING EDGE. */
SYSCON->STARTAPRP0 &=~(1<<6|1<<5); //0x00000000;
/* Clear all wakeup sources */
SYSCON->STARTRSRP0CLR |=(1<<6|1<<5); //0xFFFFFFFF;
/* Enable Port 0.4 as wakeup source. */
SYSCON->STARTERP0 = (0x1<<6|1<<5);
NVIC_ClearPendingIRQ(WAKEUP6_IRQn);
NVIC_EnableIRQ(WAKEUP6_IRQn); // P0.6 as wakeup
NVIC_ClearPendingIRQ(WAKEUP5_IRQn);
NVIC_EnableIRQ(WAKEUP5_IRQn); // P0.5 as wakeup
SCB->SCR = NVIC_LP_SLEEPDEEP; //0x04
/* Enter Deep Sleep mode */
__wfi();
}
void config_ios(void)
{
/* Configure all IOs as GPIO w/o pull-up & pull-down resistors */
IOCON->RESET_PIO0_0 = 0xC8; // RST_BOOT/P0_0
IOCON->PIO0_1 = 0xC8; //0xC0; // CLKOUT/CT32B0_MAT2/USB_SOF
IOCON->PIO1_8 = 0xC8;
IOCON->PIO0_2 = 0xC8; // SSEL/CT16B0_CAP0 //Trigger input
IOCON->PIO0_3 = 0xC8; //
IOCON->PIO0_4 = 0x80; // PIO
IOCON->PIO0_5 = 0x80; // PIO
IOCON->PIO1_9 = 0xC8; // CT16B1_MAT0
IOCON->PIO0_6 = 0xC8; // SCK0
IOCON->PIO0_7 = 0xC8;
IOCON->PIO0_8 = 0xC8; //0xC0; // SSP_MISO/CT16B0_MAT0/TRACE_CLK; MISO
IOCON->PIO0_9 = 0xC8; //0xC0; // SSP_MOSI/CT16B0_MAT1/TRACE_SWV; MOSI
IOCON->PIO0_10 = 0xC8; // JTAG_CLK/P0_10/SSP_CLK/CT16B0_MAT2
//IOCON->PIO1_10 = 0xC8; // ADCIN6/CT16B1_MAT1
IOCON->PIO0_11 = 0xC9; // JTAG_TDI/P0_11/ADCIN0/CT32B0_MAT3
IOCON->PIO1_0 = 0xC9; // JTAG_TMS/P1_0/ADCIN1/CT32B1_CAP0
IOCON->PIO1_1 = 0xC9; // JTAG_TDO/P1_1/ADCIN2/CT32B1_MAT0
IOCON->PIO1_2 = 0xC9; // JTAG_TRST/P1_2/ADCIN3/CT32B1_MAT1
IOCON->PIO1_3 = 0xC9; // ARM_SWD/P1_3/ADCIN4/CT32B1_MAT2
IOCON->PIO1_4 = 0xC8; // ADCIN5/CT32B1_MAT3/WAKEUP
//IOCON->PIO1_11 = 0xC8; // ADCIN7
IOCON->PIO1_5 = 0xC9; // UART_DIR/CT32B0_CAP0
IOCON->PIO1_6 = 0xC9; // UART_RXD/CT32B0_MAT0
IOCON->PIO1_7 = 0xC9; // UART_TXD/CT32B0_MAT1
/* GPIOs at outputs */
GPIO0->DIR = ~0; //Trigger Pin input only
GPIO1->DIR = ~0; //WAKEUP Pin and PIO1_6/RXD input only
/* GPIO outputs to LOW */
GPIO0->DATA = 0x0;
GPIO1->DATA = 0x0;
/* GPIOs at inputs */
GPIO0->DIR = 0;
GPIO1->DIR = 0;
return;
}
1. io needs to be reconfigured, function config_ios:
a) Configure the normal IO port function and pull it down
b) Set io to output mode and output signal to 0;
c) Set the IO port to input again. (Experiments have shown that if it is no longer set to input mode, power consumption will increase)
Note: The configuration of the IO port has also been tested on the LPC1788 chip. The above operation will reduce the power consumption. Therefore, the MCU needs to enter a low power consumption state, and the IO configuration is temporarily performed as above.
2. The above configurations do not debug every line of code, and some configurations may be configured to other values.
in:
SYSCON->PDRUNCFG |=(1<<3); //BOD power down//
//SYSCON->PDSLEEPCFG = 0x000018FF;
SYSCON->PDSLEEPCFG = 0x0000ffFF;
These two codes cannot be removed.
Configuring SYSCON->PDSLEEPCFG to 0x00000aff will also increase power consumption. Configuring the bit 0x000018FF has lower power consumption, so after looking at the registers, if there is no major problem, simply configure them all to 0x0000ffFF.
Because I just started building the project and looking for information yesterday, I am not very familiar with LPC1112, but it can basically meet the power consumption requirements. I will record it for now. I still need to have a deeper understanding of the low-power configuration of this microcontroller later.
Previous article:LPC1788 single edge PWM principle and configuration
Next article:Address space allocation of lpc1788
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to Meet the Testing Challenges of Multi-Antenna Systems
- A beginner was trapped by the garbage code of the development board for a whole night
- SinlinxA33 development board Linux platform bus device driver
- MSP430 MCU application of timer, PWM, comparator
- I need help. I am using AD17 to learn how to draw a 4-layer board. Is there any good teaching guide?
- Also on the G-question of the electronic competition
- Basic Concepts of A/D and D/A
- Dear masters, please answer this for me. I am waiting.
- EEWORLD University Hall----Live Replay: ADI Motor Control Solutions
- Here are some more