<?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>Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7990/best-way-to-send-larger-chunks-of-data-through-ble-uart</link><description>Right now i have based myself on the BLE UART example where it is UART over BLE. 
 So naturally I use ble_nus_string_send to send data. After some digging I saw that this takes max 20 bytes of data. Also there seems to be a fixed queue size, so anything</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Oct 2016 05:55:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7990/best-way-to-send-larger-chunks-of-data-through-ble-uart" /><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28622?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2016 05:55:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c23ed3f-19f7-4b2b-8802-3d54472982a0</guid><dc:creator>Anjali</dc:creator><description>&lt;p&gt;Hi, I am stuck with the same problem, can you suggest how do you enqueue packets in the tx buffer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28620?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 09:55:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75eaa147-3567-434e-8ee7-0956cd21f761</guid><dc:creator>djqtsg</dc:creator><description>&lt;p&gt;Hoan Hoang,&lt;/p&gt;
&lt;p&gt;Sending is limited to 20 bytes. If you look at the implementation of ble_nus_string_send() in ble_nus.c (nRF5_SDK_11.0.0_89a8197), if the length is &amp;gt;20, it returns error.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{
ble_gatts_hvx_params_t hvx_params;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;VERIFY_PARAM_NOT_NULL(p_nus);

if ((p_nus-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_nus-&amp;gt;is_notification_enabled))
{
    return NRF_ERROR_INVALID_STATE;
}

if (length &amp;gt; BLE_NUS_MAX_DATA_LEN)
{
    return NRF_ERROR_INVALID_PARAM;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28632?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 11:39:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c8c6e7c-216b-4968-adee-aee2fc0d951f</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;No, it&amp;#39;s software fifo.  It is the app_uart + app_fifo of the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28619?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 11:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de1a2770-b550-4f4e-9248-35f4fd5a1c8b</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks. It looks like I don&amp;#39;t use that at all. Isn&amp;#39;t this related to the physical UART only?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28631?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 11:04:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c22d9b1b-1f2e-4773-b3c8-7116bf066534</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;It is the 2nd and 3rd parameter when you call APP_UART_FIFO_INIT.  The values must be to the power of 2. i.e. 2, 4, 8, 16, 32, ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28627?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2015 10:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15e14cc3-8a9b-4bd6-a33b-df2af26005a8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Emil: No, the UART example is actually the basic example for this. Note that the 20 byte limit is the maximum payload size for the BLE att packet. You can declare your characteristics with longer size but when notifying only first 20 bytes is notified. You would need to use long write or long read to transfer long characteristics. And on air it&amp;#39;s also splited in to 20 bytes trunks.&lt;/p&gt;
&lt;p&gt;There is also a good application note that you can follow is the &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51822/nAN-36/24020"&gt;nAN36&lt;/a&gt;. However, it&amp;#39;s a little bit outdated since it&amp;#39;s was written about 1.5 year ago.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28629?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2015 09:21:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:932b63d4-98af-4eeb-902a-599722ec4e68</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thank you so much! Is there an example on setting up a basic, notifyable characteristic with a send? I guess the UART is a custom implementation based on this (Since you can only send 20 bytes). I suppose &amp;quot;long reads&amp;quot; are something the receiving end has to poll?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28628?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2015 09:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0503bbd5-58d5-4c6c-b412-4f224e581951</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Emil: NUS service is simply a proprietary that we created to show how you can have your own proprietary services and characteristics. You can modify it as you wish.
sd_ble_gatts_hvx() requires a notifiable characteristic. You can use other characteristic not the UART one, but still need a notifiable characteristic/attribute.
If you plan to have access to lower layer with no attribute, you would need to use the L2CAP api provided by the softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28626?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 14:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b222234e-20b9-4d02-a5b6-0d56ca49343f</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks! By &amp;quot;Pure GATT server&amp;quot; I mean to send bluetooth data without the usage of the BLE UART service. Just a pure sd_ble_gatts_hvx send. Is there such an example anywhere? Like, send a data packet, and define it&amp;#39;s size instead of UART. ble_nus_string_send uses that function internally, I guess I can still use this? Or not? It seems to be UART specific (ble_nus.c).&lt;/p&gt;
&lt;p&gt;Also, I need to change the UART example to display itself as a non-uart service.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28625?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 14:18:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dd52f37-62f8-400a-8f44-adc9e2c68fda</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Emil: You can just keep calling sd_ble_gatts_hvx()  until you receive BLE_ERROR_NO_TX_BUFFERS error code back then it&amp;#39;s when the buffer is full.&lt;/p&gt;
&lt;p&gt;What do you mean by &amp;quot;pure GATT server&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28624?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 13:21:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4393063b-a312-407a-ad45-275509b890a7</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Thanks! How do I know when the queue buffer is full before sending? And is it hard to change the BLE UART to a pure GATT server?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28630?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 13:19:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3b88582-0f9c-4ff3-ad03-a4ae240f2bdc</guid><dc:creator>Emil</dc:creator><description>&lt;p&gt;Cool! How is the buffer adjusted?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28623?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2015 13:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:570da9ba-ae54-4b6b-b644-aa566291459a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Emil: You can do what you are doing, try to queue the notification packets as long as the buffer is not full, and try again after you receive BLE_EVT_TX_COMPLETE event (meaning there are packet sent in the last connection event).&lt;/p&gt;
&lt;p&gt;Or you can declare your characteristics with bigger size than 20byte (max 510 bytes) and let the central to use long read to retreive the value. I don&amp;#39;t think notification is supported to send long characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28618?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2015 14:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30c868d0-f9b6-493e-b59d-f56c1a9bd675</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;You can initialize the FIFO with bigger buffer.  Sending is not limited to 20 bytes.  The softdevice takes care breaking it down.  On the other, on iOS, I get full packet.  Don&amp;#39;t know about Android though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send larger chunks of data through BLE UART?</title><link>https://devzone.nordicsemi.com/thread/28621?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2015 10:25:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81cbffc0-b532-4e59-90c8-1d5b37086086</guid><dc:creator>Victor Nascimento</dc:creator><description>&lt;p&gt;On my application, I organize my data in a way that it has a structured way in each 20 bytes chunk. Then, I have a state machine, which just en-queue packets until the buffer is full. After that it just keeps retrying until all my data is sent.&lt;/p&gt;
&lt;p&gt;Is something like this:&lt;/p&gt;
&lt;p&gt;-&amp;gt; Init (send a &amp;quot;data init&amp;quot; packet)&lt;br /&gt;
-&amp;gt; Data loop (keep sending data until the end)&lt;br /&gt;
-&amp;gt; End (send a &amp;quot;data end&amp;quot; packet)&lt;/p&gt;
&lt;p&gt;On the receiving side, I receive everything in order, and just have to reorganize it and parse.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>