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.

[参考译文] LAUNCHXL-CC1310:如何在 CC1310中通过深度睡眠模式唤醒

Guru**** 2531270 points
Other Parts Discussed in Thread: LAUNCHXL-CC1310, CC1310

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1400113/launchxl-cc1310-how-to-wake-up-deep-sleep-mode-in-cc1310

器件型号:LAUNCHXL-CC1310
Thread 中讨论的其他器件: CC1310

工具与软件:

我目前正在使用 LAUNCHXL-CC1310进行开发。 我编写了一个使用线程进入待机模式并通过"PowerCC26XX_standbyPolicy ();"编写的代码。当 DIO13引脚按下5秒后、我的代码运行无限循环并在 DIO14引脚中断时退出无限循环(通过使用"Power_setConstraint (PowerCC26XX_SB_disallow)"禁用电源限制)来防止它进入待机模式)、但我的代码存在问题。
在进入睡眠模式时、我使用的是右下方的无限循环、因此在进入睡眠模式时、我需要一些时间来进入睡眠模式、但因为我使用 while (1)、所以没有足够的时间进入睡眠模式。
2.我使用 TaskSleep ()在 while (1)之前给一段时间,但当前值不会下降。
3.我的代码是否错误,你能告诉我我应该怎样写我的代码吗?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我恐怕我不明白你在用上面的代码做什么,以及为什么你设置和释放的权力禁忌你做.  

    要进入待机模式、您只需调用 sleep()、并将要睡眠的时间(进入待机)作为参数。

    示例:

    while(1)
    {
        // Sleep, to let the power policy transition the device to standby
        sleep(2); // 2 s
    
        // Toggle the LEDs, configuring all LEDs at once
        PIN_setPortOutputValue(hPin, ~currentOutputVal);
    }

    请参阅  SDK 中的 pinStandby (TI.com)示例。

    要进入 SHUTDOWN 模式、您可以使用:

     // Go to shutdown
     Power_shutdown(0, 0);

    请参阅 pinShutdown (TI.com) 示例。

    我还建议您阅读以下内容:

    TI 驱动程序电源管理

    Siri

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我想在点击 TI CC1310时进入睡眠模式、并在 DIO13引脚上有中断时从睡眠模式唤醒。 但上述方法"睡眠(2);"对我不起作用。 不是一直在睡觉、而是只在我指定的时间内睡觉、对吧? 我想进入睡眠模式、并在睡眠模式下一直停留到中断发生、然后使用
    1.据我所知、在 TI CC1310上进入睡眠模式的方法有2种、第一种是直接声明睡眠模式的 Power_sleep (PowerCC26XX_STANDBY);"函数、以及2.
    POWER_releaseConstraint (PowerCC26XX_SB_disallow);Power_setConstraint (PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY);
    PowerCC26XX_standbyPolicy ();这是我们设置功率限制以进入睡眠模式的方法。
    空闲时、我的电路板当前正在消耗9.5mA、进入睡眠模式时、我测量了当前值、0.05mA 使用"Power_sleep (PowerCC26XX_STANDBY);"时、我的电路板当前正在消耗0.05mA;我使用"PowerCC26XX_standbyPolicy ();"设置睡眠模式、从睡眠模式唤醒后、会测量9.5mA 的原始空闲电流值。 从睡眠模式唤醒并且没有 UART 通信时、在5.5mA 处测量电流值。 我想知道为什么会出现这种差异。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我修改了引脚待机示例、以便演示如何使用一个引脚(LP 上的 BTN-1)进入待机状态、使用另一个引脚(BRN-2)将其唤醒。 虽然器件不处于待机状态、但它只是切换 LED。

    /*
     *  ======== pinStandby.c ========
     */
    #include <unistd.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* Driver Header files */
    #include <ti/drivers/PIN.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    PIN_Config ledPinTable[] =
    {
        Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    PIN_Config buttonPinTable[] = {
        Board_PIN_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
        Board_PIN_BUTTON1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
        PIN_TERMINATE
    };
    
    static PIN_Handle ledPinHandle;
    static PIN_Handle buttonPinHandle;
    static PIN_State ledPinState;
    static PIN_State buttonPinState;
    
    static Semaphore_Struct wakeupSemaphore;
    static Semaphore_Handle wakeupSemaphoreHandle;
    
    void buttonCallbackFunction(PIN_Handle handle, PIN_Id pinId);
    
    bool beingActive = true;
    
    void *mainThread(void *arg0)
    {
        Semaphore_construct(&wakeupSemaphore, 0, NULL);
        wakeupSemaphoreHandle = Semaphore_handle(&wakeupSemaphore);
    
        ledPinHandle = PIN_open(&ledPinState, ledPinTable);
    
        buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
    
        PIN_Status status = PIN_registerIntCb(buttonPinHandle, &buttonCallbackFunction);
    
        while(1)
        {
            while(beingActive)
            {
                // Toggle LED while being active
                PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1));
                CPUdelay((uint32_t)((48000000/10)));
            }
    
            // Sleep until the semaphore is posted (BTN-2 Interrupt)
            Semaphore_pend(wakeupSemaphoreHandle, BIOS_WAIT_FOREVER);
        }
    }
    
    void buttonCallbackFunction(PIN_Handle handle, PIN_Id pinId)
    {
        CPUdelay((uint32_t)((48000000/3)*0.050f));
    
        // BTN-1 puts the device in Standby
        if (!PIN_getInputValue(Board_PIN_BUTTON0))
        {
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0);
            beingActive = false;
        }
    
        // BTN-2 wakes it up
        if (!PIN_getInputValue(Board_PIN_BUTTON1))
        {
            Semaphore_post(wakeupSemaphoreHandle);
            beingActive = true;
        }
    }

    请注意、如果您计划使用 UART、则 串行电源域(serial_pd)在待机和关断模式下均处于关闭状态、因此 UART 在这些电源模式下无法运行。

    Siri

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    在睡眠模式下、我不使用 UART、而在从睡眠模式唤醒时、我想唤醒 UART 并使用它、但使用当前代码时、在进入睡眠模式并唤醒时、UART 无法唤醒、但无法使用。 我是否应该在进入睡眠模式之前更改代码以关闭 UART、并在从睡眠模式唤醒后将其打开?
    2.现在我使用的是 tirtos、按照我的理解、是 Power_sleep (PowerCC26XX_STANDBY);这个命令是将器件降低到可能的最低功耗的代码、对吗? 所以使用上述代码也很正常、就像我这样"Power_releaseConstraint (PowerCC26XX_SB_disallow);Power_setConstraint (PowerCC26XX_RETAIN_VIMS_CACHE_IN_STANDBY)";
    PowerCC26XX_standbyPolicy ();

    设置这样的功率限制后、尝试使用"PowerCC26XX_standbyPolicy"进入睡眠模式通常是错误的吗?

    我想知道、TI 中的 SLEEP_MODE 和 STANDBY_MODE 有何不同、如果有、您能告诉我它们有何不同?

    4当我使用 PowerCC26XX_standbyPolicy 进入待机模式时、这与 Power_sleep (PowerCC26XX_STANDBY)不同;它进入得太慢、测量当前值所需的时间太长、这是否正常? 但是、如果我使用 PowerCC26XX_standbyPolicy 进入睡眠模式、这会花费很长时间、但如果这里发生中断、则会立即将电流作为睡眠模式电流值进行测量。 我的意思是、设置功率限制后、最初需要1~3 μ s 时间才能进入睡眠模式、但如果在进入睡眠模式时通过 UART 或按钮产生中断、它会立即进入睡眠模式、但我不知道原因。


    5.我发现、在 CC1310的数字专业化领域中、UART 模块会显示"无模块保留"、因此当它从睡眠模式唤醒时、UART 会被复位、对吧? 那么当 UART 从睡眠模式唤醒时、它会从 UART 上看到的第一件事重新启动(我的意思是、当设备处于正常状态时、UART 显示"a"、然后进入待机模式、当它唤醒时、它会再次开始从"a"输出)?

    6. power_sleep (PowerCC26XX_STANDBY);该命令要将 CC1310置于待机模式、对不是要将其置于关断模式?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我恐怕我不会容忍你所有的问题和参考设置和释放权力禁忌等.

    为什么需要将这些项目从默认值更改为其他值。

    正如我之前所解释的、如果没有其他任何操作、电源驱动程序将确保器件进入待机模式。

    我重新发布了示例代码(经过了一些修改、使其更加清晰):

    #include <unistd.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* Driver Header files */
    #include <ti/drivers/PIN.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    PIN_Config ledPinTable[] =
    {
        Board_PIN_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    PIN_Config button0PinTable[] = {
        Board_DIO12 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_NEGEDGE,
        PIN_TERMINATE
    };
    
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    PIN_Config button1PinTable[] = {
        Board_DIO15 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_NEGEDGE,
        PIN_TERMINATE
    };
    
    static PIN_Handle button0PinHandle;
    static PIN_Handle button1PinHandle;
    static PIN_State button0PinState;
    static PIN_State button1PinState;
    
    static Semaphore_Struct wakeupSemaphore;
    static Semaphore_Handle wakeupSemaphoreHandle;
    
    void button0CallbackFunction(PIN_Handle handle, PIN_Id pinId);
    void button1CallbackFunction(PIN_Handle handle, PIN_Id pinId);
    
    bool beingActive = true;
    
    void *mainThread(void *arg0)
    {
        Semaphore_Params params;
        Semaphore_Params_init(&params);
        params.mode = Semaphore_Mode_BINARY ;
        Semaphore_construct(&wakeupSemaphore, 0, NULL);
        wakeupSemaphoreHandle = Semaphore_handle(&wakeupSemaphore);
    
        ledPinHandle = PIN_open(&ledPinState, ledPinTable);
    
        button0PinHandle = PIN_open(&button0PinState, button0PinTable);
        button1PinHandle = PIN_open(&button1PinState, button1PinTable);
    
        PIN_registerIntCb(button0PinHandle, &button0CallbackFunction);
        PIN_registerIntCb(button1PinHandle, &button1CallbackFunction);
    
        while(1)
        {
            while(beingActive); // The device is in IDLE when this while loop is running
            
            // When you have a falling edge on DIO15 (interrupt), beingActive is set to false, and the
            // Code cont. from the while loop
    
            // The device will enter Standby here, and not continue before the semaphore is posted (falling edge on DIO12)
            Semaphore_pend(wakeupSemaphoreHandle, BIOS_WAIT_FOREVER);
            
            // Once you have gotten the interrupt on DIO12, beingActive = true, and you will once more be in IDLE
        }
    }
    
    void button1CallbackFunction(PIN_Handle handle, PIN_Id pinId)
    {
        CPUdelay((uint32_t)((48/4)*10)); // De-bouncing
        if (!PIN_getInputValue(Board_DIO15))
        {
            beingActive = false;
        }
    }
    
    
    void button0CallbackFunction(PIN_Handle handle, PIN_Id pinId)
    {
        CPUdelay((uint32_t)((48/4)*10)); // De-bouncing
        if (!PIN_getInputValue(Board_DIO12))
        {
            Semaphore_post(wakeupSemaphoreHandle);
            beingActive = true;
        }
    }
    

    电流曲线显示了通过在2个不同 DIO 上提供引脚中断来进入和退出这些模式时待机和空闲模式的电流。

    请使用我的示例进行 SART、并确保您了解它的工作原理、然后再开始修改它。

    Siri