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.

[参考译文] CC2642R:休眠唤醒状态

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1198729/cc2642r-sleep-wakeup-statergy

器件型号:CC2642R

尊敬的团队:

美好的夜晚!!

我正在使用简单的外设代码;当前 SDK 版本为  simplelink_cc13x2_26x2_sdk_5_10_00_48。

 

我正在将开关配置为从关断状态唤醒。

如果我尝试将控制器置于睡眠模式、它将进入睡眠模式。

但是、在按下开关后、它不会唤醒。

上图是 GPIO 引脚配置。

请查找随附的引脚原理图捕捉以供您参考。

附加的代码片段被调用到主函数中。

PIN_Config ButtonTableWakeUp[] = {
    IGN_INPUT | PIN_INPUT_EN | PIN_PULLDOWN | PINCC26XX_WAKEUP_NEGEDGE,
    PIN_TERMINATE                                 /* Terminate list */
};

int main()
{

    //spi
//    pthread_t           thread;
//       pthread_attr_t      attrs;
//       struct sched_param  priParam;
//       int                 retc;

    Sleep_WakeUpInit();
  /* Register Application callback to trap asserts raised in the Stack */
  RegisterAssertCback(AssertHandler);

  Board_initGeneral();

  // Enable iCache prefetching
  VIMSConfigure(VIMS_BASE, TRUE, TRUE);
  // Enable cache
  VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);

#if !defined( POWER_SAVING )
  /* Set constraints for Standby, powerdown and idle mode */
  // PowerCC26XX_SB_DISALLOW may be redundant
  Power_setConstraint(PowerCC26XX_SB_DISALLOW);
  Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
#endif // POWER_SAVING

  /* Update User Configuration of the stack */
  user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
  user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();

  GPIO_init();
  //PinStatus  = GPIO_read(IGN_INPUT);
  //GPIO_write(CONFIG_LED_0_GPIO, 1);
  /* Initialize ICall module */
  ICall_init();

  /* Start tasks of external images - Priority 5 */
  ICall_createRemoteTasks();



#ifdef PTM_MODE
  /* Start task for NPI task */
  NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
#endif // PTM_MODE

  SimplePeripheral_createTask();
  TmrOutInit();
  /*PWM Added for Buzzer control */
  PWM_Operation();

  /* adding below function for checking the sleep current */
  /*Power_shutdown(0, 0);*/

  /*Initialise shutdown semaphore*/
  ShutDown_Semaphore_Init();
  /* enable interrupts and start SYS/BIOS */
  BIOS_start();
  return 0;
}
void Sleep_WakeUpInit(void)
{
    /*Function is added for sleep wakeup statergy*/
        /* Get the reason for reset.
         * On CC26X2, SysCtrlResetSourceGet() must be called before
         * PIN_init() because unlatching the IOs will clear the
         * wakeup from shutdown bit.
         */
        uint32_t rSrc = SysCtrlResetSourceGet();
        /* Do pin init before starting BIOS */
        /* If coming from shutdown, use special gpio table.*/
        if (rSrc == RSTSRC_WAKEUP_FROM_SHUTDOWN) {
            /* The shutdown table has LED1 on to ensure no glitch on the
             * output.
             */
            isWakingFromShutdown = true;

            /* Open LED pins with shutdown table (LED1 on, LED0 off).
             * A separate PIN_config table is used to keep LED1 on.
             */
            //hPins = PIN_open(&LedPinState, LedPinTableSd);
        } else {
            /* When not waking from shutdown, use default init table. */
            isWakingFromShutdown = false;
            /* Open LED pins (LED1 off, LED0 on)*/
            //hPins = PIN_open(&LedPinState, LedPinTable);
        }



}

/****************************************************************************************
        * Function Name : Sleep_BLE_Device
        * Description   : This function is shutdown the BLE system
        * Arguments     : None
        * Return Value  : None
        * Modified By   : Shrikant
*****************************************************************************************/
void Sleep_BLE_Device(void)
{
    /* Pend on semaphore before going to shutdown */
    //Semaphore_pend(Semaphore_handle(&shutdownSem), BIOS_WAIT_FOREVER);
    Semaphore_pend(Semaphore_handle(&shutdownSem), BIOS_NO_WAIT);

    /* Turn off LED0 */
    //PIN_setOutputValue(hPins, CONFIG_PIN_LED_0, 0);

    /* Configure DIO for wake up from shutdown */
    PINCC26XX_setWakeup(ButtonTableWakeUp);

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

    /* Should never get here, since shutdown will reset. */
    while (1);
}
/****************************************************************************************
        * Function Name : ShutDown_Semaphore_Init
        * Description   : This function is initialise the shutdown semaphore
        * Arguments     : None
        * Return Value  : None
        * Modified By   : Shrikant
*****************************************************************************************/
void ShutDown_Semaphore_Init(void)
{
    /* Configure shutdown semaphore. */
    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    Semaphore_construct(&shutdownSem, 0, &semParams);
}
/*********************************************************************
*********************************************************************/

此致、

Shrikant Koli

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

    您好!  

    感谢您的参与。  

    最好是评估我们应该查找与硬件或软件相关的问题。 请问您是否已经测试过按钮的功能? 当器件处于活动模式时、您是否能够触发所需的中断?  

    此致、  

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

    你(们)好, 

    感谢您的回复。

    我有示例代码"pinShutdown_CC26X2R1_LAUNCHXL_tirtos_ccs"

    此示例代码使用两个开关;LaunchPad 中存在的开关。

    我已将此代码添加到我的简单外设代码中。

    我的要求是、只要点火输入为高电平、设备处于配对模式、5分钟后应进入睡眠模式。

    只要点火开关在"X"天后处于低电平、设备应处于睡眠模式=>在"X"天后、设备处于睡眠模式=>如果在点火开关上、设备应唤醒。

    此致、

    Shrikant Koli

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

    您好!

    我不确定我是否理解您的最后观察结果。 请问您是在 LaunchPad 上还是在定制硬件上运行代码?

    此致、

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

    您好!

    我建议您检查这是否正确  

    PIN_Config ButtonTableWakeUp[]={
    IGN_INPUT | PIN_INPUT_EN | PIN_PULLUGDOWN | PINCC26XX_WAKEUP_NEGEDGE、
    PIN_TERMINATE /*终止列表*/
    };

    此外、如果您的输入信号将使用示波器触发从关断模式唤醒。

    -kel