<?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>Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61341/regular-current-spikes-on-modified-mqtt-simple</link><description>Hello! H.W: nRF9160 DK v8.5 MWF: 1.1 NCS: tag 1.2 SIM: Telenor NB-IoT I&amp;#39;m using a modified version of the MQTT simple example for an application that periodically uploads data to a privately hosted broker. The MQTT functionality have been moved to a separate</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Jun 2020 13:49:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61341/regular-current-spikes-on-modified-mqtt-simple" /><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/256722?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 13:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a2207fb-dd24-4181-8964-ae0e44f31a31</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Ah, thanks!&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I chose to remove the function as it did more harm than good. Initiating the disconnection, both with my function and the one you purposed, led to the device entering RRC connected mode thus consuming quite a lot of power. It could be that I did not close it properly, or that the MQTT application did not like the way I did it.&lt;br /&gt;&lt;br /&gt;I can experiment some more with that in the future.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/256679?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 11:50:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c011cc21-a331-44bd-83e5-f3e793a3dde3</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;I have been able to take a trace, and the modem team has looked at it.&lt;/p&gt;
&lt;p&gt;However, they also commented that you should try to close the socket while it is not used.&lt;/p&gt;
&lt;p&gt;Looking through the code I got from you, I could not find the mqtt_close_sock() function you posted earlier. Where did you call it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/254091?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2020 15:50:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2af62dd-7827-41a9-90de-2c6225cc46dc</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi!&lt;br /&gt;&lt;br /&gt;No problem! I haven&amp;#39;t been testing the last days, so the server is offline. I will set it up again :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl R.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/254071?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2020 14:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b80856b4-3be6-4d83-b36f-b31278634dc0</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, and sorry for this taking some time.&lt;/p&gt;
&lt;p&gt;I am having some problems setting up the test equipment. Hopefully, that will be sorted out soon.&lt;/p&gt;
&lt;p&gt;I did try to run your application though, but the connection to the server timed out. I guess it was not running at the time?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/252448?ContentTypeID=1</link><pubDate>Fri, 29 May 2020 14:12:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce4c9fe2-221d-4ddb-8601-95ca5e048b3c</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Here&amp;#39;s the code. Just notify my if you&amp;#39;re wondering about anything!&lt;br /&gt;&lt;br /&gt;Thanks :)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6560.mqtt.zip"&gt;devzone.nordicsemi.com/.../6560.mqtt.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/252404?ContentTypeID=1</link><pubDate>Fri, 29 May 2020 12:20:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a6f3982-9204-4c79-b477-3182365f323b</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;The modem team has some leads for what the spikes could be, but are not able to get enough information from the modem trace to confirm them.&lt;/p&gt;
&lt;p&gt;If you can share your application source code, I can run the application on some internal testing HW to get more information out of the modem. However, I would have to compile against a modified version of the SDK, hence my need for the source code.&lt;/p&gt;
&lt;p&gt;I can convert the case to private if that helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251821?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 07:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a504d572-4224-4b1c-92c4-79c9161f527a</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2020_2D00_05_2D00_27-at-08.57.37.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Calling mqtt_abort() yields the same, strange behaviour as my previous function. It seems like the action of &amp;quot;closing&amp;quot; the socket actually initiates a transmission, waking the modem and triggering a full transmission cycle (including active time countdown).&amp;nbsp;&lt;br /&gt;&lt;br /&gt;And as you can see the small peaks &amp;quot;restart&amp;quot; when something is transmitted. As mentioned earlier.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251817?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 06:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17723ead-70f8-41df-8a29-d6ca2a02fad1</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;I&amp;#39;ll try that out! Thanks.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251744?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 14:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ebc13ab-02e8-45ec-8350-cdfadb36c14f</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hmm, that should be enough...&lt;/p&gt;
&lt;p&gt;In the previous case, they used mqtt_abort().&lt;/p&gt;
&lt;p&gt;Looking at what it does, I can not really see any reason why that should work while your mqtt_close_sock() does not, but it might be worth a try.&lt;/p&gt;
&lt;p&gt;Anyway, I have asked the SDK and/or modem team to take a look as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251727?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 13:15:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e03be0e-8af2-4d3d-81c7-c2b24985de17</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I&amp;#39;m closing the socket like this, during the sleep cycle of PSM.&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int mqtt_close_sock(void) {
	int ret = close(client.transport.tcp.sock);
	if (ret &amp;lt; 0) {
		return -errno;
	}
	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So far it seems like the issue persists as the spikes continue even after I close the socket.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251655?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 09:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e2256e-ce9e-4be9-9113-bebdf0034629</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;I have not been able to get any more explanations about the previous case.&lt;/p&gt;
&lt;p&gt;Were you able to remove the current spikes by closing the socket?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251043?ContentTypeID=1</link><pubDate>Wed, 20 May 2020 14:47:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcf2f41f-3d01-4381-90c3-60b781e499e8</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;No worries! And thank you! Now I can take a look at least.&lt;br /&gt;&lt;br /&gt;BR,&lt;br /&gt;CR&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/251034?ContentTypeID=1</link><pubDate>Wed, 20 May 2020 14:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e8c49c7-7a44-40d4-b6da-a59d7a4f7992</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, Stian is unfortunately a bit busy with other tasks at the moment, and have asked me if I can look into your case.&lt;/p&gt;
&lt;p&gt;I have had a case earlier that looks a lot like this. At the time, we found that if the socket used by the MQTT library is closed, then the spikes disappear.&lt;/p&gt;
&lt;p&gt;I do not remember if we found the root cause of the wakeup or not, but I will ask some of my collegues which were also involved with the case on Friday.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/250861?ContentTypeID=1</link><pubDate>Wed, 20 May 2020 07:27:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43346ba9-1124-4b4d-be8f-d7e50404ffbd</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Any updates on this? I haven&amp;#39;t been able to pinpoint the issue myself yet.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/250009?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 14:39:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2b461f0-a430-4731-8061-147365169474</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;I can also add that I suspect it could have something to do with the TCP connection. It could be that the TCP socket have increasing timeouts when waiting for a handshake(or the likes of it). Will run a test now to see if the intervals actually reach a maximum at some point.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/250008?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 14:32:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a573775b-30c5-484a-9e45-793f846db051</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Here! I think I&amp;#39;ve done it correctly. The application was running with double power consumption, but the peaks were still very visible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Csv:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqtt_5F00_peaks_5F00_current.csv"&gt;devzone.nordicsemi.com/.../mqtt_5F00_peaks_5F00_current.csv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Trace:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqtt_5F00_peaks_5F00_trace.bin"&gt;devzone.nordicsemi.com/.../mqtt_5F00_peaks_5F00_trace.bin&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/249959?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 12:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59a76e6d-8e5f-43f1-bd67-29cbafb70a16</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Here are the hex files. One with serial logging and one without (low power)&lt;br /&gt;&lt;br /&gt;It connects to my own broker(that should be running). LED1 will light when it&amp;#39;s connected, and it will transmit every 5 minutes after that.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;It is configured for NB-IoT so you should use a SIM that support both that and PSM. (I&amp;#39;ve been using Telenor)&lt;br /&gt;&lt;br /&gt;I will do the trace and send you that along with a csv too! &lt;br /&gt;Serial:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0005.merged.hex"&gt;devzone.nordicsemi.com/.../0005.merged.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Non serial:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7827.merged.hex"&gt;devzone.nordicsemi.com/.../7827.merged.hex&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/249902?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 10:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c0fcda3-739f-4e9a-b799-1c154556938d</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Yes, I think that should be enough to avoid DNS resolution.&lt;/p&gt;
&lt;p&gt;OK, so it looks to me that the &amp;quot;event&amp;quot; is 5 ms long, and based on the current I would guess that this is the CPU waking up to do some stuff. 5ms is quite a long time though... so I&amp;#39;m not sure...&lt;/p&gt;
&lt;p&gt;Could you post a hex file that I can run on a PCA10090 DK, with Telia, Telenor or iBasis SIM? I can try to do some debugging here.&lt;/p&gt;
&lt;p&gt;If you can also provide a&lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect"&gt; modem trace&lt;/a&gt;, together with a csv or something from the current measurement (running at the same time) we could try to align them and see if we can get some info out from the trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/249892?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 09:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7b91914-82b5-4cf5-b5a8-1849ed968629</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;I also did a small analysis of the peaks in python. It seems like the duration between spikes increases every second spike and that it initially only increases with 0.25s, before suddenly increasing with 1s between every spike. (see the crude plot below).&lt;br /&gt;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1589449969996v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/249888?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 09:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6959560e-d81f-411c-82c4-a15544589fbd</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Thanks for the answer! I&amp;#39;m using a plain IP address defined like this:&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;CONFIG_MQTT_BROKER_HOSTNAME=&amp;quot;--.---.---.--&amp;quot;&lt;/strong&gt;. Is that enough to avoid DNS resolution?&lt;br /&gt;&lt;br /&gt;I&amp;#39;m using an OTII ARC. It has a sample rate in this range&amp;nbsp;at 4 ksps, with a sample resolution of +/- 50nA. A detailed picture of a spike is attached below.&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/mqtt_5F00_peak.png" /&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regular current spikes on modified MQTT simple</title><link>https://devzone.nordicsemi.com/thread/249870?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 09:05:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:017acd6e-b962-43f1-bc7b-915d5a287a6b</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;The only thing I can think of right now is that the if you are doing a DNS query the DNS timer may be running for a while after the DNS resolution has finished. So if you are using host names in your code try to use plain IP addresses instead. However, if there is a timer running I would expect to see a more consistent interval between the spikes.&lt;/p&gt;
&lt;p&gt;What is the resolution on the power analyzer? And are you able to zoom in to one of the spikes? The current profile of the spike might tell us what to look for next.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>