使用MSP430F5255单片机,外围电路全部没有焊接,只接了晶振和外部滤波电容。系统使用的是外部晶振12M,所有IO口配置为输出,并且拉低。进入LPM3模式,测得的电流有350uA,和datasheet里面说的25uA差了10倍,请问是什么问题?
Ling Zhu2:
用什么供电的? 有LDO没?
晶振使能没有,默认应该不是用晶振的。
xiaoli:
回复 Ling Zhu2:
直接用直流稳压电源供电,晶振已经起振。有个奇怪的问题,就是进入LPM3模式,晶振居然还是起振的,但是SMCLK已经停止
Ling Zhu2:
回复 xiaoli:
/* --COPYRIGHT--,BSD_EX* Copyright (c) 2012, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**********************************************************************************MSP430 CODE EXAMPLE DISCLAIMER** MSP430 code examples are self-contained low-level programs that typically* demonstrate a single peripheral function or device feature in a highly* concise manner. For this the code may rely on the device's power-on default* register values and settings such as the clock configuration and care must* be taken when combining code from several examples to avoid potential side* effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware* for an API functional library-approach to peripheral configuration.** --/COPYRIGHT--*/ //****************************************************************************** //MSP430x552x Demo - Enters LPM3 with ACLK = LFXT1, REF0 disabled,//VUSB LDO and SLDO disabled, SVS disabled // //Description: Configure ACLK = LFXT1 and enters LPM3. Measure current. //ACLK = LFXT1 = 32kHz, MCLK = SMCLK = default DCO // //MSP430F552x //----------------- ///|\ |XIN|- //||| 32kHz //---|RSTXOUT|- //|| // //Bhargavi Nisarga //Texas Instruments Inc. //April 2009 //Built with CCSv4 and IAR Embedded Workbench Version: 4.21 //****************************************************************************** #include <msp430.h>int main(void) {WDTCTL = WDTPW + WDTHOLD;// Stop watchdog timer// Enable XT1P5SEL |= BIT4+BIT5;// Port select XT1UCSCTL6 &= ~(XT1OFF);// XT1 OnUCSCTL6 |= XCAP_3;// Internal load cap// Loop until XT1 & DCO stabilizesdo{UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);// Clear XT2,XT1,DCO fault flagsSFRIFG1 &= ~OFIFG;// Clear fault flags}while (SFRIFG1&OFIFG);// Test oscillator fault flagUCSCTL6 &= ~(XT1DRIVE_3);// Xtal is now stable, reduce drive// strength// Port ConfigurationP1OUT = 0x00;P2OUT = 0x00;P3OUT = 0x00;P4OUT = 0x00;P5OUT = 0x00;P6OUT = 0x00;P7OUT = 0x00;P8OUT = 0x00;PJOUT = 0x00;P1DIR = 0xFF;P2DIR = 0xFF;P3DIR = 0xFF;P4DIR = 0xFF;P5DIR = 0xFF;P6DIR = 0xFF;P7DIR = 0xFF;P8DIR = 0xFF;PJDIR = 0xFF;// Disable VUSB LDO and SLDOUSBKEYPID=0x9628;// set USB KEYandPID to 0x9628// access to USB config registers enabledUSBPWRCTL &= ~(SLDOEN+VUSBEN);// Disable the VUSB LDO and the SLDOUSBKEYPID=0x9600;// access to USB config registers disabled// Disable SVSPMMCTL0_H = PMMPW_H;// PMM PasswordSVSMHCTL &= ~(SVMHE+SVSHE);// Disable High side SVSSVSMLCTL &= ~(SVMLE+SVSLE);// Disable Low side SVS__bis_SR_register(LPM3_bits);// Enter LPM3__no_operation();// For debugger }
xiaoli:
回复 Ling Zhu2:
用你的代码试了,测试电流有20mA。下面是我自己配置的代码。测试的是350uA。
//外部晶振12M void SystemInit(void) {__delay_cycles(5000);P5SEL |= BIT2 + BIT3;UCSCTL6 &= ~XT2OFF;do{UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);// Clear XT2,XT1,DCO fault flagsSFRIFG1 &= ~OFIFG;// Clear fault flags}while (UCSCTL7 & XT2OFFG);// Test oscillator fault flagUCSCTL6 &= ~(XT2DRIVE_2);UCSCTL6 |= XT2DRIVE_1;UCSCTL4 |= SELM__XT2CLK + SELS__XT2CLK + SELA__REFOCLK; }void GPIO_Init(void) {P1DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;P2DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;P3DIR |= BIT0+BIT1+BIT2+BIT3+BIT4;P4DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;P6DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7;P7DIR |= BIT0+BIT1+BIT2+BIT3+BIT4+BIT5;PJDIR |= BIT0+BIT1+BIT2+BIT3;P1OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7);P2OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7);P3OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4);P4OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7);P6OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7);P7OUT &= ~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5);PJOUT &= ~(BIT0+BIT1+BIT2+BIT3); }void Bsp_Init(void) {SystemInit();GPIO_Init();_EINT(); }void main( void ) {Bsp_Init();__bis_SR_register(LPM3_bits);while(1); }
Ling Zhu2:
回复 xiaoli:
因为你用REFO了
建议 XT1 用32.768kHz晶振 作为 ACLK 的source。
xiaoli:
回复 Ling Zhu2:
不使用REFOCLK也是一样的,电流也是300多uA。请问进入低功耗模式LPM3,外部晶振是不是马上停止振动,还是说需要手动去关闭振动?发现把晶振关掉,功耗就降下去了
灰小子:
回复 xiaoli:
对功耗要求比较苛刻的话,完全没必要用外部晶振。