<?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>LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112052/lwm2m-client-sample-astronomically-high-power-draw-when-losing-connection-between-registration-and-registration-update</link><description>Hi everyone, 
 I&amp;#39;m the author of the following question and a lot of context information about the state of our custom application can be gathered from there: registration sometimes fails . 
 Here&amp;#39;s the current configuration: 
 
 Testing our device under</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2024 06:54:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112052/lwm2m-client-sample-astronomically-high-power-draw-when-losing-connection-between-registration-and-registration-update" /><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/491478?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 06:54:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33c4a640-c969-46cb-9a60-44638bc09f51</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;That&amp;#39;s true, I&amp;#39;ve neglected that point in my calculation, which means I&amp;#39;ve calculated way too much power draw for a productive device. We had UART active here for the modem trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/490108?ContentTypeID=1</link><pubDate>Sun, 23 Jun 2024 09:01:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c7e0297-89ef-45c2-9042-cd5c6509fb46</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;&amp;gt; Most of the power draw is from having UART active, so the draw is semi-reasonable.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In my experience, that&amp;#39;s mainly the UART receiving. Using the &amp;quot;ASYNC UART&amp;quot; approach, &amp;quot;uart_rx_disable()&amp;quot; and &amp;quot;uart_rx_enable()&amp;quot; may be used to optimize it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/490107?ContentTypeID=1</link><pubDate>Sun, 23 Jun 2024 08:55:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e147f222-1ec6-4deb-af48-7adfda94d1b9</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;The pain with the &amp;quot;periodic cell search&amp;quot; is mainly, that if no cell is found, it stick to idle instead of sleeping. At least last year it was like that.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/103822/periodicsearchconf---relation-to-emm-reject-cause"&gt;%PERIODICSEARCHCONF - relation to EMM reject cause&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/489051?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 10:01:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9c46264-a500-40a4-ba43-64cf7e01d3aa</guid><dc:creator>SeppoTakalo</dc:creator><description>&lt;p&gt;There is a short section in nRF Connect SDK documentation about power optimizing on nRF91.&lt;br /&gt;&lt;br /&gt;Periodic cell searches are mentioned there:&lt;br /&gt;*&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/test_and_optimize/optimizing/power_nrf91.html#making_periodic_cell_searches_less_frequent"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/test_and_optimize/optimizing/power_nrf91.html#making_periodic_cell_searches_less_frequent&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;*&amp;nbsp;&lt;a id="" href="https://docs.nordicsemi.com/bundle/ref_at_commands/page/REF/at_commands/nw_service/periodicsearchconf.html"&gt;https://docs.nordicsemi.com/bundle/ref_at_commands/page/REF/at_commands/nw_service/periodicsearchconf.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Those might give enough information to configure the network searches. Overall, I think the lte_lc_offline() is unnecessary if the network was behaving correctly and we just lost the connection due to poor RF conditions. The sample is not properly demonstrating this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/489001?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 07:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaef7b34-6b7f-4c38-b949-abce279a8030</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;Testing with the new logic we have now reached acceptable levels of power draw, so it&amp;#39;s a fine solution for now. Most of the power draw is from having UART active, so the draw is semi-reasonable. Of course the 8C connection attempts hurt, but there&amp;#39;s little we can do about that without hurting connection reliability.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1718609075422v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Your input is interesting. Is there anyone who could assist with this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488993?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 07:08:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0ed2929-4754-427c-ae9f-f038f7874336</guid><dc:creator>SeppoTakalo</dc:creator><description>&lt;p&gt;I recommend also trying to remove the whole reconnection logic.&lt;/p&gt;
&lt;p&gt;I suspect that it exist only to speed up testing. But modem also has own timers that it regularly scans the network. And it might do it with much less power when not constantly restarted.&lt;/p&gt;
&lt;p&gt;But I am not aware of where these are documented, or exactly how it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488863?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 12:36:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1be98a82-68b8-41ee-81a2-d96f259ab828</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;Thanks for helping me understand.&lt;/p&gt;
&lt;p&gt;I see your point and it makes more sense to modify the client_states than the functions, so I have reverted my previous changes made the following new ones:&lt;/p&gt;
&lt;p&gt;1. On the 4th step (client_state connected but disconnected), NETWORK_ERROR is now triggered instead of suspending the client:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;		case CONNECTED:
			if (!modem_connected_to_network) {

				// modified: trigger network error instead of suspending engine
				// makes NETWORK_ERROR trigger modem_connect()
				reconnect = true;
				// makes modem_connect() wait for 24 hours instead of 6 hours after the first failed reconnection attempt
				if (reconnection_counter == 0) {
					reconnection_counter = 1;
				}
				state_trigger_and_unlock(NETWORK_ERROR);

				/* LTE connection down suspend LwM2M engine */
				//suspend_lwm2m_engine();
				// modification end

			} else {
				k_mutex_unlock(&amp;amp;lte_mutex);
				LOG_INF(&amp;quot;LwM2M is connected to server&amp;quot;);
				reconnection_counter = 0;
				if (update_session_lifetime) {
					/* Read a current server  lifetime value */
					rd_client_update_lifetime(client.srv_obj_inst);
				}

#if defined(CONFIG_APP_LWM2M_CONFORMANCE_TESTING)
				lwm2m_register_server_send_mute_cb();
#endif
				/* Get current time and date */
				date_time_update_async(date_time_event_handler);
			}
			break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. NETWORK_ERROR always sleeps for 6 hours after stopping the client and setting the modem to flight mode, and before calling modem_connect():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;		case NETWORK_ERROR:
			/* Stop the LwM2M engine. */
			LOG_INF(&amp;quot;Entered NETWORK_ERROR state&amp;quot;);
			state_trigger_and_unlock(START);
			lwm2m_rd_client_stop(&amp;amp;client, rd_client_event, false);

			/* Set network state to start for blocking LTE */
			if (reconnect) {
				reconnect = false;

				LOG_INF(&amp;quot;LwM2M restart requested. The sample will try to&amp;quot;
					&amp;quot; re-establish network connection.&amp;quot;);

				/* Try to reconnect to the network. */
				ret = lte_lc_offline();
				if (ret &amp;lt; 0) {
					LOG_ERR(&amp;quot;Failed to put LTE link in offline state (%d)&amp;quot;,
						ret);
				}
				// wait 6 hours before reconnecting
				k_sleep(K_SECONDS(60*60*6));

				modem_connect();
			}
#if defined(CONFIG_APP_LWM2M_CONFORMANCE_TESTING)
			k_work_cancel_delayable(&amp;amp;send_periodical_work);
			send_count = 0;
#endif
			break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll start testing with these changes then.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488848?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 11:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6dad635-134d-45b8-a27c-d57d4f16e9b0</guid><dc:creator>SeppoTakalo</dc:creator><description>&lt;p&gt;I did not do a complete analysis of your changes, but I feel like there might be a possibility of deadlock.&lt;/p&gt;
&lt;p&gt;I think the sample application is probably trying to be a bit too clever, so it hides actually the what causes of certain events.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t recommend touching the &amp;quot;suspend_client()&amp;quot; as that is a result of LTE Link Controller event that tells application that modem have lost the network. So it then pauses the client.&lt;/p&gt;
&lt;p&gt;Please see:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;in main()&amp;nbsp;&lt;span&gt;lte_lc_register_handler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;lte_notify_handler&lt;/span&gt;&lt;span&gt;); is registered.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;When network status changes&amp;nbsp;lte_notify_handler() is called with type&amp;nbsp;LTE_LC_EVT_NW_REG_STATUS&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;It calls&amp;nbsp;lwm2m_lte_reg_handler_notify() which modified the&amp;nbsp;modem_connected_to_network variable and triggers the main state machine.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Main state machine is in CONNECTED state and sees that it is not anymore connected, so it calls suspend_client().&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;suspend_client() pauses the LwM2M engine.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you now trigger NETWORK_ERROR, it might call&amp;nbsp;lwm2m_rd_client_stop(), but the client is paused, so it does not stop. It must be resumed first.&lt;/p&gt;
&lt;p&gt;Or at least, if you modify, be aware of this. If some of your event have caused client to pause, it must also resume at some point.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Another cause of this issue is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;LwM2M client loses connection to server or fails on its registration attempts. It issues&amp;nbsp;LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR event.&lt;/li&gt;
&lt;li&gt;Application reacts to this event by issuin NETWORK_ERROR to the main event loop&lt;/li&gt;
&lt;li&gt;main even loop forces modem to rescan the network.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So if you add timeouts, add timeout to this second handling as well. So probably just modify the handling of NETWORK_ERROR so that any case that leads here, will add a long timeout before issuing &amp;quot;modem_connect&amp;quot; again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488843?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 11:07:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79d322a8-6823-4755-83e7-fd0008c1dadf</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;Thanks for your answers, &amp;Oslash;yvind and Seppo&lt;/p&gt;
&lt;p&gt;That makes sense and I have come to a similar conclusion.&lt;/p&gt;
&lt;p&gt;The thing is, I feel like the described case doesn&amp;#39;t usually trigger the network_error state, only if lwm2_engine_pause() fails. From the capture it is also apparent that the modem doesn&amp;#39;t reconnect, else there would be a lot more action in the modem trace (modem flight mode, connect and other AT commands), or am I mistaken? Mainly, the lack of any modem activity surprised me, but this might just be normal.&lt;/p&gt;
&lt;p&gt;I have changed the code so the suspend_lwm2m_engine() function now triggers the network_error state:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;		case CONNECTED:
			if (!modem_connected_to_network) {
				/* LTE connection down suspend LwM2M engine */
				suspend_lwm2m_engine();

			} else {
				k_mutex_unlock(&amp;amp;lte_mutex);
				LOG_INF(&amp;quot;LwM2M is connected to server&amp;quot;);
				reconnection_counter = 0;
				if (update_session_lifetime) {
					/* Read a current server  lifetime value */
					rd_client_update_lifetime(client.srv_obj_inst);
				}

#if defined(CONFIG_APP_LWM2M_CONFORMANCE_TESTING)
				lwm2m_register_server_send_mute_cb();
#endif
				/* Get current time and date */
				date_time_update_async(date_time_event_handler);
			}
			break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void suspend_lwm2m_engine(void)
{
	int ret;

	LOG_INF(&amp;quot;entered suspend_lwm2m_engine() function&amp;quot;);
	// makes NETWORK_ERROR trigger modem_connect()
	reconnect = true;
	// tells modem_connect() to sleep for 6 hours before attempting first connection
	reconnect_timeout = true;
	// makes modem_connect() sleep for 24 hours instead of 6 hours after the first failed reconnection attempt
	if (reconnection_counter == 0) {
		reconnection_counter = 1;
	}
	state_trigger_and_unlock(NETWORK_ERROR);
	
	//state_trigger_and_unlock(LTE_OFFLINE);

	ret = lwm2m_engine_pause();
	if (ret) {
		LOG_ERR(&amp;quot;LwM2M engine pause fail %d&amp;quot;, ret);
		reconnect = true;
		k_mutex_lock(&amp;amp;lte_mutex, K_FOREVER);
		state_trigger_and_unlock(NETWORK_ERROR);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Anyway, in the described case, I would say that the Problem is fixed for us, but unless I&amp;#39;m misunderstanding, maybe it would be worth investigating the state machine in the case of a complete loss of network coverage after a successful registration.&lt;/p&gt;
&lt;p&gt;Hope this helps someone in the future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488815?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 08:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18987bf6-d9a3-4e8c-904c-36fdeb276798</guid><dc:creator>SeppoTakalo</dc:creator><description>[quote userid="131108" url="~/f/nordic-q-a/112052/lwm2m-client-sample-astronomically-high-power-draw-when-losing-connection-between-registration-and-registration-update"]Testing our device under harsh conditions has shown that the lwm2m client sample can enter a state in which it continuously tries to connect to the network, leading to incredibly high power draw.[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
&lt;p&gt;LwM2M client sample is just a sample.&lt;/p&gt;
&lt;p&gt;When LwM2M engine signals that it cannot connect, and when we lose the network, the sample immediately restarts the network scan.&lt;/p&gt;
&lt;p&gt;See&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/d653bc0495a7a289df96d4e41e7d4e7131b88c48/samples/cellular/lwm2m_client/src/main.c#L771-L789"&gt;https://github.com/nrfconnect/sdk-nrf/blob/d653bc0495a7a289df96d4e41e7d4e7131b88c48/samples/cellular/lwm2m_client/src/main.c#L771-L789&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You might want to refactor that part so that there is some idle period before it re-attempts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488795?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2024 06:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9d11421-37c3-4829-b381-b890d0928a9c</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;whoops, I see the same kind of logic is the point of the suspend_lwm2m_engine() function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void suspend_lwm2m_engine(void)
{
	int ret;

	state_trigger_and_unlock(LTE_OFFLINE);
	ret = lwm2m_engine_pause();
	if (ret) {
		LOG_ERR(&amp;quot;LwM2M engine pause fail %d&amp;quot;, ret);
		reconnect = true;
		k_mutex_lock(&amp;amp;lte_mutex, K_FOREVER);
		state_trigger_and_unlock(NETWORK_ERROR);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;so that approach does not seem fruitful.&lt;/p&gt;
&lt;p&gt;I will implement logging and record the application logs in an effort to understand the application&amp;#39;s behaviour regarding this case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488686?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 13:13:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e661905c-f579-44f8-b473-779de133eac0</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for sharing all the details. I see you have been in contact with &lt;a href="https://devzone.nordicsemi.com/members/seppotakalo"&gt;SeppoTakalo&lt;/a&gt;&amp;nbsp;in your other ticket. I have reached out to him to get more information on this issue.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488633?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 09:56:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c828858-804f-4bd4-9228-dc8abef31714</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;I&amp;#39;m currently testing this solution:&lt;/p&gt;
&lt;div style="background-color:#272822;color:#f8f8f2;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;case&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;CONNECTED&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;if&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; (&lt;/span&gt;&lt;span style="color:#f92672;"&gt;!&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;modem_connected_to_network&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#88846f;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* LTE connection down suspend LwM2M engine */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;suspend_lwm2m_engine&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#88846f;"&gt;// modification START&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#88846f;"&gt; // custom indicator so the modem doesn&amp;#39;t try to reconnect immediately, but after a set timeout of e.g. 6 hours&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;reconnect_timeout&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;true&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#88846f;"&gt;// modem will try to reconnect from the NETWORK_ERROR after the timeout&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;reconnect&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;true&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;state_trigger_and_unlock&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;NETWORK_ERROR&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#88846f;"&gt;// modification END&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &lt;/span&gt;&lt;span style="color:#f92672;"&gt;else&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;k_mutex_unlock&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#f92672;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;lte_mutex&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;LOG_INF&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74;"&gt;&amp;quot;LwM2M is connected to server&amp;quot;&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;reconnection_counter&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#ae81ff;"&gt;0&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;if&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; (&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;update_session_lifetime&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#88846f;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Read a current server &amp;nbsp;lifetime value */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;rd_client_update_lifetime&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;client&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;.&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;srv_obj_inst&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#f92672;"&gt;#if&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;defined&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;CONFIG_APP_LWM2M_CONFORMANCE_TESTING&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;lwm2m_register_server_send_mute_cb&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f92672;"&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#88846f;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Get current time and date */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;date_time_update_async&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;date_time_event_handler&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;break&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll keep you updated&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488603?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 07:45:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95f4af68-6a66-436f-b2c1-2ce1988be85e</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;Since the engine was suspended but the modem stayed awake, putting the modem to sleep by adding lte_lc_offline() to the ENGINE_SUSPENDED EVENT would surely fix the issue we see here. Is there a reason not to do this? what would happen next?&lt;/p&gt;
&lt;p&gt;Would the device wake up on expiry of the pTAU timer (t3412) and reregister? If yes, that would be fine.&lt;/p&gt;
&lt;p&gt;Are there other cases where this would hurt?&lt;/p&gt;
&lt;div style="background-color:#272822;color:#f8f8f2;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;case&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;#if&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;defined&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;CONFIG_PRIOT_CONNECTION_DEBUGGING&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ts_last_engine_suspended &lt;/span&gt;&lt;span style="color:#f92672;"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;k_uptime_get&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(); &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; last_rd_event &lt;/span&gt;&lt;span style="color:#f92672;"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt; LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;LOG_DBG&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74;"&gt;&amp;quot;LwM2M engine suspended&amp;quot;&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt; lte_lc_offline();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#a6e22e;"&gt;k_mutex_unlock&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;(&lt;/span&gt;&lt;span style="color:#f92672;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;lte_mutex&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#f8f8f2;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color:#f92672;"&gt;break&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Or am I thinking too far and it&amp;#39;s just simple configuration that&amp;#39;s needed? maybe setting the modem to constrained mode or something...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LwM2M client sample: Astronomically high power draw when losing connection between registration and registration update</title><link>https://devzone.nordicsemi.com/thread/488596?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 06:44:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3608475-f87f-49bc-a5d4-b8517dd2d971</guid><dc:creator>AlanIoT</dc:creator><description>&lt;p&gt;Here&amp;#39;s the modem trace... There&amp;#39;s a modem wake up, then an AT+CEREG=4, then nothing in the trace for hours while it keeps draining the battery:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/20240613_5F00_0804_5F00_no_5F00_connection_5F00_at_5F00_first_5F00_reg_5F00_update.pcapng"&gt;devzone.nordicsemi.com/.../20240613_5F00_0804_5F00_no_5F00_connection_5F00_at_5F00_first_5F00_reg_5F00_update.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Screenshot of the same event:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1718260290800v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Within 10 hours, roughly 5% of our battery capacity is drained, giving a theoretical lifetime of 200h, which would be catastrophic in the field.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any indications?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>