<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116491/sed-drawing-too-much-current-after-autojoin-fails</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Dec 2024 11:42:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116491/sed-drawing-too-much-current-after-autojoin-fails" /><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/513998?ContentTypeID=1</link><pubDate>Mon, 09 Dec 2024 11:42:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe4b934f-ac3a-4d4b-9e9e-2b9ae45cfa88</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;1: Did you cut the solder bridge SB 40 on the DK before doing measurements?&lt;/p&gt;
&lt;p&gt;Is this current consumption only related to the autojoin feature?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;At this point, I am not sure what those spikes on your custom board are coming from, and I don&amp;#39;t know how to, or if it is possible to reproduce them on a DK, or if it is some component on your custom board drawing these current spikes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/513879?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2024 15:46:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a08578ed-3923-4734-a4cf-c77a6576c129</guid><dc:creator>Mary</dc:creator><description>&lt;p&gt;My custom board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;once it joins a network successfully and is commissioned, draws ~13 uA on average&lt;/li&gt;
&lt;li&gt;If it does not join a network, then calls otPlatRadioSleep() draws ~590 uA (see PPK2 plot above)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;nRF52840DK&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If it does not join a network, then calls otPlatRadioSleep() draws 2.6 mA (see PPK2 plot above)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mary&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/513845?ContentTypeID=1</link><pubDate>Fri, 06 Dec 2024 14:07:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dee25a9-ef8c-4f29-a91d-b1fe24cf1390</guid><dc:creator>Edvin</dc:creator><description>[quote user="Mary"]I was not able to reproduce the same current on the DK.[/quote]
&lt;p&gt;What does that mean? The current consumption on the DK is lower? Does that mean that you may have some other components on your custom PCB that is drawing more power?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/513510?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 20:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cae34f9f-8aab-43dd-ab4d-e4b04bd946d3</guid><dc:creator>Mary</dc:creator><description>&lt;p&gt;We are using custom hardware.&amp;nbsp; &amp;nbsp;Yes, I want it to reboot and retry joining every hour.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I was not able to reproduce the same current on the DK.&lt;/p&gt;
&lt;p&gt;I modified the coap_client example to autojoin, and added otRadioPlatSleep() after running for 10 seconds.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_dk_5F00_radiosleep_5F00_10sec.png" /&gt;&lt;/p&gt;
&lt;p&gt;After 10 seconds, the current is 2.6 mA.&lt;/p&gt;
&lt;p&gt;Changes to prj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Same network Master Key for client and server
#CONFIG_OPENTHREAD_NETWORKKEY=&amp;quot;00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff&amp;quot;

# Thread Joiner
CONFIG_OPENTHREAD_JOINER=y
CONFIG_OPENTHREAD_JOINER_AUTOSTART=y
CONFIG_OPENTHREAD_JOINER_PSKD=&amp;quot;J01NUS&amp;quot;
CONFIG_OPENTHREAD_MANUAL_START=n
CONFIG_OPENTHREAD_NETWORKKEY=&amp;quot;&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Code added to coap_client.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
	int ret;

	LOG_INF(&amp;quot;Start CoAP-client sample&amp;quot;);

	if (IS_ENABLED(CONFIG_RAM_POWER_DOWN_LIBRARY)) {
		power_down_unused_ram();
	}

	ret = dk_buttons_init(on_button_changed);
	if (ret) {
		LOG_ERR(&amp;quot;Cannot init buttons (error: %d)&amp;quot;, ret);
		return 0;
	}

	ret = dk_leds_init();
	if (ret) {
		LOG_ERR(&amp;quot;Cannot init leds, (error: %d)&amp;quot;, ret);
		return 0;
	}

#if CONFIG_BT_NUS
	struct bt_nus_cb nus_clbs = {
		.received = on_nus_received,
		.sent = NULL,
	};

	ret = ble_utils_init(&amp;amp;nus_clbs, on_ble_connect, on_ble_disconnect);
	if (ret) {
		LOG_ERR(&amp;quot;Cannot init BLE utilities&amp;quot;);
		return 0;
	}

#endif /* CONFIG_BT_NUS */

	coap_client_utils_init(on_ot_connect, on_ot_disconnect, on_mtd_mode_toggle);

	// My Test: added the next two lines
	k_msleep(10000);		
	otPlatRadioSleep(openthread_get_default_instance());

	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Mary&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/511862?ContentTypeID=1</link><pubDate>Mon, 25 Nov 2024 10:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2e22239-1e0a-4db5-a11a-3b915ac4ddd6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;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).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It is not an alternative to enter system off when it doesn&amp;#39;t find a network? You want it to reboot (and I assume retry joining) every hour?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SED drawing too much current after autojoin fails</title><link>https://devzone.nordicsemi.com/thread/511172?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2024 19:00:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e14837cb-12b5-460b-9185-4a2ab421de0c</guid><dc:creator>Mary</dc:creator><description>&lt;p&gt;I changed the code to call otPlatRadioSleep() instead of otThreadSetLinkMode() and reduced the current quite a bit.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;		while(otDatasetGetActive(instance, &amp;amp;dataset) != OT_ERROR_NONE)
		{
			wait++;
			if (wait &amp;lt; 60)				// 5 sec x 60 = 5 min
					{
#ifdef CONFIG_SERIAL				
				printk(&amp;quot;.&amp;quot;);			// 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 &amp;gt; (12 * 60))	// 5 sec x 12 x 60 = 60 min, reboot in an hour
			{
				LOG_INF(&amp;quot;Active Dataset not found.  Rebooting in 2 seconds\r\n&amp;quot;);
				//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-&amp;gt;instance);
				// if (mode.mRxOnWhenIdle)											// disable receiver
				// {
				// 	mode.mRxOnWhenIdle = false;
				// 	error = otThreadSetLinkMode(context-&amp;gt;instance, mode);
				// }
				// openthread_api_mutex_unlock(context);

				k_msleep(5000);

			}

			if (g_reboot)
				k_work_submit(&amp;amp;reboot_work);
		}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The current looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_RadioSleep_5F00_notCommissioned.png" /&gt;&lt;/p&gt;
&lt;p&gt;This looks like some peripheral waking up every ~4ms. Maybe a timer?&lt;/p&gt;
&lt;p&gt;See also this similar issue where I found the suggestion to call otPlatRadioSleep():&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/openthread/openthread/issues/10302"&gt;github.com/.../10302&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Mary&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>