<?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>Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84422/sending-a-large-binary-payload-via-mqtt</link><description>Hi, I&amp;#39;m using the serial_lte_modem sample application and I&amp;#39;ve modified the AT#XMQTTPUB command so that I can specify a slot number from which the device can grab a bank of binary data and send it up to an aws server. For testing, I just have a predefined</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Feb 2022 08:34:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84422/sending-a-large-binary-payload-via-mqtt" /><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/352495?ContentTypeID=1</link><pubDate>Fri, 11 Feb 2022 08:34:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77e66ec0-c200-4fe8-9460-b45db8d7bda2</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello Randall,&lt;/p&gt;
[quote user="Philrt"]So I&amp;#39;m not sure what else I&amp;#39;m supposed to do to get a trace.[/quote]
&lt;p lang="en-GB"&gt;it should be enough to set:&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=y&lt;/pre&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;I have tested this with the Serial LTE modem application on my nRF9160 DK an it works as expected.&amp;nbsp;Which COM port did you select for recording?&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1644568352592v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/352451?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 21:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:919d64f0-0f27-4a70-9cbe-ef691d3f5363</guid><dc:creator>Randall</dc:creator><description>&lt;p&gt;&lt;span&gt;Well, I recompiled my serial_lte_modem project with CONFIG_NRF_MODEM_LIB_TRACE_&lt;/span&gt;&lt;span&gt;ENABLED=y, then I used the&amp;nbsp;AT%XMODEMTRACE=1,1 command to enable tracing on the application and AT+CFUN=0 which is my understanding that it should save it to NV RAM.&amp;nbsp; In the&amp;nbsp;Trace Collector V2 app I chose the debug UART, but nothing seemed to come over.&amp;nbsp; All the .bin files generated have 0 bytes in them.&amp;nbsp; So I&amp;#39;m not sure what else I&amp;#39;m supposed to do to get a trace.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351715?ContentTypeID=1</link><pubDate>Tue, 08 Feb 2022 09:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c99e6c7-05b3-4551-bd60-279fefcdf693</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello again Randall,&lt;/p&gt;
&lt;p lang="en-GB"&gt;I have gotten some feedback from our developers as well:&lt;/p&gt;
&lt;p lang="en-GB"&gt;“&lt;i&gt;Please be aware that the modem IP stack has a buffer limit of 4248 byte (MSS 708, max 6 packets). To publish large payload, MQTT Publish should have QoS 1 at least so as to get PUBACK, i.e. some basic uplink flow control. Otherwise there is possibility to overflow the TCP transmission buffer on modem side. My recommendation is to add QoS 1 in MQTT Pub request to monitor the traffic status first. TCP connection could vary for each uplink packet based on network condition.”&lt;/i&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;I hope this will help you.&lt;/p&gt;
&lt;p lang="en-GB"&gt;Regards,&lt;/p&gt;
&lt;p lang="en-GB"&gt;//Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351693?ContentTypeID=1</link><pubDate>Tue, 08 Feb 2022 08:10:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93d6bc91-9666-4578-bfef-9427e8dcbd87</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello Randall,&lt;/p&gt;
&lt;p lang="en-GB"&gt;could you provide me with a &lt;a href="https://infocenter.nordicsemi.com/topic/ug_trace_collector/UG/trace_collector/collect_modem_trace.html"&gt;modem trace&lt;/a&gt; + full application log from device boot, showing the described issue you are facing? You can preferably use the &lt;em&gt;Trace Collector V2 preview&lt;/em&gt; for that.&lt;/p&gt;
&lt;p lang="en-GB"&gt;Thanks &amp;amp; regards,&lt;/p&gt;
&lt;p lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351621?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 16:49:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:932eb82f-6c15-4ada-ba45-33e35cc55a76</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p lang="en-GB"&gt;Hello Randall,&lt;/p&gt;
[quote user="Philrt"]Is that possible?&amp;nbsp; Or is there any way to retain the reliability but have it send faster?[/quote]
&lt;p lang="en-GB"&gt;Thanks for the updates on your progress!&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;I’m not aware of any way to speed this up. Please note that TLS transmission is limited by hardware to 2kB, so you are already operating with a workaround.&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;But I’ll check with our developers if they have any input or comments to share.&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;Regards,&lt;/p&gt;
&lt;p lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351615?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 16:18:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2074c21b-317f-44bb-a9bd-438655553423</guid><dc:creator>Randall</dc:creator><description>&lt;p&gt;OK, I should probably make it clear what I&amp;#39;m asking for here.&amp;nbsp; With the extra 500 MSec at the end of the loop, the system seems to work pretty reliably, but is slow (takes about 15 seconds up upload&amp;nbsp; 64k).&amp;nbsp; Without the 500 Msec but only the retires, it sometimes works faster but fails about 50% of the time, so that isn&amp;#39;t acceptable.&amp;nbsp; I was hoping there was some way to check the socket buffer, and wait until it&amp;#39;s empty, then only to the SendTo when it&amp;#39;s completely empty.&amp;nbsp; Is that possible?&amp;nbsp; Or is there any way to retain the reliability but have it send faster?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351574?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 14:25:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5be3154b-50dc-4049-87dd-c85607001c04</guid><dc:creator>Randall</dc:creator><description>&lt;p&gt;OK.&amp;nbsp; Made a small mistake.&amp;nbsp; It turns out that the flag change didn&amp;#39;t help anything.&amp;nbsp; I forgot I still had the retries in there.&amp;nbsp; So it was actually them making it work, with the 2 failure conditions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending A large binary payload via MQTT</title><link>https://devzone.nordicsemi.com/thread/351568?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 14:11:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8567e8bc-6bad-4156-9064-0bddc2d903bf</guid><dc:creator>Randall</dc:creator><description>&lt;p&gt;Update:&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve discovered that if I add the commented out k_sleep shown below;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;offset = 0;
flags |= NRF_MSG_WAITALL;
while (offset &amp;lt; msg-&amp;gt;msg_iov[i].iov_len) {
for( retries = 0; retries &amp;lt; 5; retries++ )
{
ret = nrf91_socket_offload_sendto(obj,
(((uint8_t *) msg-&amp;gt;msg_iov[i].iov_base) + offset),
(msg-&amp;gt;msg_iov[i].iov_len - offset), flags,
msg-&amp;gt;msg_name, msg-&amp;gt;msg_namelen);
if ( ret &amp;gt;= 0 ) break;
k_sleep(K_MSEC( 500 + (retries * 500) ) );
}
if (ret &amp;lt; 0) {
printf( &amp;quot;Transmission Failed\n&amp;quot; );
return ret;
}
printf( &amp;quot;offset = %lu, len = %lu, ret = %lu\n&amp;quot;, offset, len, ret );
offset += ret;
len += ret;
//if ( offset &amp;lt; msg-&amp;gt;msg_iov[i].iov_len ) k_sleep(K_MSEC(500) );
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;it works.&amp;nbsp; But this seems rather inefficient.&amp;nbsp; So I added the flags |= NRF_MSG_WAITALL.&amp;nbsp; This is much more efficient but occasionally fails in 2 different ways.&amp;nbsp; 1 returns failed with errno set to EOPNOTSUPP or it simply locks up and seems to never return (at least not during the time period I was willing to wait).&amp;nbsp; Now I could make this work with some extrra higher level error handling.&amp;nbsp; &amp;nbsp;But I was hoping that there was a better way.&lt;/p&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>