<?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>Two separate methods to send data back to an MQTT server from NRF9160 but both have unique problems</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80802/two-separate-methods-to-send-data-back-to-an-mqtt-server-from-nrf9160-but-both-have-unique-problems</link><description>The objective is to be able to send data back up to an MQTT server using the Nordic NRF9160 hardware. Nordic staff is helpful but only writes back usually in the very early hours of the morning. 
 
 There are two methods I have tried to send data back</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Oct 2021 11:42:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80802/two-separate-methods-to-send-data-back-to-an-mqtt-server-from-nrf9160-but-both-have-unique-problems" /><item><title>RE: Two separate methods to send data back to an MQTT server from NRF9160 but both have unique problems</title><link>https://devzone.nordicsemi.com/thread/335075?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 11:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acb8e077-b120-49c1-a9ab-da7d778974b7</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;The #XMQTTPUB bug in SLM should be fixed by this pull request: &lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/5876"&gt;https://github.com/nrfconnect/sdk-nrf/pull/5876&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With that PR, the SLM should no longer enter data mode unless you want it to. See also the update to the documentation: &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK_dev/doc/PR-5876/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html#mqtt-publish-xmqttpub"&gt;http://developer.nordicsemi.com/nRF_Connect_SDK_dev/doc/PR-5876/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html#mqtt-publish-xmqttpub&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As for how to exit data mode, the answer is to send &amp;quot;+++&amp;quot; &lt;em&gt;without&lt;/em&gt; any CR or LF termination.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two separate methods to send data back to an MQTT server from NRF9160 but both have unique problems</title><link>https://devzone.nordicsemi.com/thread/334939?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 16:06:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c905270-173a-430f-bd66-4293afd75ae4</guid><dc:creator>GerryB</dc:creator><description>&lt;p&gt;Hi Didrik.&lt;/p&gt;
&lt;p&gt;Yes - method 1 finally works, thank you.&amp;nbsp; The forward slash character removal solved the last hurdle.&lt;/p&gt;
&lt;p&gt;As for method 2 - they werent retained messages that I know of - they were sent there by me - but one clue is that even without the subscribe topic being specified, they were received anyway&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two separate methods to send data back to an MQTT server from NRF9160 but both have unique problems</title><link>https://devzone.nordicsemi.com/thread/334875?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 12:41:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8808c641-ad3e-4e5f-8b90-f6c80d962849</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]There are two methods I have tried to send data back to the MQTT server based on two separate Nordic examples[/quote]
&lt;p&gt;I wouldn&amp;#39;t really say that there are two methods for doing MQTT on the nRF9160. They both use the same MQTT client library, mqtt_simple uses it directly, while the Serial LTE Modem (SLM) provides an AT command interface for customers that want to use the nRF1960 as a pure modem (i.e. not running their application on the nRF9160&amp;#39;s application core).&lt;/p&gt;
[quote user=""]note first and foremost that the filename and root directory/path must be short[/quote]
&lt;p&gt;This is mostly a limitation in Windows, though I agree that the sometimes long paths in the build folder doesn&amp;#39;t help. Most of that is inherited from Zephyr&amp;#39;s build system, so unfortunatley there isn&amp;#39;t much we can do about it.&lt;/p&gt;
[quote user="GerryB"]OK I found out one of the problems with Method 1[/quote]
&lt;p&gt;Does this mean that your mqtt_simple project now works as expected?&lt;/p&gt;
[quote user="GerryB"]It should be my/subscribe/topic and not /my/subscribe/topic[/quote]
&lt;p&gt;My impression is that it varies a bit from broker to broker how an initial / is handled. Some seem to ignore it, while other treat &amp;#39;foo&amp;#39; and &amp;#39;/foo&amp;#39; as different topics.&lt;/p&gt;
[quote user=""]METHOD 2:&amp;nbsp;&lt;span&gt;PROBLEMS with&amp;nbsp;LTE_Serial_Modem (LSM) AT#XMQTT commands&amp;nbsp;&lt;/span&gt;[/quote][quote user=""] one: for whatever reason, just connecting to the server makes it download a bunch of old messages that the MQTT_SIMPLE fortunately ignores.[/quote]
&lt;p&gt;What broker do you connect to?&lt;/p&gt;
&lt;p&gt;Were the messages retained messages?&lt;/p&gt;
&lt;p&gt;Do you have any logs, or steps to reproduce this?&lt;/p&gt;
&lt;p&gt;I have not experienced this any of my tests.&lt;/p&gt;
[quote user=""]Perhaps the bigger problem, however, is the AT#XMQTTPUB command.&amp;nbsp; Even if we could fix the first problem, the&amp;nbsp;&amp;nbsp;AT#XMQTTPUB command is broken.[/quote]
&lt;p&gt;This is a bug. I have reported it internally, so hopefully it will be fixed soon.&lt;/p&gt;
[quote user=""]and then when you type something again, it will publish once to the MQTT publish topic but never again and you are completely locked out from that point onward.[/quote]
&lt;p&gt;While I am able to reproduce the &amp;quot;#xmqttpub-enters-datamode-bug&amp;quot;, I am not able to reproduce this. When I typed in something for the second time (and more), it got sent to the broker as expected.&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: Two separate methods to send data back to an MQTT server from NRF9160 but both have unique problems</title><link>https://devzone.nordicsemi.com/thread/334707?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 02:24:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fc92d59-e55a-4cde-a94b-1a5e4657361d</guid><dc:creator>GerryB</dc:creator><description>&lt;p&gt;OK I found out one of the problems with Method 1 -- the subscribe and publish topics in the new MQTT_w_UART had a forward slash in front of them in the prj.conf file so I got rid of the forward slash and now it is at least getting the subscribed MQTT packets.&amp;nbsp; &amp;nbsp;It should be my/subscribe/topic and not /my/subscribe/topic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>