<?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>MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79831/mqttsn-example-client-unable-to-reconnect-to-broker-after-timeout</link><description>Hello, 
 I am currently using mqttsn publisher exams with keep allive time of 30 seconds, so according to MQTT standard if period of inactivity will be 45 second and the client is unable to recieve ping response or broker doesn&amp;#39;t recieve ping request</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Oct 2021 12:13:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79831/mqttsn-example-client-unable-to-reconnect-to-broker-after-timeout" /><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/335733?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 12:13:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f7cb49f-57f5-4d54-8682-4213d4557ad1</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2F_tmp%2Fnrf52840%2Fautodita%2FCURRENT%2Fparameters.i_sleep.html&amp;amp;cp=4_0_0_4_1_0_0"&gt;Here&lt;/a&gt; is the expected power consumption of the nRF52840DK in sleep mode.&lt;/p&gt;
&lt;p&gt;The spikes from my graphs are most likely &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html"&gt;Auto-controlled refresh modes for LDO and DC/DC regulators to maximize efficiency&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But an important point:&lt;br /&gt;If you want to measure the power consumption for your device, you need to do so yourself. My graphs will be different from what you get, as it is hard for us to set up the exact same setup, especially as you use custom code in a project consisting of multiple parts.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://no.wikipedia.org/wiki/Multimeter"&gt;Multimeters&lt;/a&gt; are not well suited to measure sleep currents, as they tend to have long sampling intervals and do not provide graphs. If you need to power-optimize your design, I strongly advise you to use an oscilloscope, &lt;a href="https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2"&gt;Power Profiler Kit 2&lt;/a&gt; or similar to do current measurements.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/335381?ContentTypeID=1</link><pubDate>Fri, 22 Oct 2021 01:48:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59499dee-3937-4475-802f-aa1fb41401a7</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;Sorry for late response.&lt;/p&gt;
&lt;p&gt;I am doing current measurement using multimeter. I am getting 6uA but after couple of seconds I can see spike of around 600-700 uA even when I am not doing anything. Also I see in your graph from profiler kit there are many spike of around 600-700 uA . What is that from. When I try to publish 1K bytes of data I get current consumption spike of around 4-6mA while sending data. Can you tell me from where are this spikes of 600uA coming from ? If I set a poll period of 4s, than I should a spike after 4 seconds right ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you please explain ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/334284?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 08:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56e22d48-10fd-433e-9f33-1c849eb91889</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="Brian (Geek)"]&lt;p&gt;Thanks for the explanation regarding polling period. Have you tried optimising the power consumption yet ? Because my device will be transmitting data reading i2c based sensors, so I would like to sleep my device and optimise the power consumption as much as possible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also I don&amp;#39;t have power profiler so I can&amp;#39;t provide you such a graph.&amp;nbsp;&lt;/p&gt;[/quote]
&lt;p&gt;My error in the previous graph was that I were running with debugging enabled. Without debugging, the graph from the mqttsn publisher sample (with logging disabled)looks like this:&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1634287894250v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The low part of the power consumption use an average of 7uA:&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1634287957923v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When you say:&lt;/p&gt;
[quote user="Brian (Geek)"]Because when I try to measure the current consumption it give me spikes in uA every few seconds[/quote]
&lt;p&gt;How do you measure this current consumption? &lt;br /&gt;How big are the spikes?&lt;br /&gt;How many seconds?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/334195?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 13:55:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c4b0e2e-6280-415e-b6d7-bb6d979575ea</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the explanation regarding polling period. Have you tried optimising the power consumption yet ? Because my device will be transmitting data reading i2c based sensors, so I would like to sleep my device and optimise the power consumption as much as possible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also I don&amp;#39;t have power profiler so I can&amp;#39;t provide you such a graph.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/333487?ContentTypeID=1</link><pubDate>Mon, 11 Oct 2021 11:56:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e77977f5-fa89-406a-bc3e-89b2c23021a1</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Good to hear that the state machine works!&lt;/p&gt;
&lt;p&gt;The nRF5 SDK samples are not power optimized by default. I will have a look at the Sleepy Publisher sample to try to power optimize it.&lt;/p&gt;
&lt;p&gt;Without the power optimization, the power usage looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1633953218282v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;This is with DEFAULT_POLL_PERIOD as 10000, that is 10 seconds.&lt;br /&gt;The Default Poll Period is how often the Thread Sleepy End Device will ping the Thread Network to show that it is alive, as well as get updates from the Thread Network.&lt;/p&gt;
&lt;p&gt;From the plot above, this is when the Current spikes appear.&lt;/p&gt;
&lt;p&gt;Could you post your current measurement plot, so that I can easier understand your issue?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/333346?ContentTypeID=1</link><pubDate>Sat, 09 Oct 2021 16:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b26cf3f-817c-4040-8e98-97333ca4410b</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hey Sigurd,&lt;/p&gt;
&lt;p&gt;Thanks for assistance. I managed to achieve a state machine for mqtt-sn examples.&lt;/p&gt;
&lt;p&gt;Currently my devices are in testing stage, once i feel everything is working properly I would close this ticket.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Till that can you please tell me what&amp;#39;s exactly is the use of polling period in sleepy example. Because when I try to measure the current consumption it give me spikes in uA every few seconds. I would like to keep my device in sleep state for 5 minutes. Than what should be my default and short poll period ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332988?ContentTypeID=1</link><pubDate>Thu, 07 Oct 2021 10:52:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52544308-c443-411d-8002-ac0c20b71441</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
[quote user="Brian (Geek)"]As you asked me about whether I am getting MQTTSN disconnect event. Answer is yes, in mqqtsn_event handler i am getting MQTTSN DISCONNECT event. Also in the mqtt-sn logs, when I shut down the broker I can see disconnect packet sent to client. So that aspect is working fine. But in Mqtt-sn disconnect event, than I have to try to connect to gateway manually. Can that be automated like somewhere in background similar to normal python MQTT client ?&amp;nbsp;[/quote]
&lt;p&gt;I do not know of any way to make this reconnect automatically. Since that MQTTSN implementation does not seem to do this automatically, you will have to fix this manually in the mqttsn_event_handler in your application.&lt;/p&gt;
[quote user="Brian (Geek)"]In that switch case of CLIENT CONNECTEd, disconnected and establishing connection give me assertion error whenever I shut down the broker. Why is it so ?&amp;nbsp;[/quote]
&lt;p&gt;This crashes due to the handler not being able to handle a fsm_event. The fsm_event can have the following values:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief MQTT-SN events that cause MQTT-SN client&amp;#39;s state to change. */
typedef enum client_state_fsm_event_t
{
    SENT_SEARCHGW,                  /**&amp;lt; SEARCH GATEWAY message was sent. */
    SENT_CONNECT,                   /**&amp;lt; CONNECT message was sent. */
    SENT_PINGREQ,                   /**&amp;lt; PINGREQ message was sent. */
    SENT_SLEEP_REQUEST,             /**&amp;lt; DISCONNECT message with sleep duration was sent. */
    SENT_DISCONNECT_REQUEST,        /**&amp;lt; DISCONNECT message without sleep duration was sent. */

    RECEIVED_CONNACK,               /**&amp;lt; CONNACK message was received. */
    RECEIVED_SLEEP_PERMISSION,      /**&amp;lt; Response to a DISCONNECT message with sleep duration was received. */
    RECEIVED_DISCONNECT_PERMISSION, /**&amp;lt; Response to a DISCONNECT message without sleep duration was received. */
    RECEIVED_DISCONNECT,            /**&amp;lt; DISCONNECT message sent not as a response (disconnected by the gateway). */
    RECEIVED_PINGRESP,              /**&amp;lt; PINGRESP message was received. */

    TIMEOUT_SEARCHGW,               /**&amp;lt; Timeout occurred when waiting for GWINFO message. */
    TIMEOUT_CONNECT,                /**&amp;lt; CONNECT message retransmission limit has been reached. */
    TIMEOUT_PINGREQ                 /**&amp;lt; PINGREQ message retransmission limit has been reached. */
} client_state_fsm_event_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you are able to find the value of the fsm_event int the MQTT_CLIENT_CONNECTED switch case, this could give an indication to why it will crash on broker disconnect.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332894?ContentTypeID=1</link><pubDate>Wed, 06 Oct 2021 16:40:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:586ae481-f5cc-4b2d-8cea-a867cfa41572</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;Quick Update: I have updated the mqtt-sn gateway on Nordic border router image to the one used in the docker image link which you have provided. I tried updating mqtt-sn gateway to the master branch but the configuration have changed now. So I have stick with the mqtt-sn gateway commit used in Docker Image. So&lt;span style="font-family:inherit;"&gt;&amp;nbsp;my MQTT-SN gateway is almost up-to-date.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you asked me about whether I am getting MQTTSN disconnect event. Answer is yes, in mqqtsn_event handler i am getting MQTTSN DISCONNECT event. Also in the mqtt-sn logs, when I shut down the broker I can see disconnect packet sent to client. So that aspect is working fine. But in Mqtt-sn disconnect event, than I have to try to connect to gateway manually. Can that be automated like somewhere in background similar to normal python MQTT client ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also I am facing a new issue now. With the updated mqtt-sn gateway on border router, whenever I shut-down the broker it gives me a assertion error one by one in mqttsn_client.c file state changed function. In that switch case of CLIENT CONNECTEd, disconnected and establishing connection give me assertion error whenever I shut down the broker. Why is it so ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332585?ContentTypeID=1</link><pubDate>Tue, 05 Oct 2021 11:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eb5d9cf-07c8-452d-a75c-d8f9fba8307d</guid><dc:creator>Brian (Geek)</dc:creator><description>[quote userid="106736" url="~/f/nordic-q-a/79831/mqttsn-example-client-unable-to-reconnect-to-broker-after-timeout/332527#332527"]&lt;p&gt;Secondly:&lt;/p&gt;
&lt;p&gt;Do you receive a disconnect callback in the code at the nRF client when you disconnect the broker?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Third:&lt;/p&gt;[/quote]
&lt;p&gt;&lt;span style="white-space:nowrap;"&gt;Hello, i have tried debugging using Segger Studio with both mqttsn publisher/sleepy publisher example and adding a break point at below mqttsn_event handler case.Program never stops here at the below code, so the following event never get generated.&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;pre class="ui-code" data-mode="c_cpp"&gt;    case MQTTSN_EVENT_DISCONNECT_PERMIT:
            NRF_LOG_INFO(&amp;quot;MQTT-SN event: Client disconnected.\r\n&amp;quot;);
            disconnected_callback();
            device_connection_status = DEVICE_DISCONNECTED;
            break;
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="white-space:nowrap;"&gt;&lt;br /&gt; &lt;br /&gt; the disconnect_callback function never gets called. So second answer is NO.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="white-space:nowrap;"&gt;&lt;/span&gt;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/79831/mqttsn-example-client-unable-to-reconnect-to-broker-after-timeout/332527#332527"]&lt;p&gt;Third:&lt;/p&gt;
&lt;p&gt;A sniffer log would be useful. Could you set up the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-802154"&gt;nRF Sniffer for 802.15.4&lt;/a&gt;, and sniff to see if a disconnect event is sent when you disconnect the broker?&lt;/p&gt;[/quote]
&lt;p&gt;&lt;span style="white-space:nowrap;"&gt;Third:&lt;/span&gt;&lt;br /&gt; A sniffer log would be useful. Could you set up the nRF Sniffer for 802.15.4, and &amp;gt;sniff to see if a disconnect event is sent when you disconnect the broker?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; I don&amp;#39;t see any disconnect packet sent, you can also verify the sniffed packets. I have attached two sniffer package: 1) After Broker has been shutdown 2) Full Communication&lt;br /&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/afterbrokerdisconnected.pcapng"&gt;devzone.nordicsemi.com/.../afterbrokerdisconnected.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/FullPacketCapture.pcapng"&gt;devzone.nordicsemi.com/.../FullPacketCapture.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; &lt;span style="white-space:nowrap;"&gt;Regarding&amp;nbsp;first&amp;nbsp;i&amp;nbsp;would&amp;nbsp;try&amp;nbsp;to&amp;nbsp;find&amp;nbsp;out&amp;nbsp;by&amp;nbsp;R&amp;amp;D.&lt;/span&gt;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/79831/mqttsn-example-client-unable-to-reconnect-to-broker-after-timeout/332527#332527"]You test a MQTT client versus a MQTT-SN client. Could you try to find a python MQTT-SN server to test with?&lt;br /&gt;This is to test if the issue is with the MQTT-SN protocol.[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332527?ContentTypeID=1</link><pubDate>Tue, 05 Oct 2021 09:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c86017c-87f3-4624-80bb-d09fbad8a55c</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="Sigurd Hellesvik"]In the meantime, you could try to manually disconnect and connect the client when you get a timeout event. [/quote]
&lt;p&gt;Yea, this will be inefficient. So lets try to find a way to find if there is another way first.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;First:&lt;/p&gt;
[quote user=""]For Example: if I take a python MQTT client with keep alive time of 60 second and turn off and turn on the mosquito broker , the python client immediately connects within few seconds. I want some solution like that for mqtt-sn client.&amp;nbsp;[/quote]
&lt;p&gt;You test a MQTT client versus a MQTT-SN client. Could you try to find a python MQTT-SN server to test with?&lt;br /&gt;This is to test if the issue is with the MQTT-SN protocol.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Secondly:&lt;/p&gt;
&lt;p&gt;Do you receive a disconnect callback in the code at the nRF client when you disconnect the broker?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Third:&lt;/p&gt;
&lt;p&gt;A sniffer log would be useful. Could you set up the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-802154"&gt;nRF Sniffer for 802.15.4&lt;/a&gt;, and sniff to see if a disconnect event is sent when you disconnect the broker?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332215?ContentTypeID=1</link><pubDate>Sat, 02 Oct 2021 01:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5edb1d53-7fdb-4973-a5ae-e240eb047036</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;I will wait for your response.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you tell me how can I implement your suggestion. If a event timeout occur it&amp;#39;s reason could be anything I guess. And&amp;nbsp; also for a client to get timedout, it will wait for 1.5 times the keep alive time before disconnecting if no ping response is received.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/332169?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:36:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62797bfb-2a81-414f-8fc2-dff78b7d2022</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have asked the developers for how to automatically detect if the MQTT broker disconnects, and will return to you with an answer on this by Tuesday.&lt;/p&gt;
&lt;p&gt;In the meantime, you could try to manually disconnect and connect the client when you get a timeout event. &lt;br /&gt;This should make the client able to reconnect after a single timeout interval rather than multiple.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/331814?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 03:45:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3168f1f9-f959-4608-b6be-5da4ad3c5b38</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;I have used app timer instead of buttons for sending data.Else everything is same. I have provide my main.c file. I have tried&amp;nbsp; to establish an network with forever mesh connectivity. If for some reason mqttsn client gets timeout, it should send search request again and connect to gateway again. I tried to create a state machine using mqttsn events, so that every event is handled properly. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- My keep alive time is set to 60.&lt;/p&gt;
&lt;p&gt;Here is my main.c file:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqttsnsleepysample.c"&gt;devzone.nordicsemi.com/.../mqttsnsleepysample.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also do tell me if there is any problem in my code ? As i said i want to establish a state machine type code, so that decisions are made based on events automatically.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/331431?ContentTypeID=1</link><pubDate>Tue, 28 Sep 2021 07:53:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b8fa54e-6faf-43cf-908c-b545f7df5e48</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
&lt;p&gt;Have you changed the MQTT-SN sleepy publisher example? &lt;br /&gt;If you have changed the example, could you send the code you are running, so that I can try to reproduce your issue?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I will also set up the Nordic Border Router Image to test with this.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/331405?ContentTypeID=1</link><pubDate>Tue, 28 Sep 2021 03:21:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1438bce0-4858-4280-8eac-426197987215</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;I am currently using Nordic Border Router image as suggested by Jonathan *** from Openthread Google Group.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And also that image is the latest one, so I don&amp;#39;t think that could be the issue or no one ever checked with that image ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;According to my understanding the lag is because I have kept Keep Alive time of 60 sec, so after 90 sec only my MQTT client will be able to know that it has got disconnected from the broker. So can you please check with Nordic image itself.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would like reiterate I am able to reconnect to gateway but after that 90 seconds. In my publish function, I have condition to check whether client is connected or disconnected, if connected it will send data, if not connected it will re-initiate a connection with gateway. But for this to happen it has to wait 1.5 times the keep alive time period as per MQTT standard.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But how a normal MQTT client in my PC is able to connect to mosquitto broker after restart of broker I don&amp;#39;t get the same result with my thread mqtt-sn publish client.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/331327?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 13:22:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:205b8570-ccdb-4dd8-bdb6-67fe50b362f5</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;When I build and run the MQTT-SN sleepy publisher, I can not see the lag you are mentioning.&lt;/p&gt;
&lt;p&gt;It could be a problem with the MQTT-SN gateway. &lt;br /&gt;I used the &lt;a href="https://github.com/osaether/otbr-mqtt-sn/"&gt;https://github.com/osaether/otbr-mqtt-sn/&lt;/a&gt;, maybe you could try this?&lt;/p&gt;
&lt;p&gt;To set up this, install and setup docker. Then go to the releases in the mentioned github and download the otbr-mqtt-sn-1.2. This is a docker image.&lt;br /&gt;To unzip and load this, use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;gzip -d otbr-mqtt-sn-1.2.tar.gz
docker load &amp;lt; otbr-mqtt-sn-1.2.tar&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then you can run the &amp;quot;docker run&amp;quot; command from the README to start the border router.&lt;/p&gt;
&lt;p&gt;Are you able to try this?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/330770?ContentTypeID=1</link><pubDate>Thu, 23 Sep 2021 08:50:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:787f550d-063e-4f1d-9af9-3242a108bc4e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
&lt;p&gt;I will have to fix a bug with my install of the MQTT-SN router.&lt;/p&gt;
&lt;p&gt;I think I will be able to fix this at the start of next week. Sorry for this delay.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/330740?ContentTypeID=1</link><pubDate>Thu, 23 Sep 2021 04:21:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e62b4768-e72b-45db-8f49-56de23cd183f</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Okay will be waiting&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/330636?ContentTypeID=1</link><pubDate>Wed, 22 Sep 2021 11:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51a98d04-9cfe-4d64-b719-10aee9b46ab5</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
&lt;p&gt;To test this I will have to set up a MQTT-SN router. &lt;br /&gt;I will return here with my results tomorrow.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/330528?ContentTypeID=1</link><pubDate>Tue, 21 Sep 2021 16:39:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dec7fb2-aeff-4942-81ad-e9a2c9140f60</guid><dc:creator>Brian (Geek)</dc:creator><description>&lt;p&gt;Hello Sigurd,&lt;/p&gt;
&lt;p&gt;In my setup I have a Sleepy End device running mqtt-sn sleepy publisher example. The mqtt-sn gateway setup on RPi is configured to send data on local mosquitto broker running on my PC.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1 : in mqttsn sleepy publisher example I am using app timer timeout to publish data at every 20 sec. I have currently kept mqtt-sn keep alive timeout to 60 seconds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So currently what is happening is, I am checking wether my client is connected to broker or not by checking client state. If it&amp;#39;s connected than only I am publishing data. So suppose I have just published data to local mosquitto broker, and if I restart mosquitto broker service it takes my mqtt-sn client around 2 minutes (1.5*keep alive time + client state update delay and connection establishing time etc) to publish next data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if you take a normal python MQTT client connected to broker, if you restart the broker it will connect to broker instantly without much of delay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So can you tell me is there any way I can connect to broker if timeout as soon as possible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2:&amp;nbsp; Query regarding Poll period in Mqtt-sn sleepy publisher example&lt;/p&gt;
&lt;p&gt;Also I would like to know what&amp;#39;s the use of polling period in mqtt-sn sleepy publisher example. From openthread docs it&amp;#39;s state it basically is the time interval after which a client checks for data with its parent. But as mqtt-sn publisher is publishing, not receiving anything so what&amp;#39;s the use of poll period in that example. Also the two function name wakeup and sleep is confusing as in wakeup we are just changing poll period.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So does&amp;nbsp; this mean&amp;nbsp; in mqttsn sleepy&amp;nbsp; publisher example if I want to make my device sleep for 1, minutes I can pass the 60,000 as polling period for that device. Is that the purpose of polling period in sleepy publisher example ? And if it brings the device in sleep state, than will app timer timeout after 20 second will wake sleep end device from sleep state ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It will be helpful if you can elaborate the usage of polling period in mqttsn publisher example and how can I increase the time my sleep end device stay in sleep state.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTTSN Example: Client unable to reconnect to Broker after timeout</title><link>https://devzone.nordicsemi.com/thread/330454?ContentTypeID=1</link><pubDate>Tue, 21 Sep 2021 10:54:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eb574b9-8c8c-4db1-a9a4-6038cb2c5209</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Brian&lt;/p&gt;
&lt;p&gt;Could you explain your setup, so that I can try to reproduce your problem?&lt;/p&gt;
&lt;p&gt;What hardware and which examples are you using?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>