<?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 Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection</link><description>Hello 
 I am using SDK15.3 and nrf52832 development board. 
 In my setup, 
 1. I have a few peripheral nodes whose only job is to transmit some arbitrary packets ( say P), 
 2. a node that acts as both central and peripheral( say T) which reads the advertisement</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 May 2019 12:06:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection" /><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189623?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 12:06:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02450c1d-ec95-4b20-b81f-e7f4b6c4db5b</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;What do you think the &amp;#39;index&amp;#39; variable is doing there?&lt;/p&gt;
&lt;p&gt;I think you need to spend some more time understanding what the original example is doing before trying to modify it.&lt;/p&gt;
&lt;p&gt;Use your IDE&amp;#39;s browsing facility to find the declaration (not the definition) of&amp;nbsp;&lt;strong&gt;ble_nus_c_string_send&lt;/strong&gt;() - the comments there tell you what the parameters are ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189607?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94cd9c19-b0b9-44b5-b226-8344f26de6e4</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;Okay. I have declared the&amp;nbsp;data_array[BLE_NUS_MAX_DATA_LEN] in the function&amp;nbsp;&amp;nbsp;uart_event_handle(app_uart_evt_t * p_event)&lt;/p&gt;
&lt;p&gt;and i am passing it as a parameter in the function&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;ble_nus_c_string_send(&amp;amp;m_ble_nus_c, data_array, index);&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uart_event_handle(app_uart_evt_t * p_event)
{
    //added
    NRF_LOG_INFO(&amp;quot;in uart_evt_handle\r\n&amp;quot;);
    //static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
    static uint8_t data_array[BLE_NUS_MAX_DATA_LEN] = &amp;quot;1,2,3\r\n&amp;quot;;
    NRF_LOG_INFO(&amp;quot;array = %x\r\n&amp;quot;,data_array);
    static uint16_t index = 0;
    uint32_t ret_val;

    switch (p_event-&amp;gt;evt_type)
    {
        /**@snippet [Handling data from UART] */
        case APP_UART_DATA_READY:
            UNUSED_VARIABLE(app_uart_get(&amp;amp;data_array[index]));
            index++;

            if ((data_array[index - 1] == &amp;#39;\n&amp;#39;) || (index &amp;gt;= (m_ble_nus_max_data_len)))
            {
                NRF_LOG_DEBUG(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
                NRF_LOG_INFO(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
                NRF_LOG_HEXDUMP_DEBUG(data_array, index);

                do
                {
                    ret_val = ble_nus_c_string_send(&amp;amp;m_ble_nus_c, data_array, index);
                    if ( (ret_val != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (ret_val != NRF_ERROR_RESOURCES) )
                    {
                        APP_ERROR_CHECK(ret_val);
                    }
                } while (ret_val == NRF_ERROR_RESOURCES);

                index = 0;
            }
            break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, I am definitely not sure if this is the right way. Please suggest me with an alternative way to send an array between&amp;nbsp;UART central and peripheral nodes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189602?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:26:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a383ff18-2f98-4191-9ce2-062e8e3116ef</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You&amp;#39;ve still just shown the&amp;nbsp;definition of the array - you haven&amp;#39;t show how you actually &lt;em&gt;&lt;strong&gt;use&lt;/strong&gt;&lt;/em&gt; it!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189597?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:23:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f602f6b-b62a-4de3-89c9-c4ddb3a331c6</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;Sorry for that awneil. I have put up the code below. I have put the array in a string format, as the comment above the function says it will send the string if it is of max length or ends with \n&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189594?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:21:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8a4d0b9-9bb6-4493-a115-708fd90ea5ec</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief   Function for handling app_uart events.
 *
 * @details This function receives a single character from the app_uart module and appends it to
 *          a string. The string is sent over BLE when the last character received is a
 *          &amp;#39;new line&amp;#39; &amp;#39;\n&amp;#39; (hex 0x0A) or if the string reaches the maximum data length.
 */
void uart_event_handle(app_uart_evt_t * p_event)
{
    //added
    NRF_LOG_INFO(&amp;quot;in uart_evt_handle\r\n&amp;quot;);
    //static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
    static uint8_t data_array[BLE_NUS_MAX_DATA_LEN] = &amp;quot;1,2,3\r\n&amp;quot;;
    NRF_LOG_INFO(&amp;quot;array = %x\r\n&amp;quot;,data_array);
    static uint16_t index = 0;
    uint32_t ret_val;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189592?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:18:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:813a95ff-880c-40dc-b3d5-1b635c04ffb8</guid><dc:creator>awneil</dc:creator><description>[quote userid="79695" url="~/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection/189589"]So, declared the array[/quote]
&lt;p&gt;but what have you actually &lt;em&gt;done&lt;/em&gt; with that array?!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to properly post source code:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3443._5F00_Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189589?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:15:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03e6653a-6640-457c-bb8d-acd179727cf0</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;I have used this central uart example from SDK&amp;nbsp; 15.3&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1559041943046v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I understood that the function &amp;quot;ble_nus_c_string_send()&amp;quot; passes the array &amp;quot;&amp;nbsp;data_array[BLE_NUS_MAX_DATA_LEN] &amp;quot; which will be sent to the peripheral.&amp;nbsp; So, declared the array with a string &amp;quot;1,2,3\n&amp;quot; as in the pic above.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189587?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:05:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e37a22cc-1077-48e1-8d2c-82c146805a0b</guid><dc:creator>awneil</dc:creator><description>[quote userid="79695" url="~/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection/189580"]I&amp;#39;m unable to send data packets using NUS[/quote]
&lt;p&gt;So what, exactly, have you tried?&lt;/p&gt;
&lt;p&gt;What problem(s) are you stuck on?&lt;/p&gt;
[quote userid="79695" url="~/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection/189580"]Please brief me on how to go about using NUS to send and receive data packets, WITHOUT USING SERIAL interface[/quote]
&lt;p&gt;First, you need to study the examples which show you how to use it &lt;em&gt;&lt;strong&gt;with&lt;/strong&gt; &lt;/em&gt;the serial interface.&lt;/p&gt;
&lt;p&gt;Browse the code in your IDE.&lt;/p&gt;
&lt;p&gt;Use the &lt;strong&gt;debugger&lt;/strong&gt; to follow what&amp;#39;s happening.&lt;/p&gt;
&lt;p&gt;Once you have done that, you will be able to see how the data is fed into the NUS, and received from the NUS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189580?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 10:53:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a3cf046-bd4d-485b-aa06-707fda15319d</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;Thank you sir. I will go through those examples. Meanwhile,&amp;nbsp;&lt;span&gt;I&amp;#39;m unable to send data packets using NUS. I have tried many hints from the Devzone itself, but it is not helping. Please brief me on how to go about using NUS to send and receive data packets, WITHOUT USING SERIAL interface.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank You.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189578?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 10:51:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10e21c0a-5ba8-4237-bf62-ac488efa797c</guid><dc:creator>GO_D</dc:creator><description>&lt;p&gt;Thank you Anweil. I am trying to use the NUS central and peripheral example. But I&amp;#39;m unable to send data packets using NUS. I have tried many hints from the Devzone itself, but it is not helping. Please brief me on how to go about using NUS to send and receive data packets, WITHOUT USING SERIAL interface.&amp;nbsp;&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: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189570?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 10:47:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df34cd2b-fccb-42d5-a669-a097b5489892</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Typically the lates SDK is the preferred one, so currently SDKv15.3 is the latest.&lt;/p&gt;
&lt;p&gt;An example that can be used as reference may be:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_rscs_relay.html?cp=5_1_4_2_1_2"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_rscs_relay.html?cp=5_1_4_2_1_2&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Though for start it may be good to get familiar with the BLE Blinky (use buttons and LEDs as IO) or NUS (use UART as IO) example:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_nus_eval.html?cp=5_1_4_2_2_24"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_blinky.html?cp=5_1_4_2_2_3&lt;br /&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_nus_eval.html?cp=5_1_4_2_2_24&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Once you get familiar scanning in central role and exchanging data over BLE in peripheral role you should be good to go.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send Data packets of about 50 bytes from central to a peripheral device with or without establishing a connection</title><link>https://devzone.nordicsemi.com/thread/189511?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 08:53:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:890961c2-e46c-45b3-9243-5a6005b0824e</guid><dc:creator>awneil</dc:creator><description>[quote userid="79695" url="~/f/nordic-q-a/47828/send-data-packets-of-about-50-bytes-from-central-to-a-peripheral-device-with-or-without-establishing-a-connection"]which example from SDK 15.0 and higher is suitable[/quote]
&lt;p&gt;Have &lt;em&gt;you&lt;/em&gt; looked at the examples? Which one(s) sound suitable &lt;em&gt;to you&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;For arbitrary data, not using standard BT-SIG Services &amp;amp; Characteristics, and without having to define your own, look at the &lt;strong&gt;Nordic UART Service (NUS)&lt;/strong&gt; examples. (the &amp;quot;UART&amp;quot; in the name just means that it can transfer arbitrary data - like a UART does)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>