我关了广播和定时器还是有几个uA的跳变电流
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您可以参考TI的例程,如SimpleBLEPeripheral。若是没有任何任务需要处理发生,TI-RTOS会把设备置于待机状态。当设备需要广播时,它会自动唤醒
您可以参考appBLE.cfg。当CPU处于IDLE状态时,会使用standbyPolicy。
/* Idle CPU when threads blocked waiting for an interrupt */
Power.idle = true;
Power.policyFunc = Power.standbyPolicy;
Hi
这是一个简单的demo,在实际使用在建议您用信号量来操作。
如果是使用semphare_pend将当前任务挂起使系统进入standby的,则当其他地方(比如中断处理中)post了这个信号量,系统会退出standby,当前task继续执行semphare_pend之后的语句。在standby是无法执行任何程序的。
/* * Copyright (c) 2016-2017, 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. */ /* * ======== pinStandby.c ======== */ #include <unistd.h> /* Driver Header files */ #include <ti/drivers/PIN.h> #include <ti/drivers/pin/PINCC26XX.h> /* Example/Board Header files */ #include "Board.h" /* Led pin table */ PIN_Config LedPinTable[] = { Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ PIN_TERMINATE /* Terminate list */ }; /* * ======== mainThread ======== */ void *mainThread(void *arg0) { PIN_State pinState; PIN_Handle hPin; uint_t currentOutputVal; uint32_t standbyDuration = 5; /* Shut down external flash on LaunchPads. It is powered on by default * but can be shut down through SPI */ #ifdef Board_shutDownExtFlash Board_shutDownExtFlash(); #endif /* Allocate LED pins */ hPin = PIN_open(&pinState, LedPinTable); /* * Repeatedly sleeps for a duration, to allow repeated entry/exit * from standby. The LED states are toggled on each iteration */ while(1) { /* Sleep, to let the power policy transition the device to standby */ sleep(standbyDuration); /* Read current output value for all pins */ currentOutputVal = PIN_getPortOutputValue(hPin); /* Toggle the LEDs, configuring all LEDs at once */ PIN_setPortOutputValue(hPin, ~currentOutputVal); } }
我用例程进低功耗和我加了传感器程序进低功耗都有这个毛病,我按照手册近低功耗的办法,关闭射频广播和所有定时任务定时器,再进入低功耗的时候还是有几个uA的跳变电流,周期在几秒钟内从0.1uA跳到8uA左右。是否与io口漏电流有关如果是该怎么操作