<?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>Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38664/send-high-number-of-messages-from-one-node-to-another---mesh-sdk-2-1-1</link><description>Hi, I&amp;#39;m trying to use the light_switch example in the Mesh SDK 2.1.1 to build a small experiment to count how many messages are received by the server when sending a consecutive number of messages from the client. My first approach was to use a function</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Oct 2018 14:38:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38664/send-high-number-of-messages-from-one-node-to-another---mesh-sdk-2-1-1" /><item><title>RE: Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/thread/152245?ContentTypeID=1</link><pubDate>Tue, 09 Oct 2018 14:38:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75531748-2dc1-4e21-8aca-edbb8ceb0314</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;The messages will be stored in a buffer, and will be sent out when the Mesh is available. So if you send a lot of messages fast, the buffer will be filled up and you will get NRF_ERROR_NO_MEM. &lt;/p&gt;
&lt;p&gt;I can see that you are using nrf_delay_ms(100); when sending the messages. This can cause a lot of issues and isn&amp;#39;t recommended. By using nrf_delay_ms() you will hold up the CPU from doing anything. If you want to use a timer, you can instead use app_timer.&lt;/p&gt;
&lt;p&gt;You can use the tx_complete event to send messages consecutively. That way you won&amp;#39;t fill up the buffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/thread/151082?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 20:29:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04cbdc98-0752-409b-a525-6332de9ca806</guid><dc:creator>Paulo.Zacarias</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;My question was probably not the best , I admit &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The thing is that I have been trying already to debug it, but I have some issues.&lt;br /&gt;&lt;br /&gt;I tried to put a break code inside the function &lt;strong&gt;access_model_publish()&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;but for some reason I&amp;#39;m not able to set a breakpoint anywhere there:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1538424427629v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then I tried to look inside the function &lt;strong&gt;packet_tx() &lt;/strong&gt;that is called from the&amp;nbsp;access_model_publish(), but again I&amp;#39;m not able to set a breakpoint there.&lt;br /&gt;&lt;br /&gt;Then I tried to look in the functions called inside packet_tx() to see which one could possibly return the NRF_ERROR_NO_MEM error.&lt;br /&gt;&lt;br /&gt;I found it inside the function &lt;strong&gt;access_loopback_handle()&lt;/strong&gt;, but since I cannot set a breakpoint there either, I cannot say if it&amp;#39;s from there that I receive the no memory status:&lt;br /&gt;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1538424652212v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;But anyway, it would be strange if packet_tx() would call access_loopback_handle(), as from what I understand that function is to verify if destination address is within the node itself, which is not the case...&lt;br /&gt;But I can&amp;#39;t debug there either to be sure:&lt;br /&gt;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1538424855740v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I also tried a different approach and set a breakpoint at the &lt;strong&gt;app_error_handler()&lt;/strong&gt; function instead, so I could try to catch what function was return the error, but without success. The function that is shown before the app_error_handler() in the Call Stack is the function I created myself to send the messages:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1538425014289v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So this is from the debug side... On the other hand, don&amp;#39;t get it why the messages seem to be &amp;quot;stored&amp;quot; in some kind of&amp;nbsp; &amp;quot;queue&amp;quot; before being sent, instead of being sent one by one each time we call &lt;strong&gt;access_model_publish()&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So even if I increase the RAM somehow,&amp;nbsp; if I want to send, let&amp;#39;s say 50 messages, they will all be stored prior to send? And where in the code is implemented such behavior?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/thread/150968?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 12:38:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbaedf47-5b21-4f34-aeab-41317f1ed8c5</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;You would need to debug your code to see which function that are returning this error code. I think you might be able to solve this by increasing the RAM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/thread/150769?ContentTypeID=1</link><pubDate>Thu, 27 Sep 2018 19:38:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e7a4482-d022-4f11-9cf2-cc80d600861c</guid><dc:creator>Paulo.Zacarias</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;If I send lower than 5 messages the behavior is the same, I only receive the messages in the server after client has finished sending then &lt;strong&gt;all&lt;/strong&gt;.&lt;br /&gt;It&amp;#39;s like messages are store in some kind of buffer before being sent.&lt;/p&gt;
&lt;p&gt;In fact, I changed my code having based my &lt;strong&gt;send_repeated_message() &lt;/strong&gt;function in the &lt;strong&gt;simple_on_off_client_set_unreliable() &lt;/strong&gt;itself&lt;strong&gt; &lt;/strong&gt; instead of calling it every time, so that I call directly &lt;strong&gt;access_model_publish()&lt;/strong&gt; instead:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void send_repeated_message()
{
    uint32_t status = NRF_SUCCESS;
    simple_on_off_client_t * p_client = &amp;amp;m_clients[0];


    simple_on_off_msg_set_unreliable_t set_unreliable;
    set_unreliable.on_off = 1;
    set_unreliable.tid = m_tid++;

    access_message_tx_t message;
    message.opcode.opcode = SIMPLE_ON_OFF_OPCODE_SET_UNRELIABLE;
    message.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
    message.p_buffer = (const uint8_t*) &amp;amp;set_unreliable;
    message.length = sizeof(set_unreliable);
    message.force_segmented = false;
    message.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;

  for(uint8_t i= 1; i &amp;lt;10; i++)
  {
    message.access_token = nrf_mesh_unique_token_get();
    status = access_model_publish(p_client-&amp;gt;model_handle, &amp;amp;message);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Number of message sent: %u\n&amp;quot;, i);
      if (status != NRF_SUCCESS)
      {
         ERROR_CHECK(status);
         break;
         return status;
      }
    nrf_delay_ms(100);
    //__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Number of message sent: %u\n&amp;quot;, i);
  }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And I found out that the problem is in the client side. It seems to actually store the messages in some sort of buffer or memory and that such buffer can keep only maximum 5 messages, more than that and I receive a NRF_ERROR_NO_MEM:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;t:     331499&amp;gt;, main.c,  199, Number of message sent: 1
&amp;lt;t:     334787&amp;gt;, main.c,  199, Number of message sent: 2
&amp;lt;t:     338074&amp;gt;, main.c,  199, Number of message sent: 3
&amp;lt;t:     341361&amp;gt;, main.c,  199, Number of message sent: 4
&amp;lt;t:     344648&amp;gt;, main.c,  199, Number of message sent: 5
&amp;lt;t:     347930&amp;gt;, main.c,  199, Number of message sent: 6
&amp;lt;t:     347932&amp;gt;, app_error_weak.c,  105, Mesh error 4 at 0x0002666B (C:\Nordic\nrf5_SDK_for_Mesh_v2.1.1_src_SEND_MESSAGE\examples\light_switch\proxy_client\src\main.c:202)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But how can I figure out were that out of memory comes from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send high number of messages from one node to another - Mesh SDK 2.1.1</title><link>https://devzone.nordicsemi.com/thread/150493?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 13:00:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d8b67ea-3e48-4123-b76a-3fc47b101e25</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This seems like a strange issue. I haven&amp;#39;t seen this before, I&amp;#39;m not sure why you have to wait until all messages are finished sending before seeing the count on the server side. And it shouldn&amp;#39;t be a limit on how many messages you can receive on the server. What happens if you send lower than 5 messages?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>