Debug report on LPC1112 deep sleep (low power consumption)

Publisher:温柔心情Latest update time:2017-12-01 Source: eefocusKeywords:lpc1112 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:lpc1112 Reference address:Debug report on LPC1112 deep sleep (low power consumption)

Previous article:LPC1788 single edge PWM principle and configuration
Next article:Address space allocation of lpc1788

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号