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: Sleep Wakeup Statergy

Part Number: CC2642R

Dear Team,

Good evening!!

i am working with simple peripheral code; current SDK version is simplelink_cc13x2_26x2_sdk_5_10_00_48.

 

i am configuring the switch for wakeup from shutdown.

if i try to put the controller into the sleep mode; it went to the sleep mode.

but after pressing the switch its not wakeup.

above image refer to the GPIO pin configuration.

please find attached pin schematic snap for your reference.

attached code snippet is called into the main function.

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

Regards,

Shrikant Koli

  • Hi, 

    Thank you for reaching out. 

    It would be nice to assess whether we should look for a hardware or a software related issue. May I kindly ask if you have tested the functioning of the button? Do you manage to trigger the interrupts you want when the device is in active mode? 

    Best regards, 

  • Hi .

    Thanks for reply .

    i have example code "pinShutdown_CC26X2R1_LAUNCHXL_tirtos_ccs" .

    this example code working with two switches; whichever present into the launchpad.

    i have added this code into the my simple peripheral code.

    my requirement is whenever ignition input is high, device is in pairing mode and after 5 minutes it should went to the sleep mode.

    whenever ignition switch is low after "X" days device should be in sleep mode ==> after "X" days device is in sleep mode ==> if ON the ignition switch device should wakeup.

    Regards,

    Shrikant Koli

  • Hi,

    I am not sure I understand your last observations. May I kindly ask if you are running the code on a LaunchPad or on custom hardware?

    Regards,

  • Hi,

    I suggest you check if this is correct 

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

    Also, if your input signal will trigger the wake up from shutdown mode by using a oscilloscope.

    -kel