LP-CC1352P7: Wake-up from shutdown mode

Part Number: LP-CC1352P7

Tool/software:

Hi,

I'm testing the shutdown mode using zed_sw samples. What I want to do is that when the switch lost parent for more than 10 seconds, it will switch to shutdown mode and can be wake up by BTN-1 (DIO15).
I configured the LED_GREEN that will blink when try to rejoin network, and LED_RED on when the first rejoin request has been sent.

#if ZG_BUILD_ENDDEVICE_TYPE
    case BDB_COMMISSIONING_PARENT_LOST:
      if(bdbCommissioningModeMsg->bdbCommissioningStatus == BDB_COMMISSIONING_NETWORK_RESTORED)
      {
        //We did recover from losing parent
        if (UtilTimer_isActive(&EndDeviceShutdownClkStruct))
        {
          UtilTimer_stop(&EndDeviceShutdownClkStruct);
        }
        LED_setOff(gGreenLedHandle);
        LED_setOff(gRedLedHandle);
      }
      else
      {
        //Parent not found, attempt to rejoin again after a fixed delay
        LED_toggle(gGreenLedHandle);
        UtilTimer_setTimeout( EndDeviceRejoinClkHandle, SAMPLEAPP_END_DEVICE_REJOIN_DELAY );
        UtilTimer_start(&EndDeviceRejoinClkStruct);
        if (!UtilTimer_isActive(&EndDeviceShutdownClkStruct))
        {
          LED_setOn(gRedLedHandle, 100);
          UtilTimer_setTimeout(EndDeviceShutdownClkHandle, SAMPLEAPP_END_DEVICE_SHUTDOWN_DELAY);
          UtilTimer_start(&EndDeviceShutdownClkStruct);
        }
      }
    break;
#endif

The code to handle shutdown.

if ( appServiceTaskEvents & SAMPLEAPP_END_DEVICE_SHUTDOWN_EVT )
{
  if (UtilTimer_isActive(&EndDeviceRejoinClkStruct))
  {
    UtilTimer_stop(&EndDeviceRejoinClkStruct);
  }
  if (UtilTimer_isActive(&EndDeviceShutdownClkStruct))
  {
    UtilTimer_stop(&EndDeviceShutdownClkStruct);
  }
  LED_setOff(gRedLedHandle);
  LED_setOff(gGreenLedHandle);
  IOCIOShutdownSet(CONFIG_GPIO_BTN_LEFT_INPUT, IOC_WAKE_ON_LOW);
  PowerCC26X2_sysctrlShutdownWithAbort();
  appServiceTaskEvents &= ~SAMPLEAPP_END_DEVICE_SHUTDOWN_EVT;
}

So far, the switch can go to shutdown mode successfully after 10 seconds of parent lost and able to wake-up by pressing BTN-1. But after waking-up (still parent lost), it tries to rejoin network forever (checked by PPK2), I dont see LED_GREEN blinks

This LED_GREEN is configured and setOn in function static void zclSampleSw_initialization(void). So I think it should be ON after waking-up from shutdown mode.

static void zclSampleSw_initialization(void)
{
    ...

    LED_Params ledParams;
    LED_Params_init(&ledParams);
    gGreenLedHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
    gRedLedHandle = LED_open(CONFIG_LED_RED, &ledParams);
    LED_setOn(gGreenLedHandle, LED_BRIGHTNESS_MAX);
    LED_setOff(gRedLedHandle);
    
    ...
}

Does MCU starts at main code after wakeing-up from shutdown mode? If not, where the code it starts to run. Can you provide correct method to manually put device in shutdown mode?

  • Hello Van Buong Vo,

    I hope you are doing well, can you provide which SDK version you are currently using? When the devices goes to shutdown and wakes up it starts back at main.

    Thanks,
    Alex F 

  • Hi Van,

    The correct sequence for entering shutdown is shown here in the gpioshutdown example

        /* Configure DIO for wake up from shutdown */
        GPIO_setConfig(CONFIG_GPIO_WAKEUP, GPIO_CFG_IN_PU | GPIO_CFG_SHUTDOWN_WAKE_LOW);
    
        /* Go to shutdown */
        Power_shutdown(0, 0);

    Also of important note is disabling the IO latches when coming out of shutdown.

        PowerCC26X2_ResetReason resetReason = PowerCC26X2_getResetReason();
    
        /* If we are waking up from shutdown, we do something extra. */
        if (resetReason == PowerCC26X2_RESET_SHUTDOWN_IO)
        {
            /* Application code must always disable the IO latches when coming out of shutdown */
            PowerCC26X2_releaseLatches();
    
            /* In this example we toggle LED1 */
            LED_startBlinking(led1Handle, 500, 3);
        }

    You will want to perform this before other application initialization processes.

    Regards,
    Ryan

  • Hi Ryan,
    Thank you for your response. I follow the gpioshutdown example and it's woking as expected.