SED drawing too much current after autojoin fails

NCS 2.4.1
nRF52840

My project is a battery powered SED based on the coap_client example.  It is configured to autojoin using a hard coded pksd.  I see on Wireshark that my device sends one Discovery Request when it starts up (if it is not already commissioned).  I am testing a situation where there is no commissioner.  The device should try to join, but then go to sleep after 5 minutes until awakened by the user which will cause a reboot.

I need it to go into a low power mode once the joiner times out.  It does not.  I see on the Power Profiler that the current is ~6mA after 5 minutes.  I tried to change the link mode to set mRxOnWhenIdle to false, but the current remained high.

What is the timeout for joining when using autojoin?

Is it possible to re-try joining multiple times before giving up?

How can I force it to go into a low power sleep? Disable Thread?

prj.conf

# Thread Joiner
CONFIG_OPENTHREAD_JOINER=y
CONFIG_OPENTHREAD_JOINER_AUTOSTART=y
CONFIG_OPENTHREAD_JOINER_PSKD="J01NUS"
CONFIG_OPENTHREAD_MANUAL_START=n

main.c

		int wait = 0;
		while(otDatasetGetActive(instance, &dataset) != OT_ERROR_NONE)
		{
			wait++;
			if (wait < 60)				// 5 sec x 60 = 5 min
			{
    			// wait for joining to complete, blink LED up to 5 minutes

				set_led(COLOR_PURPLE);	// blink purple, 5 sec
				k_msleep(100);
				set_led(COLOR_OFF);
				k_msleep(4900);
			}
			else if (wait > (12 * 60))	// 5 sec x 12 x 60 = 60 min, reboot in an hour
			{
				LOG_INF("Active Dataset not found.  Rebooting\r\n");
				g_reboot = true;
			}
			else 
			{
				otError error;
				otLinkModeConfig mode;
				struct openthread_context *context = openthread_get_default_context();

				__ASSERT_NO_MSG(context != NULL);
				
				openthread_api_mutex_lock(context);
				mode = otThreadGetLinkMode(context->instance);
				if (mode.mRxOnWhenIdle)											// disable receiver
				{
					mode.mRxOnWhenIdle = false;
					error = otThreadSetLinkMode(context->instance, mode);
				}
				openthread_api_mutex_unlock(context);

				k_msleep(5000);
			}

			if (g_reboot)
				k_work_submit(&reboot_work);
		}

Thanks,

Mary

Parents
  • I changed the code to call otPlatRadioSleep() instead of otThreadSetLinkMode() and reduced the current quite a bit.

    		while(otDatasetGetActive(instance, &dataset) != OT_ERROR_NONE)
    		{
    			wait++;
    			if (wait < 60)				// 5 sec x 60 = 5 min
    					{
    #ifdef CONFIG_SERIAL				
    				printk(".");			// wait for joining to complete, blink LED up to 30 seconds
    #endif
    				set_led(COLOR_PURPLE);	// blink purple, 5 sec
    				k_msleep(100);
    				set_led(COLOR_OFF);
    				k_msleep(4900);
    			}
    			else if (wait > (12 * 60))	// 5 sec x 12 x 60 = 60 min, reboot in an hour
    			{
    				LOG_INF("Active Dataset not found.  Rebooting in 2 seconds\r\n");
    				//k_msleep(2000);
    				//NVIC_SystemReset();
    				g_reboot = true;
    			}
    			else 
    			{
    				
    				if (otPlatRadioGetState(instance) != OT_RADIO_STATE_SLEEP)
    					otPlatRadioSleep(instance);
    					
    				// openthread_stop(instance);
    
    				// if (otPlatRadioIsEnabled(instance))
    				// 	otPlatRadioDisable(instance);	
    
    				// otError error;
    				// otLinkModeConfig mode;
    				// struct openthread_context *context = openthread_get_default_context();
    
    				// __ASSERT_NO_MSG(context != NULL);
    				// openthread_api_mutex_lock(context);
    				// mode = otThreadGetLinkMode(context->instance);
    				// if (mode.mRxOnWhenIdle)											// disable receiver
    				// {
    				// 	mode.mRxOnWhenIdle = false;
    				// 	error = otThreadSetLinkMode(context->instance, mode);
    				// }
    				// openthread_api_mutex_unlock(context);
    
    				k_msleep(5000);
    
    			}
    
    			if (g_reboot)
    				k_work_submit(&reboot_work);
    		}

    The current looks like this:

    This looks like some peripheral waking up every ~4ms. Maybe a timer?

    See also this similar issue where I found the suggestion to call otPlatRadioSleep():

    github.com/.../10302

    Mary

  • Hello,

    sorry for the late reply. So you managed to get the current consumption quite a lot down, it seems. What hardware are you running this on? Is that current consumption possible to reproduce on a DK? If so, can you please upload your application here? (or a strip down version of the application that replicates this current pattern).

    It is not an alternative to enter system off when it doesn't find a network? You want it to reboot (and I assume retry joining) every hour?

    Best regards,

    Edvin

Reply
  • Hello,

    sorry for the late reply. So you managed to get the current consumption quite a lot down, it seems. What hardware are you running this on? Is that current consumption possible to reproduce on a DK? If so, can you please upload your application here? (or a strip down version of the application that replicates this current pattern).

    It is not an alternative to enter system off when it doesn't find a network? You want it to reboot (and I assume retry joining) every hour?

    Best regards,

    Edvin

Children
No Data
Related