TI中文支持网
TI专业的中文技术问题搜集分享网站

MSP432P401R怎样降低功耗

我正在使用MSP432 LaunchPad ,现在烧入了例程GPIO interrupt,,测量最低电流在1.8~2.1mA之间浮动,请问怎样降低功耗并稳定电流?

灰小子:

没有使用到的io,注意将其设置为输出;或者是设置为输入,但是将管脚的电平固定,可以通过外部电路将管脚连接至Vcc或者GND,也可使能内部上下拉电阻,将管脚电平固定。

user5760268:

回复 Susan Yang:

我是个新手,有没有更简单明了的东西呢?谢谢

user5760268:

回复 灰小子:

我下载了一个Ti官方低功耗例程,就是您说的设置io电平,以及进入LPM3模式,烧入后电流可以降到1.2uA左右,然后使用Empty Project例程整合低功耗例程到Task返回函数里,只能降低到1.0mA左右,而且无法唤醒。不知道有没有什么更好的方法降低功耗。新手的我现在很绝望啊。谢谢了

灰小子:

回复 user5760268:

要结合具体的应用来分析的,建议详细描述下你的需求,并提供下现在的代码

user5760268:

回复 灰小子:

以下为代码
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>

/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
// #include <ti/drivers/I2C.h>
// #include <ti/drivers/SDSPI.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/UART.h>
// #include <ti/drivers/Watchdog.h>
// #include <ti/drivers/WiFi.h>

/* Board Header file */
#include "Board.h"
void MSP_LOWPOWER(void);
#define TASKSTACKSIZE512
Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];
/**======== heartBeatFxn ========*Toggle the Board_LED0. The Task_sleep is determined by arg0 which*is configured for the heartBeat Task instance.*/
Void heartBeatFxn(UArg arg0, UArg arg1)
{Task_sleep((UInt)arg0);/* Hold the watchdog */WDTCTL = WDTPW | WDTHOLD;/* Configuring P1.0 as output and P1.1 (switch) as input with pull-up resistor*//* Rest of pins are configured as output low *//* Notice intentional '=' assignment since all P1 pins are being deliberately configured */P1DIR = ~(uint8_t) BIT1;P1OUT = BIT1;P1REN = BIT1;// Enable pull-up resistor (P1.1 output high)P1SEL0 = 0;P1SEL1 = 0;P1IFG = 0;// Clear all P1 interrupt flagsP1IE = BIT1;// Enable interrupt for P1.1P1IES = BIT1;// Interrupt on high-to-low transition
// Enable Port 1 interrupt on the NVICNVIC->ISER[1] = 1 << ((PORT1_IRQn) & 31);
// Terminate all remaining pins on the deviceP2DIR |= 0xFF; P2OUT = 0;P3DIR |= 0xFF; P3OUT = 0;P4DIR |= 0xFF; P4OUT = 0;P5DIR |= 0xFF; P5OUT = 0;P6DIR |= 0xFF; P6OUT = 0;P7DIR |= 0xFF; P7OUT = 0;P8DIR |= 0xFF; P8OUT = 0;P9DIR |= 0xFF; P9OUT = 0;P10DIR |= 0xFF; P10OUT = 0;
/* Configure Port J */PJDIR |= (BIT2 | BIT3); PJOUT &= ~(BIT2 | BIT3);
/* PJ.0 & PJ.1 configured for XT1 */PJSEL0 |= BIT0 | BIT1;PJSEL1 &= ~(BIT0 | BIT1);
/* Starting LFXT in non-bypass mode without a timeout. */CS->KEY = CS_KEY_VAL ;CS->CTL1 &= ~(CS_CTL1_SELA_MASK | CS_CTL1_SELB | CS_CTL1_SELM_MASK);CS->CTL1 |= CS_CTL1_SELA__LFXTCLK;// Source LFXTCLK to ACLK & BCLKCS->CTL2 &= ~(CS_CTL2_LFXTDRIVE_MASK);// Configure to lowest drive-strengthCS->CTL2 |= CS_CTL2_LFXT_EN;while (CS->IFG & CS_IFG_LFXTIFG)CS->CLRIFG |= CS_IFG_LFXTIFG;CS->KEY = 0;/* Turn off PSS high-side supervisors */PSS->KEY = PSS_KEY_KEY_VAL;PSS->CTL0 |= PSS_CTL0_SVSMHOFF;PSS->KEY = 0;
/* Enable PCM rude mode, which allows to device to enter LPM3 without waiting for peripherals */PCM->CTL1 = PCM_CTL0_KEY_VAL | PCM_CTL1_FORCE_LPM_ENTRY;
/* Enable all SRAM bank retentions prior to going to LPM3*/SYSCTL->SRAM_BANKRET |= SYSCTL_SRAM_BANKRET_BNK7_RET;__enable_interrupt();SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;// Do not wake up on exit from ISR

/* Setting the sleep deep bit */SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk);/* Go to LPM3 */__sleep();
}

/**======== main ========*/
int main(void)
{Task_Params taskParams;
/* Call board init functions */Board_initGeneral();Board_initGPIO();// Board_initI2C();// Board_initSDSPI();// Board_initSPI();// Board_initUART();// Board_initWatchdog();// Board_initWiFi();

/* Construct heartBeat Taskthread */Task_Params_init(&taskParams);taskParams.arg0 = 5000;taskParams.stackSize = TASKSTACKSIZE;taskParams.stack = &task0Stack;Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
/* Turn on user LED */GPIO_write(Board_LED0, Board_LED_ON);
/* Start BIOS */BIOS_start();
return (0);
}
/* Port1 ISR */
void PORT1_IRQHandler(void)
{volatile uint32_t i, status;/* Toggling the output on the LED */if(P1IFG & BIT1)P1OUT ^= BIT0;
/* Delay for switch debounce */for(i = 0; i < 10000; i++)
P1IFG &= ~BIT1;

}
代码是结合了empty project与论坛下载的官方低功耗例程。
应用就是在学习怎样在一个task里进入LPM3,并且要做到可以随时唤醒。

gaoyang9992006:

你少如的这个例子是没有实现低功耗的,你要进入几种低功耗模式再测就不一样了。

user5760268:

回复 gaoyang9992006:

谢谢

赞(0)
未经允许不得转载:TI中文支持网 » MSP432P401R怎样降低功耗
分享到: 更多 (0)