<?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>Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages</link><description>Hello! 
 I am developing a solution that has a gateway and about 10 devices. 
 The devices has some sensors and their are connected in gateway. Actually I catch the sensor values and send to gateway, this feature works fine, but when the solution runs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Jan 2019 14:37:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages" /><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/166032?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 14:37:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01f7a0b7-bab4-4134-a1f6-26645f91d2a4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="renato.silva"]Yes, it happens because the callback function receives the messages from servers at the same time.[/quote]
&lt;p&gt;OK. Now I read your other comment again where you stated that &amp;quot;In the client side, there is a handle_data_cb function, this function is a callback that receives the messages from all servers, but when the messages arrived in the same time, some messages are losted.&amp;quot;, so this means that you actually get the packet then? If so, you can ignore my previous thoughts.&lt;/p&gt;
&lt;p&gt;Just to clarify: Is the case that you get a callback for all expected packets, but the data you print/log in&amp;nbsp;handle_data_cb is corrupted in some cases? If so it would be very interesting to see more of your client code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="renato.silva"]Can you explain in the light switch code where I can find this feature and how I can change it to reduce the quantity of messages losted?[/quote]
&lt;p&gt;&amp;nbsp;The light switch example sets the default TTL to SERVER_COUNT, which again is 3 if you have not changed it. Number of retransmissions is set to 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/166014?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 14:12:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44b506eb-c14d-4fe4-b2c4-42f2319de597</guid><dc:creator>Renato Silva</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages/165968"]The way I understand you the nodes only send a message every 10 seconds, but if turned on at the same time you will lose some messages.[/quote]
&lt;p&gt;Yes, it happens because the callback function receives the messages from servers at the same time.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages/165968"]What retransmission count and TTL do you use?[/quote]
&lt;p&gt;I didnt any change in the code responsible to the retransmission count and TTL. Probrably I am using the default from light switch exemple (SDK Mesh).&lt;br /&gt;&lt;br /&gt;Can you explain in the light switch code where I can find this feature and how I can change it to reduce the quantity of messages losted?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165968?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 12:43:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95bb7b96-898f-4f22-b219-a03284651c46</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Renato,&lt;/p&gt;
&lt;p&gt;The way I understand you the nodes only send a message every 10 seconds, but if turned on at the same time you will lose some messages. There is a random delay which should reduce the number of collisions, but it will happen from time to time (more often with more packets and more nodes). What retransmission count and TTL do you use? It would be interesting to adjust (increase) those and see if it helps.&lt;/p&gt;
&lt;p&gt;There has been a lot of improvements in the mesh SDK since version 1, so you should consider migrating to the latest release. This is generally a good idea, but the main reason I mention it is that the retransmit count is limited on version 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165935?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 11:30:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0912c81b-6bbb-4818-9813-e2dc56f5c756</guid><dc:creator>Renato Silva</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages/165909"]OK. So the problem is in the client/gateway, which is connected to 10 light switches based on the Mesh SDK example?[/quote]
&lt;p&gt;Yes, the problem is in the client/gateway.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/42423/lost-callback-messages-when-the-function-receive-many-simultaneous-messages/165909"]Can you describe in more detail what you have done and how/where you see the message being lost[/quote]
&lt;p&gt;My solution is based in&amp;nbsp;light switch example from SDK Mesh.&lt;/p&gt;
&lt;p&gt;Instead of the server send a command to turn on/off the lights, I inserted some sensors and a timer that sends the&amp;nbsp;sensors values&amp;nbsp;for each 10 seconds in a json object, using the packet_tx function present in access.c file.&lt;/p&gt;
&lt;p&gt;In the client side, there is a handle_data_cb function, this function is a callback that receives the messages from all servers, but when the messages arrived in the same time, some messages are losted.&lt;/p&gt;
&lt;p&gt;This is the function that receives the messages in the gateway side:&lt;/p&gt;
&lt;p&gt;static const access_opcode_handler_t m_opcode_handlers[] =&lt;br /&gt;{&lt;br /&gt; {{SIMPLE_ON_OFF_OPCODE_DATA, ACCESS_COMPANY_ID_NORDIC}, handle_data_cb} //foi criado um novo handle para os dados&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;static void handle_data_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args)&lt;br /&gt;{&lt;br /&gt; char *rec;&lt;br /&gt; char src[3] = {0}, *str;&lt;br /&gt; uint8_t type;&lt;/p&gt;
&lt;p&gt;__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;[%d] Mensagem original: %s \n&amp;quot;, ++x, p_message-&amp;gt;p_data);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;I did the follow test: When I turn on the servers with a time interval (5 sec, for example), the client side receives all the information with a gap (without loss). For example: I turn on the first one server and 5 sec. after I turned on the first one, I turn on the second one...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, when I turn on all the servers in the same time, the gateway lost some messages. I know it because I inserted in the json object a counter that show how much messages were sent from server and another counter that show how much messages were received in the gateway from each server.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165909?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 10:15:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b5ad545-448b-46cb-a861-72ad966f2a45</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Renato,&lt;/p&gt;
&lt;p&gt;OK. So the problem is in the client/gateway, which is connected to 10 light switches based on the Mesh SDK example? Can you describe in more detail what you have done and how/where you see the message being lost&lt;/p&gt;
&lt;p&gt;As this is in your code it would also be very useful if you could upload it here, so that we can try to understand it. Particularly seeing this&amp;nbsp;handle_cb function you refer to as the problem would be useful. When you debugged, how did you see that the data is lost in this function? How is it lost?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165803?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 15:36:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2fc2d0a-c71b-41de-b325-97623c4a07f9</guid><dc:creator>Renato Silva</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My solution is based in the&amp;nbsp;ight switch from SDK Mesh 1.0.&amp;nbsp;&lt;span&gt;(BLE mesh light switch example)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165658?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 08:51:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf5847a2-8633-4018-87e3-7e30c452788b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am still not sure which example and even which radio protocol you are referring to. Can you specify the full path to the example within the SDK? Are we talking about BLE mesh light switch example, or something else? If mesh, which version of mesh DSK are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165562?ContentTypeID=1</link><pubDate>Mon, 14 Jan 2019 16:04:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32927162-2e2e-43dd-b8dd-ff55523db2af</guid><dc:creator>Renato Silva</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I am using a light switch example from SDK14.&lt;/p&gt;
&lt;p&gt;Instead of the server send a command to turn on/off the lights, I inserted some sensors and a timer that sends the&amp;nbsp;sensors values&amp;nbsp;for each 10 seconds in a json object&lt;/p&gt;
&lt;p&gt;In the client side, there is a handle_cb function that receives the messages from all servers, but when the messages arrived in the same time, some messages are losted.&lt;/p&gt;
&lt;p&gt;I did the follow test: When I turn on the servers with a time interval (1 sec, for example), the client side receives all the information with a gap (without loss). However, when I turn on all the servers in the same time, the gateway lost some messages.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lost callback messages when the function receive many simultaneous messages</title><link>https://devzone.nordicsemi.com/thread/165512?ContentTypeID=1</link><pubDate>Mon, 14 Jan 2019 14:32:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06fb85fe-b8f0-4ebf-856e-85e450a8560f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you elaborate the question?&amp;nbsp;For instance, which radio protocol are you using, which SDK, more about your code etc.?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>