CC1310 standby模式功耗问题

2019-07-17 14:31发布

本帖最后由 fuyuqingfeng 于 2017-6-13 16:56 编辑

1、请教下 CC1310基于TI_RTOS 如何配置进入standby模式,不是task_sleep()  是系统进入睡眠,以实现超低功耗。资料说TI_RTOS会自动管理电源进入低功耗模式,条件是在所有任务挂起的情况下。这样就不能自主的控制功耗,请问有什么方法能实现在想要进入standby时再进入?
2、使用pinstandby例程时,测试的standby模式下电流为几个uA,手册上说的是0.7uA,怎么配置才能达到手册上的参考值?

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
11条回答
fuyuqingfeng
2019-07-18 00:12
fuyuqingfeng 发表于 2017-6-8 23:08
有没有例程代码看下呢?我刚接触这个芯片和TI的rtos  很多都不太懂

这是官方例程pinstandby,它只是在线程里调用sleep()

int main(void)
{
    pthread_t           thread;
    pthread_attr_t      pAttrs;
    struct sched_param  priParam;
    int                 retc;
    int                 detachState;

    /* Call driver init functions */
    Board_initGeneral();

    /* Set priority and stack size attributes */
    pthread_attr_init(&pAttrs);
    priParam.sched_priority = 1;

    detachState = PTHREAD_CREATE_DETACHED;
    retc = pthread_attr_setdetachstate(&pAttrs, detachState);
    if (retc != 0) {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }

    pthread_attr_setschedparam(&pAttrs, &priParam);

    retc |= pthread_attr_setstacksize(&pAttrs, THREADSTACKSIZE);
    if (retc != 0) {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }

    retc = pthread_create(&thread, &pAttrs, mainThread, NULL);
    if (retc != 0) {
        /* pthread_create() failed */
        while (1);
    }

    BIOS_start();

    return (0);
}

void *threadFxn0(void *arg0)
{
    PIN_State   pinState;
    PIN_Handle  hPin;
    uint_t      currentOutputVal;
    uint32_t    standbyDuration = 5;

    /* Allocate LED pins */
    hPin = PIN_open(&pinState, LedPinTable);

    /* Loop forever */
    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);
    }
}

/*
*  ======== mainThread ========
*/
void *mainThread(void *arg0)
{
    pthread_t           thread0;
    pthread_attr_t      pAttrs;
    struct sched_param  priParam;
    int                 retc;
    int                 detachState;

    /* Shut down external flash on LaunchPads. It is powered on by default
     * but can be shut down through SPI
     */
#if defined(CC2650_LAUNCHXL) || defined(CC2640R2_LAUNCHXL) || defined(CC1310_LAUNCHXL) || defined(CC1350_LAUNCHXL)
    SPI_init();
    bool extFlashOpened = ExtFlash_open();
    if (extFlashOpened) {
        ExtFlash_close();
    }
#endif

    /* Create application thread */
    pthread_attr_init(&pAttrs);

    detachState = PTHREAD_CREATE_DETACHED;
    /* Set priority and stack size attributes */
    retc = pthread_attr_setdetachstate(&pAttrs, detachState);
    if (retc != 0) {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }

    retc |= pthread_attr_setstacksize(&pAttrs, THREADSTACKSIZE);
    if (retc != 0) {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }

    /* Create threadFxn0 thread */
    priParam.sched_priority = 1;
    pthread_attr_setschedparam(&pAttrs, &priParam);

    retc = pthread_create(&thread0, &pAttrs, threadFxn0, NULL);
    if (retc != 0) {
        /* pthread_create() failed */
        while (1);
    }

    return (NULL);
}


一周热门 更多>