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.

  • Hi

    Yes, I can see

    Have you followed section 3.1.1 in the nRF Sniffer for 802.15.4 user guide to configure the decryption keys before starting to capture. This is something that must be done before  capturing data and won't be "unlocked" by adding the correct key on a finished filter.

    Regarding the log and THSM sleep. Yes I can see that the debug log is putting the THSM to sleep, but it does not seem to set the radio into a sleeping state. I'm not able to see what exactly your THSM_sleep_e and THSM_idle_e events are doing from your code snippets. What functions are they calling that puts the nRF into sleep exactly?

    Best regards,

    Simon

  • Hi

    Yes for sure we are not handling any sleep and receive states of radio manually right now. the THSM_IDLE and THSM_SLEEP states are just doing the application part and switching we are not trying to put radio to sleep since they say not required to put manually to sleep of invoke receive states of radio https://github.com/openthread/openthread/issues/1495.

    Please correct me if i am wrong in understanding

    Yes regarding the network key you are right we cannot add it once it is finished sniffing, will see the configuration part you suggested.

    Regards

    Abhijith 

  • Hi

    It would be great if you are able to upload a sniffer log with decoded packets. In the debug log, it's a bit hard to follow when only the states are being printed. Showing where the application goes in if() sets should be helpful as well.

    Best regards,

    Simon

  • Hi

    I tried to print the data to extract the master key, 

    #ifdef DEBUG
    ConsolePrint("Thread version : %s\n", (uint32_t)otGetVersionString());
    ConsolePrint("Network name : %s\n", (uint32_t)otThreadGetNetworkName(COMWIRELESS_ot_instance));
    ConsolePrint("Channel : %d\n", otLinkGetChannel(COMWIRELESS_ot_instance));
    ConsolePrint("PAN ID : 0x%04x\n", otLinkGetPanId(COMWIRELESS_ot_instance));
    #endif
    const otExtAddress *pExtAddress = otLinkGetExtendedAddress(COMWIRELESS_ot_instance);
    #ifdef DEBUG
    ConsolePrint("ExtendedAddress: ");
    for (uint8_t u8Counter = 0; u8Counter < OT_EXT_ADDRESS_SIZE; u8Counter++)
    {
    ConsolePrint("%02x ", pExtAddress->m8[u8Counter]);
    }
    ConsolePrint("\n");
    #endif
    const otMasterKey *pMasterKey = otThreadGetMasterKey(COMWIRELESS_ot_instance);
    #ifdef DEBUG
    ConsolePrint("MasterKey : ");
    for (uint8_t u8Counter = 0; u8Counter < OT_MASTER_KEY_SIZE; u8Counter++)
    {
    ConsolePrint("%02x ", pMasterKey->m8[u8Counter]);
    }
    ConsolePrint("\n");
    #endif

    And i get this as the master key.. and the same key i am using in wireshark to decode it.. 


    OT_DEVICE_ROLE_CHILD
    Thread version : OPENTHREAD/20191113-00534-gc6a258e3; NRF52833; Apr 5 2020 21:43:42
    Network name : RDS110R_Thread
    Channel : 12
    PAN ID : 0x6329
    ExtendedAddress: 72 15 1f 60 49 d0 69 be
    MasterKey : ea 88 12 96 01 83 2e bc 05 dc 06 b6 8f e3 94 20

    I guess you can add the same decryption key in your preferences -> IEEE 802.15.4 -> Decryption keys so that you can see the decoded data

  • Hi 

    I tried to print only in the states and its corresponding radio states, i can see that the radio goes to sleep only once and then it remains in rx once it completes the process 

    the below code snippet is used in all the states of that function i shared.

    if(THSM_WirelessState_previous != THSM_WirelessState)
    {
    printf("\n\r State : %d ..",THSM_WirelessState);
    THSM_WirelessState_previous = THSM_WirelessState;
    }
    pres_state1 = otPlatRadioGetState(COMWIRELESS_ot_instance);
    if(prev_state1 != pres_state1)
    {
    printf("\n Radio status: %d", pres_state1);
    prev_state1 = pres_state1;
    }

    Note : Gap in the log represents the wakeup of device every 60s. guess this is helpful.

    Also it would be good if we have any example for managing the receive and sleep states of radio.

    And the enums remains the same

    Regards

    Abhijtih

    
     Radio status: 1
     State : 7 ..
    
     State : 0 ..
     State : 7 ..
    
     State : 0 ..
     State : 2 ..
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     State : 3 ..
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
    
     Radio status: 3
     Radio status: 2
     Radio status: 3
     Radio status: 2
     State : 5 ..
     Radio status: 1
     State : 6 ..
     State : 7 ..
    
     State : 0 ..
     Radio status: 2
     State : 5 ..
     State : 6 ..
     State : 7 ..
    
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
    
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     Radio status: 3
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     Radio status: 2
     State : 6 ..
     State : 7 ..
     Radio status: 3
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 2
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     Radio status: 3
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
    
     State : 6 ..
     State : 7 ..
    
     State : 0 ..
     Radio status: 2
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     Radio status: 3
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 2
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 3
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 2
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 3
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
    
     State : 6 ..
     Radio status: 2
     State : 7 ..
    
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     Radio status: 3
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     Radio status: 2
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 .
     State : 7 ..
     Radio status: 3
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
    
     State : 7 ..
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
     State : 5 ..
     Radio status: 2
     State : 6 ..
     State : 7 ..
     Radio status: 1
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     State : 0 ..
    
     State : 5 ..
     State : 6 ..
     State : 7 ..
    
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..
     Radio status: 2
    
     State : 0 ..
     State : 5 ..
     State : 6 ..
     State : 7 ..

Related