<?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>BLE Long write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6489/ble-long-write</link><description>My Setup:
Nordic is the Server, Android is the client. 
 I have read many, many forum posts about doing long reads/writes. Virtually everyone says you cannot do long writes. Instead you have to do a sequence of 20 byte writes. 
 devzone.nordicsemi</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Jul 2015 12:30:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6489/ble-long-write" /><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22660?ContentTypeID=1</link><pubDate>Mon, 20 Jul 2015 12:30:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb628055-61e9-406c-9314-838bdf448137</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Some chart: &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s110.api.v8.0.0%2Fgroup___b_l_e___g_a_t_t_s___q_u_e_u_e_d___w_r_i_t_e___b_u_f___n_o_a_u_t_h___m_s_c.html&amp;amp;cp=2_7_0_0_0_2_3_0_6"&gt;infocenter.nordicsemi.com/index.jsp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22659?ContentTypeID=1</link><pubDate>Mon, 20 Jul 2015 12:27:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bd4f0e7-a94a-476e-880d-f0b39d23de3a</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;In the nRF Master Control Panel you may change the write type, if a characteristic allows for WRITE_NO_RESPONSE or WRITE_REQUEST by clicking on the row with blue title &amp;quot;Write type&amp;quot;. Write request must be used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22658?ContentTypeID=1</link><pubDate>Mon, 20 Jul 2015 12:24:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:519edfa8-60c6-4344-a276-58b7d6f7c6ef</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi, let me write an answer, not a comment.
Reliable write is not the same as long write. On Android it is enough to call writeCharacteristic(...) with data longer than 20 bytes to make it work. It should work on nRF Master Control Panel. Android will take care of it automatically. The firmware must be prepared to received long write. I&amp;#39;m not sure but perhaps WRITE_RESPONSE is required for the char. I&amp;#39;m not an expert in the firmware side but it works with some apps and does not with others, so the difference must be there, I guess.
The BLE_EVT_USER_MEM_REQUEST and BLE_EVT_USER_MEM_RELEASE is what you need to handle in the firmware.
Here you&amp;#39;ll find an example: &lt;a href="https://github.com/NordicSemiconductor/ble_app_hrs---LongWrite"&gt;github.com/.../ble_app_hrs---LongWrite&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22657?ContentTypeID=1</link><pubDate>Mon, 20 Jul 2015 12:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58f3b313-3b35-4765-8b5d-ae2a240a0216</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi,
reliable write is not the same as long write. On Android it is enough to call writeCharacteristic(...) with data longer than 20 bytes to make it work. Android will take care of it automatically. The firmware must be prepared to received long write. I&amp;#39;m not sure but perhaps WRITE_RESPONSE is required for the char.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22656?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2015 23:40:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:beb4294a-6fe8-49ec-985d-5240c32f3405</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;Write commands and notifications do not require any response, and can be sent pretty fast. The S110 SoftDevice supports up to 6 packets per connection interval, but might be limited by the central if the central has less. This gives a maximum throughput of 6 packets * 20 bytes every connection interval. The minimum connection interval is 7.5ms, but this is not supported in all centrals either. iOS can be negotiated down to 11-something ms with some tricks, and Android should support 7.5ms (but have fewer packets per interval). The theoretical maximum is 128kpbs (16kB/s). See some examples here: &lt;a href="https://devzone.nordicsemi.com/question/3440/how-do-i-calculate-throughput-for-a-ble-link/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22655?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2015 14:30:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:636b130d-d1b6-4dc3-878b-31ba9f4f862a</guid><dc:creator>darren</dc:creator><description>&lt;p&gt;Ulrich,
Thank you for your response.  Help me understand what sort of max throughput I can acheive.  I saw this &lt;a href="http://stackoverflow.com/questions/23802154/bluetooth-ble-android-write-to-peripheral-with-max-throughput"&gt;page&lt;/a&gt; and thought I might be able to get to a couple of kb/s.  Is that not possible?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22654?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2015 07:53:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8044da2b-8dc4-4acf-9edb-2c3b831ed360</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;If this is for throughput purposes, I&amp;#39;m afraid long writes will not be very useful to you. You have to wait for a response to each Prepare Write Request before you can send the next one, often limiting you to 1 packet per connection interval. Your initial question was how the MCP might be doing this, and long writes is one way it might be.&lt;/p&gt;
&lt;p&gt;If you want better throughput, you can gain a tiny bit by using long MTUs (currently not supported in our SoftDevices) where the header is only included in the first PDU, giving you a few extra bytes of data for every packet thereafter. The intention of reliable writes is to queue up some data by sending it, then write all of it atomically by saying &amp;quot;Execute&amp;quot; (or cancel, discarding all the data you sent). This allows you to e.g. update a long text field without having it in a corrupted state at any point, or write to all CCCDs simultaneously.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22653?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2015 00:56:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f8a4227-1d42-46f4-b21d-bda15d529f9d</guid><dc:creator>darren</dc:creator><description>&lt;p&gt;I&amp;#39;m still working on this.
Is there some way you can post example code for this?  I can write the android side code, but I don&amp;#39;t know how to set up the nordic to allow for the prepared writes.  There is so much confusion about this on the internet I am just totally lost.  I really need to rewrite my application because the data rate without long write is just unacceptable.  It takes seconds to send tiny string messages.  Please refer me to example source code to set up my nordic to allow for writing multiple 20-byte chunks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22652?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2015 15:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bba1bfca-b3f8-4f7a-a52f-9d34d7222689</guid><dc:creator>darren</dc:creator><description>&lt;p&gt;Thank you.  I will go look into this.  This could be a great help in speeding up the data transfer.  Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22651?ContentTypeID=1</link><pubDate>Sun, 19 Apr 2015 21:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11007db0-8a88-4165-b798-5bf8a2e310e0</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;Hi Darren,&lt;/p&gt;
&lt;p&gt;There is a feature in BLE that goes by names like &amp;quot;long write&amp;quot;, &amp;quot;queued writes&amp;quot; and &amp;quot;prepared writes&amp;quot;. This feature lets you write multiple 20-byte chunks of data simultaneously, even across multiple characteristics. It works by sending multiple &amp;quot;Prepare Write Requests&amp;quot; (which have their full data echoed back in the &amp;quot;Prepare Write Response&amp;quot;) followed by a final &amp;quot;Execute Write Request&amp;quot; that includes a flag saying &amp;quot;Write now&amp;quot; or &amp;quot;Cancel&amp;quot;. I guess this is what the MCP is doing.&lt;/p&gt;
&lt;p&gt;You should have the same functionality in Android by using &lt;em&gt;beginReliableWrite()&lt;/em&gt; followed by a number of &lt;em&gt;writeCharacteristic()&lt;/em&gt; calls and finalized with &lt;em&gt;executeReliableWrite()&lt;/em&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22650?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2015 05:51:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdb9cd4c-058b-49b1-bd29-5839018b5e2b</guid><dc:creator>shibshab</dc:creator><description>&lt;p&gt;Long write (called prepared write in the softdevice documentation) is supported up to 512 bytes in the nRF51 using s110 softdevice.&lt;/p&gt;
&lt;p&gt;Note that the length of the characteristic needs to be correct for the client to perform the performed write action.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22648?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2015 21:47:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5316031b-de7e-4551-9298-26b74c0084eb</guid><dc:creator>darren</dc:creator><description>&lt;p&gt;I also had a custom service and characteristic i was communicated with.  I don&amp;#39;t know that it was a long write, but I entered 50 bytes in a row and saw them all go through.  Its possible that was the prepareReliable and writeReliable with offsetting mentioned elsewhere.   At this point i installed handshake characteristics, saying the buffer is cleared, write some more.  that way its just a FSM sending and rx&amp;#39;ing.  its less ideal, but a temporary work around.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22647?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2015 20:27:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21761982-b2c2-4440-9a9a-09fd4a8e0216</guid><dc:creator>Matthias</dc:creator><description>&lt;p&gt;I decompiled the android app and I think it does not really support long write but could be wrong. Have you seen it working?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22646?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2015 20:25:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33f1368a-52cc-4ca3-b738-af8865ca5a5e</guid><dc:creator>Matthias</dc:creator><description>&lt;p&gt;That is true. But long write is a concept where the splitting and reassembly is handled by the api.
Sorry, I converted this comment to an answer by mistake. It is a pitty there is no mobile Support for this site :(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22649?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2015 13:47:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9f9a7c9-c9e2-46bd-9a14-28eeb35490e0</guid><dc:creator>shibshab</dc:creator><description>&lt;p&gt;20 bytes is the limit of data packets in BLE 4.0 specification yes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22645?ContentTypeID=1</link><pubDate>Wed, 15 Apr 2015 18:26:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18a96fde-173d-4b43-93a3-9cb21ba40309</guid><dc:creator>Matthias</dc:creator><description>&lt;p&gt;Darren, I tried to test the MCP long write while sniffing with the PCA10000, but my custom device crashes with messages greater than 20 bytes. Could you tell me the service you have tested it with?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22644?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2015 16:52:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4de70e2-53d1-4699-81e9-541401ba2969</guid><dc:creator>darren</dc:creator><description>&lt;p&gt;To be fair, I only have access to the Android side, but i do know there is prepareReliableWrite() type methods in android: &lt;a href="http://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#beginReliableWrite%28%29"&gt;link&lt;/a&gt;.  Perhaps this is what is going on.  I will go see if I can implement something with this.&lt;/p&gt;
&lt;p&gt;Why is there not a longer write to be able to do data dumps?  Is this a design decision of BLE?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Long write</title><link>https://devzone.nordicsemi.com/thread/22643?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2015 13:44:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a75ef1d7-7de9-4799-969b-9b2db8c7901d</guid><dc:creator>shibshab</dc:creator><description>&lt;p&gt;Have you seen the link layer packets that the MCP app generates when it sends the 50 byte message?&lt;/p&gt;
&lt;p&gt;Could it be that it divides the message into smaller packets without you noticing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>