<?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>Connecting to MQTT broker using NRF5340 with NRF9161 setup as SLM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114797/connecting-to-mqtt-broker-using-nrf5340-with-nrf9161-setup-as-slm</link><description>I am planning to modify the SLM application (NRF9161) to load its own certificates for TLS upon startup. This should be doable via modem_key_mgmt functions. 
 
 However, NRF5340 will still manage the MQTT connection to the broker. But in this case, it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Sep 2024 13:19:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114797/connecting-to-mqtt-broker-using-nrf5340-with-nrf9161-setup-as-slm" /><item><title>RE: Connecting to MQTT broker using NRF5340 with NRF9161 setup as SLM</title><link>https://devzone.nordicsemi.com/thread/502947?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 13:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6be57f6-bfee-4b35-b5c8-869c3c6c4032</guid><dc:creator>AdrianT</dc:creator><description>&lt;p&gt;Yes that is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to MQTT broker using NRF5340 with NRF9161 setup as SLM</title><link>https://devzone.nordicsemi.com/thread/502946?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 13:09:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c2b9c14-dd5f-40ea-a76c-71ef2061e210</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Never tried, but I believe it is possible.&lt;/p&gt;
&lt;p&gt;I assume you want to run MQTT protocol stack on nRF5340, then you can use TCP socket from SLM with TLS supported.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to MQTT broker using NRF5340 with NRF9161 setup as SLM</title><link>https://devzone.nordicsemi.com/thread/502944?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 12:56:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42042e6b-e74f-48bf-8198-392833e7e52a</guid><dc:creator>AdrianT</dc:creator><description>&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am using the mqtt subystem in zephyr - thus, I am not directly using the AT Commands that you gave. Instead, I am calling&amp;nbsp;mqtt_connect() function with the corresponding configurations populated in mqtt_client struct (in mqtt.h file).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is this still applicable?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to MQTT broker using NRF5340 with NRF9161 setup as SLM</title><link>https://devzone.nordicsemi.com/thread/502941?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 12:48:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db09863e-9c43-4df6-8c5d-637fde7b0681</guid><dc:creator>Charlie</dc:creator><description>&lt;p&gt;Hi AdrianT,&lt;/p&gt;
&lt;p&gt;You can still use secure connection, as long as your nRF9161 has certificates in the pointed&amp;nbsp;&lt;span&gt;sec_tag.&amp;nbsp;It does not matter which command host you are using.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;See&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html"&gt;MQTT client AT commands (nordicsemi.com)&lt;/a&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;AT&lt;/span&gt;&lt;span&gt;#XMQTTCON=&amp;lt;op&amp;gt;[,&amp;lt;username&amp;gt;,&amp;lt;password&amp;gt;,&amp;lt;url&amp;gt;,&amp;lt;port&amp;gt;[,&amp;lt;sec_tag&amp;gt;]]&lt;/span&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;op&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is an integer. It can accept one of the following values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;0&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- Disconnect from the MQTT broker.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;1&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- Connect to the MQTT broker using IP protocol family version 4.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;2&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- Connect to the MQTT broker using IP protocol family version 6.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;username&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is a string. It indicates the MQTT client username.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;password&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is a string. It indicates the MQTT client password in cleartext.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;url&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is a string. It indicates the MQTT broker hostname.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;port&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is an unsigned 16-bit integer (0 - 65535). It indicates the MQTT broker port.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;&amp;lt;sec_tag&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;parameter is an integer. It indicates the credential of the security tag used for establishing a secure connection.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Try to play this sample with Serial Terminal first to try MQTT TLS connection and you can refer to the following discussion.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/100371/are-there-any-examples-out-there-for-a-host-application-in-c-that-is-using-at-commands-via-serial-to-the-nrf9160-running-the-serial-lte-modem-for-a-mqtt-tls-connection"&gt;(+) Are there any examples out there for a host application in C that is using AT commands via serial to the nRF9160 running the Serial LTE Modem for a MQTT TLS connection? - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Charlie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>