<?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>Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43161/using-ble_nus_data_send-in-multiple-peripherals-example</link><description>Hi, 
 I am using NRF 52832 S132 sdk 15.2.0. 
 I am working with example project &amp;lt;install folder&amp;gt;\examples\ble-peripheral\experimental\ble-app_multiperipheral. 
 I added NUS to this project and is working properly. I want to send a message from NRF board</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Mar 2019 05:11:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43161/using-ble_nus_data_send-in-multiple-peripherals-example" /><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/178215?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 05:11:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51b20535-5201-4620-a4ec-2a0be09eab35</guid><dc:creator>Arya</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you suggest a proper connection interval for this case? I am encountering some problems. After disconnection devices does not connect to each other automatically. I have to reset them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/171344?ContentTypeID=1</link><pubDate>Fri, 15 Feb 2019 11:26:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c80cf7d-0fc6-47c5-b7b6-6f14909aaaa7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok, so they are not overlapping. 7.5-30ms and 200-400ms will not find a common connectioninterval that they are both satisfied with. In reality, the central will decide the connection interval, and in this case the connection interval is probably 30ms. If you encounter disconnects after a couple of minutes, it is probably because the devices can&amp;#39;t decide on the connection interval, and the peripheral will disconnect.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But the connection interval isn&amp;#39;t really that important in this ticket. I just wanted to see what sort of delay we were dealing with.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If ble_nus_data_send returns NRF_ERROR_RESOURCES, then your softdevice buffer is full, and you need to wait for a BLE_GATTS_EVT_HVN_TX_COMPLETE event to queue more packets. It is as easy as that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/171277?ContentTypeID=1</link><pubDate>Fri, 15 Feb 2019 06:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dee44f5-09ef-4c80-8aaf-0475b33a307d</guid><dc:creator>Arya</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL 7.5
NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL 30&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The break and resume method works for 2 central devices for 15 characters. In that case I don&amp;#39;t have check for BLE_GATTS_EVT_HVN_TX_COMPLETE?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/171054?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 09:21:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccc39ab1-632d-4e0d-a001-d5ebb0191d4b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;The connection interval on the central is set in sdk_config.h. It is called&amp;nbsp;NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL and&amp;nbsp;NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL.&lt;/p&gt;
&lt;p&gt;Did you try to implement the break and resume on the TX_COMPLETE event?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/171004?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 05:15:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f01be9c-2299-4a34-88bb-fb4b6d3db2c0</guid><dc:creator>Arya</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Sorry for the delay in reply.&lt;/p&gt;
&lt;p&gt;My connection intervals in peripheral:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(200, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(400, UNIT_1_25_MS) &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am using ble_app_uart_c as my central device. So there is no connection interval set.&lt;/p&gt;
&lt;p&gt;I changed my code a little bit. Now I am sending data based on acknowledgement from each central. Above snippets did not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/169861?ContentTypeID=1</link><pubDate>Thu, 07 Feb 2019 09:05:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77a014cd-6f27-4f41-89f9-5d6561dfade8</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;You can increase NRF_SDH_BLE_GATT_MAX_MTU_SIZE, but you may still encounter this error, so you have to handle it correctly.&lt;/p&gt;
&lt;p&gt;Your implementation in the last snippet will probably work, as far as I can tell, but it is not power efficient. What is your connection interval? In this implementation:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;do
{
    err_code = ble_nus_data_send();
}while (err_code == NRF_ERROR_RESOURCES)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It will keep spinning through ble_nus_data_send() until it gets a TX_COMPLETE (&lt;span&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE&lt;/span&gt;) event. This will not happen until a packet is delivered, earliest the next connection event (which occurs each connection interval).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Therefore, when you receive an NRF_ERROR_RESOURCES from ble_nus_data_send() you should break, so that the chip can go to sleep until the next connection event, and then resume sending messages.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What is your log output from your last snippet? Were you able to send to all devices? And what is your connection interval (MIN and MAX) on your central(s) and peripheral(s)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/169736?ContentTypeID=1</link><pubDate>Wed, 06 Feb 2019 13:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:984552c1-7dd5-4328-b23d-6357362cc7d2</guid><dc:creator>Arya</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Thank you for the reply. I have to send message in every one second from peripheral. So I am using app timer to send message. So when connection is established&amp;nbsp; I am starting my apptimer.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void on_connected(const ble_gap_evt_t * const p_gap_evt)
{
    ret_code_t  err_code;
    uint32_t    periph_link_cnt = ble_conn_state_peripheral_conn_count(); // Number of peripheral links.
    ble_conn_state_conn_handle_list_t conn_handles = ble_conn_state_periph_handles();

    NRF_LOG_INFO(&amp;quot;Connection with link 0x%x established.&amp;quot;, p_gap_evt-&amp;gt;conn_handle);
    for (uint8_t i = 0; i &amp;lt; conn_handles.len; i++)  //--this does not work
      {
          m_conn_handle = conn_handles.conn_handles[i];
          printf(&amp;quot;\r\nconnection handle length: %d&amp;quot;, conn_handles.conn_handles[i]);
          
      }

    // Assign connection handle to available instance of QWR module.
    for (uint32_t i = 0; i &amp;lt; NRF_SDH_BLE_PERIPHERAL_LINK_COUNT; i++)
    {
        if (m_qwr[i].conn_handle == BLE_CONN_HANDLE_INVALID)
        {
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr[i], p_gap_evt-&amp;gt;conn_handle);
            APP_ERROR_CHECK(err_code);
            break;
        }
    }

    err_code = app_button_enable();
    APP_ERROR_CHECK(err_code);

    // Update LEDs
    bsp_board_led_on(CONNECTED_LED);
    if (periph_link_cnt == NRF_SDH_BLE_PERIPHERAL_LINK_COUNT)
    {
        bsp_board_led_off(ADVERTISING_LED);
    }
    else
    {
        // Continue advertising. More connections can be established because the maximum link count has not been reached.
        advertising_start();
    }
    app_timer_start(tx_timer, NOTIFICATION_INTERVAL, NULL);
    
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Above given is my on_connected function where I start my apptimer. Then I stop it in on_disconnected function, when peripheral link count is 0.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void send_message(void * p_context)
{
    uint32_t       err_code = 0;
    ble_evt_t const * p_ble_evt;
    uint8_t data_array[15] = {&amp;#39;A&amp;#39;, &amp;#39;B&amp;#39;, &amp;#39;C&amp;#39;, &amp;#39;D&amp;#39;, &amp;#39;E&amp;#39;, &amp;#39;F&amp;#39;, &amp;#39;G&amp;#39;, &amp;#39;H&amp;#39;, &amp;#39;I&amp;#39;, &amp;#39;J&amp;#39;, &amp;#39;K&amp;#39;, &amp;#39;L&amp;#39;, &amp;#39;M&amp;#39;, &amp;#39;\r&amp;#39;};
    uint16_t length = 8;
    NRF_LOG_DEBUG(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
    NRF_LOG_HEXDUMP_DEBUG(data_array, length);
    uint32_t connection_handle_len = 0;
    connection_handle_len = ble_conn_state_conn_count(); //conn_handles.len;
    printf(&amp;quot;\r\n connection handle length: %d&amp;quot;, connection_handle_len);
    if(transmission_complete == 0)
    {
	err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, 0);
	printf(&amp;quot;\r\n Entering here only once&amp;quot;);
    }
    

    if (connection_handle_len) 
    {
	do 
	{
	    for(uint32_t i = 0; i &amp;lt; connection_handle_len; i++)
	    {
		
                
		        err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, i);
		
                printf(&amp;quot;\r\n i: %d&amp;quot;, i);	
                printf(&amp;quot;\r\nerror code: %d&amp;quot;, err_code);	
	    }
	    
	    if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_NOT_FOUND))
	    {
		APP_ERROR_CHECK(err_code);
	    }

	} while (err_code == NRF_ERROR_RESOURCES);

	if(err_code == NRF_SUCCESS)
	{
	  printf(&amp;quot;\r\n message sent\r\n&amp;quot;);
	  bsp_board_led_invert(BSP_BOARD_LED_3);
	}
    }
}
//-----send message------//
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above given is my send message code. When I am connecting more than 2 device to the peripheral I am getting the following error.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;error code: 12290&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.
&amp;lt;info&amp;gt; app: Connection with link 0x6 established.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x55.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x6 requested an ATT MTU of 247 bytes.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating ATT MTU to 23 bytes (desired: 23) on connection 0x6.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x23.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x6 requested a data length of 251 bytes.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating data length to 27 on connection 0x6.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x24.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Data length updated to 27 on connection 0x6.
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_time: 2120
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_time: 2120
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection with link 0x7 established.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x55.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x7 requested an ATT MTU of 247 bytes.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating ATT MTU to 23 bytes (desired: 23) on connection 0x7.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection with link 0x8 established.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x55.
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x8 requested an ATT MTU of 247 bytes.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating ATT MTU to 23 bytes (desired: 23) on connection 0x8.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x23.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x7 requested a data length of 251 bytes.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating data length to 27 on connection 0x7.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x23.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x8 requested a data length of 251 bytes.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating data length to 27 on connection 0x8.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x24.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Data length updated to 27 on connection 0x8.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_time: 2120
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_time: 2120
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x24.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: Data length updated to 27 on connection 0x7.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_octets: 27
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_time: 2120
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_time: 2120
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x2 has been disconnected. Reason: 0x8
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x0 has been disconnected. Reason: 0x8
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x1 has been disconnected. Reason: 0x8
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.
&#x1B;[1;31mLogs dropped (1)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (5)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (5)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x3 has been disconnected. Reason: 0x8
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x4 has been disconnected. Reason: 0x8
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x11.
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;info&amp;gt; app: Connection 0x5 has been disconnected. Reason: 0x8
&#x1B;[1;31mLogs dropped (2)&#x1B;[0m
&amp;lt;debug&amp;gt; app: Ready to send data over BLE NUS
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  41 42 43 44 45 46 47 48|ABCDEFGH
&#x1B;[1;31mLogs dropped (4)&#x1B;[0m
&amp;lt;debug&amp;gt; app:  49 4A 4B 4C 4D 0D 00   |IJKLM.. 
&amp;lt;error&amp;gt; app: Fatal error
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is this error coming because the buffer is full at the time? Is it like I can not send 15 bytes of data to 3 centrals at a time. I tried like the way you mentioned. Using BLE_GATTS_EVT_HVN_TX_COMPLETE. I set one flag when this event comes. And I will check that flag and will send message when it is high. In that scenario I get NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//-----send message------//

static void send_message(void * p_context)
{
    uint32_t       err_code = 0;
    ble_evt_t const * p_ble_evt;

    uint8_t data_array[15] = {&amp;#39;A&amp;#39;, &amp;#39;B&amp;#39;, &amp;#39;C&amp;#39;, &amp;#39;D&amp;#39;, &amp;#39;E&amp;#39;, &amp;#39;F&amp;#39;, &amp;#39;G&amp;#39;, &amp;#39;H&amp;#39;, &amp;#39;I&amp;#39;, &amp;#39;J&amp;#39;, &amp;#39;K&amp;#39;, &amp;#39;L&amp;#39;, &amp;#39;M&amp;#39;, &amp;#39;\r&amp;#39;};
    uint16_t length = 15;
    NRF_LOG_DEBUG(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
    NRF_LOG_HEXDUMP_DEBUG(data_array, length);
    uint32_t connection_handle_len = 0;
    connection_handle_len = ble_conn_state_conn_count(); //conn_handles.len;
    printf(&amp;quot;\r\n connection handle length: %d&amp;quot;, connection_handle_len);
    if(transmission_complete == 0)
    {
	err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, 0);
	printf(&amp;quot;\r\n Entering here only once&amp;quot;);
    }
    

    if (connection_handle_len) 
    {
	do 
	{
	    for(uint32_t i = 0; i &amp;lt; connection_handle_len; i++)
	    {
		
                if(transmission_complete == 1)
		{
		    err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, i);
                    printf(&amp;quot;\r\n Entering here all the time&amp;quot;);
		    transmission_complete = 0;

		}
		
                printf(&amp;quot;\r\n i: %d&amp;quot;, i);	
                printf(&amp;quot;\r\nerror code: %d&amp;quot;, err_code);	
	    }
	    
	    if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_NOT_FOUND))
	    {
		APP_ERROR_CHECK(err_code);
	    }

	} while (err_code == NRF_ERROR_RESOURCES);

	if(err_code == NRF_SUCCESS)
	{
	  printf(&amp;quot;\r\n message sent\r\n&amp;quot;);
	  bsp_board_led_invert(BSP_BOARD_LED_3);
	}
    }
}
//-----send message------//
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Should I increase NRF_SDH_BLE_GAP_EVENT_LENGTH or&amp;nbsp; NRF_SDH_BLE_GATT_MAX_MTU_SIZE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/169529?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 13:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:844ec4e4-40ef-43db-977c-9f5ddbd43655</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If all ble_nus_data_send() returns NRF_SUCCESS, then you should be fine, and you don&amp;#39;t need to worry about the BLE_GATTS_EVT_HVN_TX_COMPLETE events.&lt;/p&gt;
&lt;p&gt;BUT: You should check your err_code from ble_nus_data_send. If it returns NRF_ERROR_RESOURCES, it is correct that you shouldn&amp;#39;t pass it to APP_ERROR_CHECK(err_code), but you still have to check it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Your implementation will work, but it has some faulty behavior.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let us say that you have space for 2 messages in your queue, and you are connected to 3 devices. The first two will return NRF_SUCCESS, while the last will return NRF_ERROR_RESOURCES. Now, err_code == NRF_ERROR_RESOURCES, and it will continue with conn_handle = 0 (the first), and try again. So you will restart the for-loop if and only if the last connected device returns NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You should remove the do-while loop. Instead, you should store the last successful transmission&amp;#39;s conn_handle, and resume transmitting to the next conn_handle when you receive the TX_COMPLETE event:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;volatile uint8_t m_last_successful_conn_handle = 0;


ble_evt_handler()
{
    ...
        case BLE_GATTS_EVT_HVN_TX_COMPLETE:
        send_message()
        break;
}

void send_message()
{
    for (uint8_t i=m_last_successful_conn_handle; i&amp;lt;conn_handles.len; i++)
    {
        err_code = ble_nus_data_send(...)
        if(err_code == NRF_SUCCESS)
        {
            m_last_successful_conn_handle++;
        }
        else if (err_code == NRF_ERROR_RESOURCES)
        {
            // Queue is full. Break the loop, and countinue with the m_last_successful_conn_handle after TX_COMPLETE
            break;
        }
    }
    if (m_last_successful_conn_hanlde == conn_hanldes.len)
    {
        m_last_successful_conn_handle = 0;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Something like this (pseudo code)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/168973?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 06:14:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aced001a-3afa-40e0-9cd7-45b66cb530f7</guid><dc:creator>Arya</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I went through most of those Devzone tickets. I want to send data to many central devices from a single peripheral. So I am bit confused about connection handles too.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void send_message(void * p_context)
{
    ble_conn_state_conn_handle_list_t conn_handles = ble_conn_state_periph_handles();
    
    uint32_t       err_code;
    uint8_t data_array[2] = {&amp;#39;A&amp;#39;, &amp;#39;\r&amp;#39;};
    uint16_t length = 1;
    NRF_LOG_DEBUG(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
    NRF_LOG_HEXDUMP_DEBUG(data_array, length);

    do
    {
        
        for (uint8_t i = 0; i &amp;lt; conn_handles.len; i++)  //--this does not work
        {
            m_conn_handle = conn_handles.conn_handles[i];
            printf(&amp;quot;\r\nconnection handle length: %d&amp;quot;, conn_handles.conn_handles[i]);
            err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);
        }
        //err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle); //-- This works
        printf(&amp;quot;\r\nerror code: %d&amp;quot;, err_code);
        if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
            (err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
            (err_code != NRF_ERROR_NOT_FOUND))
        {
            APP_ERROR_CHECK(err_code);
        }
    } while (err_code == NRF_ERROR_RESOURCES);
    if(err_code == NRF_SUCCESS)
    {
      printf(&amp;quot;\r\n message sent\r\n&amp;quot;);
      bsp_board_led_invert(BSP_BOARD_LED_3);
    }

}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In the above function I am sending data to my centrals. Just one character, but I have to send it to all my peripherals. Currently I can send it to last connected central. How can I assign handle to each central and transfer parallely.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am trying to send messages based on this macro BLE_GATTS_EVT_HVN_TX_COMPLETE.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using ble_nus_data_send() in multiple peripherals example</title><link>https://devzone.nordicsemi.com/thread/168851?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 11:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d41ad744-c910-4a06-a944-590b089d50bf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;How many packets did you send before you get the NRF_ERROR_RESOURCES?&lt;/p&gt;
&lt;p&gt;This return means that the softdevice&amp;#39;s internal buffer is full, and you need to wait for a TX_COMPLETE event before queuing more packets with ble_nus_data_send().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There are quite a lot of DevZone tickets regarding this issue. Please check out e.g. &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/42718/nordic-device-hangs-randomly/166793#166793"&gt;this one&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>