<?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>Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89248/time-managing-data-from-several-peripherals---ble-over-uart</link><description>Hello everyone, 
 I am working with the SDK v17.1.0 with the DK nRF52832 with the examples of ble_app_uart and ble_app_uart_c. 
 I managed to implement a multilink communication of BLE over UART with two peripherals and a central. 
 Each peripheral is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Jun 2022 10:53:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89248/time-managing-data-from-several-peripherals---ble-over-uart" /><item><title>RE: Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/thread/374118?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2022 10:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc48ebdf-3d18-482e-a6e2-4c3bf34ec3e3</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;I was thinking that you could have a global buffer for each peer and fill the corresponding buffer when your receive data from a peer. You check the size of the buffer each time you fill and if it&amp;#39;s full then you print it out.. Again, this would not be quite optimal memory wise when you have a lot of peers..&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/thread/374010?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 15:42:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6b8a8b9-2b64-4827-a598-fe48b3009a08</guid><dc:creator>vw_dev</dc:creator><description>&lt;p&gt;So I would have a buffer declared in the function&amp;nbsp;&lt;span&gt;ble_nus_chars_received_uart_print() common to all the peer, and while this buffer is not filled with the data, I would block any other data to be put in the uart? (through&amp;nbsp;app_uart_put).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;like:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;uint8_t buffer[107];&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;const uint8_t&amp;nbsp;buffer_length = sizeof(buffer);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;memset(buffer, 0 ,&amp;nbsp;buffer_length);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;while (buffer[107] != \n) { //because the data will end with a \n&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;for (uint32_t i = 0; i &amp;lt; data_len; i++)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret_val = app_uart_put(p_data[i]);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; buffer[i] = p_data[i];&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((ret_val != NRF_SUCCESS) &amp;amp;&amp;amp; (ret_val != NRF_ERROR_BUSY))&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NRF_LOG_ERROR(&amp;quot;app_uart_put failed for index 0x%04x.&amp;quot;, i);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(ret_val);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } while (ret_val == NRF_ERROR_BUSY);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&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: Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/thread/373943?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 12:45:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b849c60c-462c-46a2-afbf-2ad47092fc51</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hmm, maybe it isn&amp;#39;t the best solution for many connections. You shouldn&amp;#39;t have to have a for loop in the ble event handler. You only need to direct&amp;nbsp;ble_nus_chars_received_uart_print() to the data buffer when it has been filled and provide the buffer length.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/thread/373933?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 12:01:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b6d67d5-b593-4183-b62a-f57d87e5d13a</guid><dc:creator>vw_dev</dc:creator><description>&lt;p&gt;Hello, thank you for the answer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I work with only 2 peripherals but I could have around 20 peripherals in my future development.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you think it could be an idea to create as many buffers as perripherals connected?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If so, that means I could create a for loop in the&amp;nbsp;ble_nus_c_evt_handler in the&amp;nbsp;&lt;span&gt;BLE_NUS_C_EVT_NUS_TX_EVT case, where, for each handle, I would print the buffer associated to each peer?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time managing data from several peripherals - BLE over uart</title><link>https://devzone.nordicsemi.com/thread/373898?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 10:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36559f0b-944a-41b3-9295-dfbccd3d3a75</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;BLE_NUS_C_EVT_NUS_TX_EVT is generated when data is received from a peer regardless of which peer that is sending the data. To only print data from one peer at a time, you could declare&amp;nbsp;two buffers of 6*18 bytes for each peer and only print them when the buffer has been filled. The event structure will contain the connection handle which you can use to differentiate between the two peers.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>