Open thread : Rx is always ON after communication is completed (Doesnt goes to sleep) - power consumption is high.

Using windows 10 OS, and SES v5.40.

I am using nRF52833 device in my project along with nRF5_SDK_for_Thread_and Zigbee_v4.1.0_32ce5f8 SDK.

I am using openthread protocol for radio communication and i also know that we can use the below function to know the radio state and also joiner state

otJoinerGetState(ot_instance) - Joiner state and otPlatRadioGetState(ot_instance) - Radio state.

But if i try to print the radio state : Observations

a. Before joining - the radio state is 1(radio sleep) - power consumption is around 15uA - expected to be that power consumption.

b. During joining - the radio state toggles between 1,2,3 (sleep, Rx and Tx) - power consumption is around 20mA - Expected this power consumption during pairing.

c. After joining - the radio state is 2(Rx) once pairing is completed, and it doesnt goes to sleep anymore - power consumption is around 11mA - Expected to be 15uA once the device is in sleep.

Questions :

1. I tried to put the radio to sleep manually once pairing is completed - Facing issues with communicating again once pairing is done. Also found that there is no requirement of manually switching sleep and receive states from this discussion - https://github.com/openthread/openthread/issues/1495 - Please suggest right way to handle this.

2. Also found the link mode configuration settings - otLinkModeConfig mode;
                                                                                 memset(&mode, 0, sizeof(mode));
                                                                                 mode.mRxOnWhenIdle = false;   

        We are making mode.mRxOnWhenIdle true during initialisation and again false during cyclic wakeup - is there anything wrong with this configuration setting.

Note : All i want to do is putting back the radio state to 1 (sleep) once it completes communication to reduce power to 15uA.

Parents
  • Hi

    I'm sorry, but I'm not able to see what the issue is by just your description of the issue. I would think that the device is still expecting some data after the joining/pairing is completed perhaps.

    Can you share a snippet of your code, output of your debug log, and potentially a sniffer trace of what's going on over the air so we can get a better look at what's going on?

    Best regards,

    Simon

  • Hi

    Thanks for your reply on this.

    I have attached the RF state machine function haw we are handling it.. maybe ill be sharing the sniffer data soon

    void COMWIRELESS_RfStatemachine(void)
    {
      otError error;
      if(THSM_WirelessState_previous != THSM_WirelessState)
      {
        printf("\n\r State : %d ..",THSM_WirelessState);    
        THSM_WirelessState_previous = THSM_WirelessState;
      }
      if(THSM_knxiot_running_b == TRUE)
      {
          pres_state = otJoinerGetState(COMWIRELESS_ot_instance);
          if(prev_state != pres_state)
          {
            printf("\n Joiner status: %d", pres_state);
            prev_state = pres_state;
          }
          pres_state1 = otPlatRadioGetState(COMWIRELESS_ot_instance);
          if(prev_state1 != pres_state1)
          {
            printf("\n Radio status: %d", pres_state1);
            prev_state1 = pres_state1;
          }
          //if (otTaskletsArePending(COMWIRELESS_ot_instance))
          // {
          //    otTaskletsProcess(COMWIRELESS_ot_instance);
          //    otSysProcessDrivers(COMWIRELESS_ot_instance);
          // }
           //else
           //{
           //   THSM_WirelessState = THSM_SLEEP_e;
           //}
    
          // Enter sleep state if no more tasks are pending
          //if (!otTaskletsArePending(COMWIRELESS_ot_instance))
          //{
          //if ((EOSM_teached_gateway_fU8 == TRUE) && (EOSM_start_teach_mode_fU8 == FALSE))
          //{
          //COMWIRELESS_SetReadyToSleepEOSM(TRUE);
          //}
          //}
          //else
          //{
          //COMWIRELESS_SetReadyToSleepEOSM(FALSE);
          //}
    
          // KNXIoT main function
         // CoapMainProcess(NULL);
      }
        switch(THSM_WirelessState)
        {
          case THSM_IDLE_e:       //joined previously Y-pair success and  N-wait for key press and INITIALIZE_COMM.
          {
            if(CSA_GetStartWirelessStateMachine_U8() == TRUE)
            {
             //if(COMWIRELESS_ot_instance != NULL)                                  //If communication is already joined and has instance already
             //{
             //   //THSM_WirelessState = INITIALIZE_COMM;
             //}
             //else 
             if((THSM_key_pressed_for_joining_b) && (MCDC_GetReadyToSleep_U8() == TRUE))
              {
                THSM_knxiot_running_b = TRUE;
                THSM_key_pressed_for_joining_b = FALSE;
                if (!THSM_initialize_otcomm_b )      //THSM_initialize_otcomm_b ensures thread initalization is done only once
                {
                    THSM_initialize_otcomm_b = TRUE;
                    COMWIRELESS_InitCommunication();               
                }   
                if (OT_JOINER_STATE_IDLE == otJoinerGetState(COMWIRELESS_ot_instance))
                {
                    if (!THSM_teached_gateway_b)
                    {
                        /*enable recieve state of radio to check if there are anything to update on wakeup*/
                        COMWIRELESS_ReceiveEnable();
                        // Start pairing                    
                        THSM_WirelessState = THSM_START_JOINING_e;
                    }
                }         
              }
              else if(THSM_teached_gateway_b)
              {
                /*enable recieve state of radio to check if there are anything to update on wakeup*/
                COMWIRELESS_ReceiveEnable();
                THSM_wakeupIdle = TRUE;
                THSM_WirelessState = THSM_PREPARE_WAKEUP_e;                   //GO to continous communication after pairing\
                THSM_process_timeout_b = FALSE;
                THSM_data_request_executed_b = FALSE;
                TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_DEBUG_e, THSM_PROCESS_TIMEOUT_dU16, THSM_RfProcessCallback, (void *)NULL);
               // printf("\n\r wake up...."); 
              }
              else
              {
                THSM_WirelessState = THSM_SLEEP_e;
              }
            }
          break;
          }
    
          case INITIALIZE_COMM:       //COMWIRELESS_ot_instance != NULL
          {
    
            THSM_WirelessState = THSM_PAIR_SUCCESS_e;
          break;
          }
    
          case THSM_START_JOINING_e://
          {
                //if (otTaskletsArePending(COMWIRELESS_ot_instance))
                // {
                    otTaskletsProcess(COMWIRELESS_ot_instance);
                    otSysProcessDrivers(COMWIRELESS_ot_instance); 
                    CoapMainProcess(NULL);
                // }
                if ((THSM_joining_in_progress_b == FALSE) && (THSM_joining_try_done_b == FALSE))
                {
                    if (OT_ERROR_NONE == otJoinerStart(COMWIRELESS_ot_instance, "SEMENS", NULL, NULL, NULL, NULL, NULL, JoinerCallback, NULL))
                    {
                        THSM_joining_try_done_b = FALSE;
                        THSM_joining_in_progress_b = TRUE;
                        THSM_start_pairing_b = TRUE;
                        #ifdef DEBUG
                        ConsolePrint("\n\r Start joining ...\n\r"); 
                        #endif
                        //LED Start glowing
                        GENAPP_GpioAppSetLedR(TRUE);
                    }
    
                }
                else
                {
                  if (THSM_joining_try_done_b == TRUE)
                  {                
                    if(THSM_joining_successful_b)
                    {
                      THSM_WirelessState = THSM_PAIR_SUCCESS_e;
                    }
                    else
                    {
                      THSM_WirelessState = THSM_PAIR_UNSUCCESS_e;
                    }
                  }
                }
          
          break;
          }
    
          case THSM_PAIR_SUCCESS_e:
          {
                //if (otTaskletsArePending(COMWIRELESS_ot_instance))
                // {
                    otTaskletsProcess(COMWIRELESS_ot_instance);
                    otSysProcessDrivers(COMWIRELESS_ot_instance); 
                    CoapMainProcess(NULL);
                 //}             
                  if(THSM_teached_gateway_b == FALSE)
                  {
                      GENAPP_GpioSetLedRTemporarily(THSM_LED_TOGGLE_DURATION_dU16,THSM_SUCCESSFUL_JOIN_BLINK_dU8);//LED Blink for 5 times
                      // Pairing is complete -> enable Thread interface
                      error = otThreadSetEnabled(COMWIRELESS_ot_instance, true);
                      ASSERT(error == OT_ERROR_NONE);
                      #ifdef DEBUG
                      ConsolePrint("\nThread interface has been enabled.");
                      #endif
                      THSM_process_timeout_b = FALSE;
                      THSM_teached_gateway_b = TRUE;
                      TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_RF_TIMEOUT_e, 10000, THSM_RfProcessCallback, (void *)NULL);
                  }            
                  else
                  {
                      if((THSM_process_timeout_b == TRUE))
                    {
                          //COMWIRELESS_SetTimeoutOccured(FALSE);
                         //THSM_data_request_executed_b = TRUE;
                         #ifdef DEBUG
                          ConsolePrint("\n\rSet new PollPeriod and disable RX when IDLE ...\n\r");
                          #endif
    
                          otLinkModeConfig mode;
                          memset(&mode, 0, sizeof(mode));
                          mode.mRxOnWhenIdle = false; // Join network as SED.
                          mode.mSecureDataRequests = true;
    
                          error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
                          ASSERT(error == OT_ERROR_NONE);
    
                          //error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
                          //ASSERT(error == OT_ERROR_NONE);
    
                          //error = otLinkSetPollPeriod(COMWIRELESS_ot_instance, COMWIRELESS_GetWakeUpTime_U16()*1000);
                          //ASSERT(error == OT_ERROR_NONE);
    
                          otThreadSetChildTimeout(COMWIRELESS_ot_instance, 300);
                          THSM_WirelessState = THSM_PREPARE_WAKEUP_e;
    
                        }
                    //THSM_WirelessState = THSM_PREPARE_WAKEUP_e;
                  }
    
                 // TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_RF_TIMEOUT_e, 10000, COMWIRELESS_RfTimeoutCallback, (void *)NULL);        
          break;
          }
    
          case THSM_PAIR_UNSUCCESS_e:
          {      
            otPlatRadioSleep(COMWIRELESS_ot_instance);
            //THSM_start_pairing_b = FALSE;
            //COMWIRELESS_SetReadyToSleepTHSM(TRUE);
            GENAPP_GpioAppSetLedR(FALSE);                         //LED stop glowing 
            TIMEAPP_StopSingleShotTimer(TIMEAPI_LED_e);
            THSM_knxiot_running_b = FALSE;
            THSM_WirelessState = THSM_SLEEP_e;
          break;
          }
    
          case THSM_PREPARE_WAKEUP_e:
          {
          if (THSM_data_request_executed_b == FALSE)
              {
                error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
                THSM_data_request_executed_b = TRUE;
                THSM_WirelessState = THSM_WAKEUP_e;
              }
          break;
          }
    
          case THSM_WAKEUP_e:
          {        
              otTaskletsProcess(COMWIRELESS_ot_instance);
              otSysProcessDrivers(COMWIRELESS_ot_instance); 
              CoapMainProcess(NULL);
             // if ((!otTaskletsArePending(COMWIRELESS_ot_instance)) && (THSM_wakeupIdle == TRUE) && (THSM_process_timeout_b == TRUE))
             // if ((!otTaskletsArePending(COMWIRELESS_ot_instance)) && (THSM_process_timeout_b == TRUE))
              if ((otPlatRadioGetState(COMWIRELESS_ot_instance) == 1) && (THSM_process_timeout_b == TRUE))
              {
                  THSM_wakeupIdle = FALSE;
                  THSM_WirelessState = THSM_SLEEP_e;
              }              
              
              //if((COMWIRELESS_GetTimeoutOccured_U8() == TRUE))
              //{
              //      COMWIRELESS_SetTimeoutOccured(FALSE);
              //     //THSM_data_request_executed_b = TRUE;
              //     #ifdef DEBUG
              //      ConsolePrint("\n\rSet new PollPeriod and disable RX when IDLE ...\n\r");
              //      #endif
    
              //      otLinkModeConfig mode;
              //      memset(&mode, 0, sizeof(mode));
              //      mode.mRxOnWhenIdle = false; // Join network as SED.
              //      mode.mSecureDataRequests = true;
    
              //      error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
              //      ASSERT(error == OT_ERROR_NONE);
    
              //      //error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
              //      //ASSERT(error == OT_ERROR_NONE);
    
              //      //error = otLinkSetPollPeriod(COMWIRELESS_ot_instance, COMWIRELESS_GetWakeUpTime_U16()*1000);
              //      //ASSERT(error == OT_ERROR_NONE);
    
              //      otThreadSetChildTimeout(COMWIRELESS_ot_instance, 300);
              //      THSM_WirelessState = THSM_SLEEP_e;
    
              //    }
                  //if (!otTaskletsArePending(COMWIRELESS_ot_instance))
                  //{
                  //    THSM_WirelessState = THSM_SLEEP_e;
                  //}
             
          break;
          }
    
          case THSM_SLEEP_e:
          {
            otLinkModeConfig mode;
            memset(&mode, 0, sizeof(mode));
            mode.mRxOnWhenIdle = false;
            mode.mSecureDataRequests = true;
    
            otError error;
            error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
            ASSERT(error == OT_ERROR_NONE);
            /*radio sleep*/
            COMWIRELESS_RadioSleep();
            COMWIRELESS_SetReadyToSleepTHSM(TRUE);
            //if (CSA_GetStartWirelessStateMachine_U8() == TRUE)
            //{
              
              THSM_WirelessState = THSM_IDLE_e;
           // }
          break;
          }
    
          default:
          {
          THSM_WirelessState = THSM_IDLE_e;
          }
          break;
        }
        
    }

Reply
  • Hi

    Thanks for your reply on this.

    I have attached the RF state machine function haw we are handling it.. maybe ill be sharing the sniffer data soon

    void COMWIRELESS_RfStatemachine(void)
    {
      otError error;
      if(THSM_WirelessState_previous != THSM_WirelessState)
      {
        printf("\n\r State : %d ..",THSM_WirelessState);    
        THSM_WirelessState_previous = THSM_WirelessState;
      }
      if(THSM_knxiot_running_b == TRUE)
      {
          pres_state = otJoinerGetState(COMWIRELESS_ot_instance);
          if(prev_state != pres_state)
          {
            printf("\n Joiner status: %d", pres_state);
            prev_state = pres_state;
          }
          pres_state1 = otPlatRadioGetState(COMWIRELESS_ot_instance);
          if(prev_state1 != pres_state1)
          {
            printf("\n Radio status: %d", pres_state1);
            prev_state1 = pres_state1;
          }
          //if (otTaskletsArePending(COMWIRELESS_ot_instance))
          // {
          //    otTaskletsProcess(COMWIRELESS_ot_instance);
          //    otSysProcessDrivers(COMWIRELESS_ot_instance);
          // }
           //else
           //{
           //   THSM_WirelessState = THSM_SLEEP_e;
           //}
    
          // Enter sleep state if no more tasks are pending
          //if (!otTaskletsArePending(COMWIRELESS_ot_instance))
          //{
          //if ((EOSM_teached_gateway_fU8 == TRUE) && (EOSM_start_teach_mode_fU8 == FALSE))
          //{
          //COMWIRELESS_SetReadyToSleepEOSM(TRUE);
          //}
          //}
          //else
          //{
          //COMWIRELESS_SetReadyToSleepEOSM(FALSE);
          //}
    
          // KNXIoT main function
         // CoapMainProcess(NULL);
      }
        switch(THSM_WirelessState)
        {
          case THSM_IDLE_e:       //joined previously Y-pair success and  N-wait for key press and INITIALIZE_COMM.
          {
            if(CSA_GetStartWirelessStateMachine_U8() == TRUE)
            {
             //if(COMWIRELESS_ot_instance != NULL)                                  //If communication is already joined and has instance already
             //{
             //   //THSM_WirelessState = INITIALIZE_COMM;
             //}
             //else 
             if((THSM_key_pressed_for_joining_b) && (MCDC_GetReadyToSleep_U8() == TRUE))
              {
                THSM_knxiot_running_b = TRUE;
                THSM_key_pressed_for_joining_b = FALSE;
                if (!THSM_initialize_otcomm_b )      //THSM_initialize_otcomm_b ensures thread initalization is done only once
                {
                    THSM_initialize_otcomm_b = TRUE;
                    COMWIRELESS_InitCommunication();               
                }   
                if (OT_JOINER_STATE_IDLE == otJoinerGetState(COMWIRELESS_ot_instance))
                {
                    if (!THSM_teached_gateway_b)
                    {
                        /*enable recieve state of radio to check if there are anything to update on wakeup*/
                        COMWIRELESS_ReceiveEnable();
                        // Start pairing                    
                        THSM_WirelessState = THSM_START_JOINING_e;
                    }
                }         
              }
              else if(THSM_teached_gateway_b)
              {
                /*enable recieve state of radio to check if there are anything to update on wakeup*/
                COMWIRELESS_ReceiveEnable();
                THSM_wakeupIdle = TRUE;
                THSM_WirelessState = THSM_PREPARE_WAKEUP_e;                   //GO to continous communication after pairing\
                THSM_process_timeout_b = FALSE;
                THSM_data_request_executed_b = FALSE;
                TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_DEBUG_e, THSM_PROCESS_TIMEOUT_dU16, THSM_RfProcessCallback, (void *)NULL);
               // printf("\n\r wake up...."); 
              }
              else
              {
                THSM_WirelessState = THSM_SLEEP_e;
              }
            }
          break;
          }
    
          case INITIALIZE_COMM:       //COMWIRELESS_ot_instance != NULL
          {
    
            THSM_WirelessState = THSM_PAIR_SUCCESS_e;
          break;
          }
    
          case THSM_START_JOINING_e://
          {
                //if (otTaskletsArePending(COMWIRELESS_ot_instance))
                // {
                    otTaskletsProcess(COMWIRELESS_ot_instance);
                    otSysProcessDrivers(COMWIRELESS_ot_instance); 
                    CoapMainProcess(NULL);
                // }
                if ((THSM_joining_in_progress_b == FALSE) && (THSM_joining_try_done_b == FALSE))
                {
                    if (OT_ERROR_NONE == otJoinerStart(COMWIRELESS_ot_instance, "SEMENS", NULL, NULL, NULL, NULL, NULL, JoinerCallback, NULL))
                    {
                        THSM_joining_try_done_b = FALSE;
                        THSM_joining_in_progress_b = TRUE;
                        THSM_start_pairing_b = TRUE;
                        #ifdef DEBUG
                        ConsolePrint("\n\r Start joining ...\n\r"); 
                        #endif
                        //LED Start glowing
                        GENAPP_GpioAppSetLedR(TRUE);
                    }
    
                }
                else
                {
                  if (THSM_joining_try_done_b == TRUE)
                  {                
                    if(THSM_joining_successful_b)
                    {
                      THSM_WirelessState = THSM_PAIR_SUCCESS_e;
                    }
                    else
                    {
                      THSM_WirelessState = THSM_PAIR_UNSUCCESS_e;
                    }
                  }
                }
          
          break;
          }
    
          case THSM_PAIR_SUCCESS_e:
          {
                //if (otTaskletsArePending(COMWIRELESS_ot_instance))
                // {
                    otTaskletsProcess(COMWIRELESS_ot_instance);
                    otSysProcessDrivers(COMWIRELESS_ot_instance); 
                    CoapMainProcess(NULL);
                 //}             
                  if(THSM_teached_gateway_b == FALSE)
                  {
                      GENAPP_GpioSetLedRTemporarily(THSM_LED_TOGGLE_DURATION_dU16,THSM_SUCCESSFUL_JOIN_BLINK_dU8);//LED Blink for 5 times
                      // Pairing is complete -> enable Thread interface
                      error = otThreadSetEnabled(COMWIRELESS_ot_instance, true);
                      ASSERT(error == OT_ERROR_NONE);
                      #ifdef DEBUG
                      ConsolePrint("\nThread interface has been enabled.");
                      #endif
                      THSM_process_timeout_b = FALSE;
                      THSM_teached_gateway_b = TRUE;
                      TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_RF_TIMEOUT_e, 10000, THSM_RfProcessCallback, (void *)NULL);
                  }            
                  else
                  {
                      if((THSM_process_timeout_b == TRUE))
                    {
                          //COMWIRELESS_SetTimeoutOccured(FALSE);
                         //THSM_data_request_executed_b = TRUE;
                         #ifdef DEBUG
                          ConsolePrint("\n\rSet new PollPeriod and disable RX when IDLE ...\n\r");
                          #endif
    
                          otLinkModeConfig mode;
                          memset(&mode, 0, sizeof(mode));
                          mode.mRxOnWhenIdle = false; // Join network as SED.
                          mode.mSecureDataRequests = true;
    
                          error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
                          ASSERT(error == OT_ERROR_NONE);
    
                          //error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
                          //ASSERT(error == OT_ERROR_NONE);
    
                          //error = otLinkSetPollPeriod(COMWIRELESS_ot_instance, COMWIRELESS_GetWakeUpTime_U16()*1000);
                          //ASSERT(error == OT_ERROR_NONE);
    
                          otThreadSetChildTimeout(COMWIRELESS_ot_instance, 300);
                          THSM_WirelessState = THSM_PREPARE_WAKEUP_e;
    
                        }
                    //THSM_WirelessState = THSM_PREPARE_WAKEUP_e;
                  }
    
                 // TIMEAPP_StartSingleShotTimerWithCallback(TIMEAPI_RF_TIMEOUT_e, 10000, COMWIRELESS_RfTimeoutCallback, (void *)NULL);        
          break;
          }
    
          case THSM_PAIR_UNSUCCESS_e:
          {      
            otPlatRadioSleep(COMWIRELESS_ot_instance);
            //THSM_start_pairing_b = FALSE;
            //COMWIRELESS_SetReadyToSleepTHSM(TRUE);
            GENAPP_GpioAppSetLedR(FALSE);                         //LED stop glowing 
            TIMEAPP_StopSingleShotTimer(TIMEAPI_LED_e);
            THSM_knxiot_running_b = FALSE;
            THSM_WirelessState = THSM_SLEEP_e;
          break;
          }
    
          case THSM_PREPARE_WAKEUP_e:
          {
          if (THSM_data_request_executed_b == FALSE)
              {
                error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
                THSM_data_request_executed_b = TRUE;
                THSM_WirelessState = THSM_WAKEUP_e;
              }
          break;
          }
    
          case THSM_WAKEUP_e:
          {        
              otTaskletsProcess(COMWIRELESS_ot_instance);
              otSysProcessDrivers(COMWIRELESS_ot_instance); 
              CoapMainProcess(NULL);
             // if ((!otTaskletsArePending(COMWIRELESS_ot_instance)) && (THSM_wakeupIdle == TRUE) && (THSM_process_timeout_b == TRUE))
             // if ((!otTaskletsArePending(COMWIRELESS_ot_instance)) && (THSM_process_timeout_b == TRUE))
              if ((otPlatRadioGetState(COMWIRELESS_ot_instance) == 1) && (THSM_process_timeout_b == TRUE))
              {
                  THSM_wakeupIdle = FALSE;
                  THSM_WirelessState = THSM_SLEEP_e;
              }              
              
              //if((COMWIRELESS_GetTimeoutOccured_U8() == TRUE))
              //{
              //      COMWIRELESS_SetTimeoutOccured(FALSE);
              //     //THSM_data_request_executed_b = TRUE;
              //     #ifdef DEBUG
              //      ConsolePrint("\n\rSet new PollPeriod and disable RX when IDLE ...\n\r");
              //      #endif
    
              //      otLinkModeConfig mode;
              //      memset(&mode, 0, sizeof(mode));
              //      mode.mRxOnWhenIdle = false; // Join network as SED.
              //      mode.mSecureDataRequests = true;
    
              //      error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
              //      ASSERT(error == OT_ERROR_NONE);
    
              //      //error = otLinkSendDataRequest(COMWIRELESS_ot_instance);
              //      //ASSERT(error == OT_ERROR_NONE);
    
              //      //error = otLinkSetPollPeriod(COMWIRELESS_ot_instance, COMWIRELESS_GetWakeUpTime_U16()*1000);
              //      //ASSERT(error == OT_ERROR_NONE);
    
              //      otThreadSetChildTimeout(COMWIRELESS_ot_instance, 300);
              //      THSM_WirelessState = THSM_SLEEP_e;
    
              //    }
                  //if (!otTaskletsArePending(COMWIRELESS_ot_instance))
                  //{
                  //    THSM_WirelessState = THSM_SLEEP_e;
                  //}
             
          break;
          }
    
          case THSM_SLEEP_e:
          {
            otLinkModeConfig mode;
            memset(&mode, 0, sizeof(mode));
            mode.mRxOnWhenIdle = false;
            mode.mSecureDataRequests = true;
    
            otError error;
            error = otThreadSetLinkMode(COMWIRELESS_ot_instance, mode);
            ASSERT(error == OT_ERROR_NONE);
            /*radio sleep*/
            COMWIRELESS_RadioSleep();
            COMWIRELESS_SetReadyToSleepTHSM(TRUE);
            //if (CSA_GetStartWirelessStateMachine_U8() == TRUE)
            //{
              
              THSM_WirelessState = THSM_IDLE_e;
           // }
          break;
          }
    
          default:
          {
          THSM_WirelessState = THSM_IDLE_e;
          }
          break;
        }
        
    }

Children
No Data
Related