<?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>Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17715/receiving-large-amount-of-data-in-android-via-ble</link><description>Hello everyone, recently i was trying to figure out the best way how to send a large amount of data from ble peripheral to the central (Android device in this case) and thanks to great posts here i found the answer. Now im also doing the part for the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 May 2020 04:02:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17715/receiving-large-amount-of-data-in-android-via-ble" /><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/248841?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 04:02:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9448c69-9412-4783-9aa3-bda6c282d656</guid><dc:creator>ljg</dc:creator><description>&lt;p&gt;Did you happen to get a answer to this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68189?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 13:11:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24d37db7-9ec9-43eb-bc35-d68ec0008a75</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I&amp;#39;m glad that it&amp;#39;s clear now. Good luck with your project. I think we can keep the case like this, converting a comment to answer may make it hard to follow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68191?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 11:22:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f37ef3f-655b-4d3f-9e13-2447a08074c9</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Thank you Hung Bui for your help. I didn&amp;#39;t even know actually that there is such a good tool to sniff out BLE protocol :) Everything is clear now. I know now everything and even even more than i wanted to know when asked this question initially. I would convert one of your comments to an answer and would mark it as answered, but i am not allowed to do this under this answer. Maybe you can do it? If yes, please do it.Thank you for your help once again :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68190?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 10:00:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55b51f40-2b75-4ccd-9519-baf85f63f954</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;If you are using Wireshark v1.10 you can click on &amp;quot;Nordic BLE sniffer meta&amp;quot; then right click on channel and select Apply as Column. Then you can see the channel of each packet. When in connection, one connection event will use one channel and switch in the next connection event.
You can also add delta time to see the time difference between packets. Packets that are in the same connection event have short delta times, few hundreds us.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68188?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 15:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36903e95-90be-4311-bb45-ea2a0b6961d5</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Well then clearly i am reading my wireshark log wrong.How can i actually do that as you said: &amp;quot;Check the number of packets on same channel&amp;quot;? Is this some kind of filter? I just simply watched at timing that packets were received and did the math. Which, again, clearly was wrong.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68187?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 15:14:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:764ee9ae-5567-4d40-8c34-dba000da3dc0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Artucas,&lt;/p&gt;
&lt;p&gt;How did you find your number of packets per connection event from the log ?&lt;/p&gt;
&lt;p&gt;What I can see in your log, is that with max40min75 you got 37,5ms as the actual connection interval, and you have 6 packets per connection event (check the number of packets on same channel) and with max75min75 you have 7.5ms as actual connection interval and you have 3 packets per connection event.&lt;/p&gt;
&lt;p&gt;So actually you have higher through put with the 7.5ms min=max setting. Note that if the central has more than 1 connection, setting your connection at 7.5ms may affect other connection as the radio is occupied quite a lot.&lt;/p&gt;
&lt;p&gt;Some central will reject your request of 7.5ms min=max. In that case, the best way is to automatically increase the max value (say +5ms) and try again until you reach the value that the central accept.
The connection won&amp;#39;t be drop if the central reject the request, unless the peripheral does it itself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68186?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 14:21:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d70d2f1-eb02-4139-867f-04e82a94d829</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;I edited my initial question with the tests that i did because i could not upload photos in the comment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68182?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 11:40:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a5f8c06-8773-4adf-9770-fa6698458381</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Okey, thank you for your comments Elliot Stock and Hung Bui, i will come back here again with a feedback as soon as i test it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68185?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 11:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c12f8c4b-579c-42fd-aeec-53c9087169ac</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;It&amp;#39;s various from central to central, some central prefer a connection interval. Some central won&amp;#39;t accept your request of both max and min interval to 7.5ms. It may reject the connection parameter request. Note that you need to send the connection parameter request, otherwise the central won&amp;#39;t know ab what you want (yes you have the preferred parameters but as far as I know, not many centrals really read and use it).&lt;/p&gt;
&lt;p&gt;As Eliot all ready suggested, you can try to use a sniffer and have a look. It&amp;#39;s important that you can get more notification in one connection event. It can be 6 or even more if you use longer connection interval and with certain central. Many central only support 4 packets per connection event. Make sure you call the _hvx() command as much as possible till the buffer is full, and call again when you have TX_COMPLETED event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68184?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 11:12:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5413248-3756-424c-a934-79f162b8ff4c</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;OK, what I&amp;#39;d do next is find out what connection interval is actually being used. You can do this by setting a breakpoint or adding logging in on_ble_evt() when it gets the BLE_GAP_EVT_CONN_PARAM_UPDATE event. Or just set up Wireshark with the Nordic dongle and sit the dongle in the middle between peripheral and central and have a look at the packets. I think maybe the central ends up dictating this, but it&amp;#39;s been a while since I looked at it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68183?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 10:57:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d72fb9e1-5ff8-4c2f-b605-a69ad1760c3c</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Well i have done some test on my android device and i have a question know, i won&amp;#39;t make another post because i think these two are related questions actually. If for the peripheral devices i set &lt;code&gt;MIN_CONN_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS)&lt;/code&gt; and &lt;code&gt;MAX_CONN_INTERVAL MSEC_TO_UNITS(40, UNIT_1_25_MS)&lt;/code&gt; , the speed i get with my android device (Samsung galaxy J5) is about 3.2 kB/s . If i set both &lt;code&gt;MIN_CONN_INTERVAL and MAX_CONN_INTERVAL to MSEC_TO_UNITS(7.5, UNIT_1_25_MS)&lt;/code&gt; then the speed i get with the same device is 8kB/s. It is actually still two times less than the maximum of 16kB, if my device supports 6 packets per connection event, correct? So does this actually mean, that my device supports maximum 3 packets per connection event? And another question, how does master actually choose the connection parameters, i mean, why when i set &lt;code&gt;MIN_CONN_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS)&lt;/code&gt; and &lt;code&gt;MAX_CONN_INTERVAL MSEC_TO_UNITS(40, UNIT_1_25_MS)&lt;/code&gt; i get smaller throughput than then if i set both to &lt;code&gt;MSEC_TO_UNITS(7.5, UNIT_1_25_MS)&lt;/code&gt;? I mean i am forcing this way the central to use 7.5ms connection interval, right? But is this appropriate? I mean, definately not every device can support 7.5ms connection interval, so i&amp;#39;d like some clarification on this, what i am doing wrong here, or it is just that i reached my device physical limitations and how does central decide what connection parameters to choose?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68181?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 14:44:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78ffa13e-6d68-4f2a-bd1e-6515991944a8</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Yeah i know it is not the same, but i am looking at that example and trying to reverse it and to reading instead of writing :) Thank you for your comment Hung Bui. I&amp;#39;ll mark this as answered as soon as i achieve this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68180?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 12:39:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10847358-2c64-40cb-a267-4824b0911a9d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Actually it&amp;#39;s not the same. On our DFU library, we sending data from Android side (central side), using write command. What Artucas asked for actually the opposite way, sending data from nRF5 to Android.&lt;/p&gt;
&lt;p&gt;But I don&amp;#39;t see any problem there. The data rate from BLE is pretty slow, around 128kbps max. You should have no problem store them in a buffer and update to a file concurrently.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68179?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2016 10:18:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a0fb81b-c76a-4d85-b1f9-3c0a43f94f6b</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;Thank you for the answer Eliot. I took a quick look and maybe it was what i was looking for. I am voting up your question for now, will mark this as an answer in a few days if i won&amp;#39;t find anything better :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68177?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2016 10:16:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce11d6ed-bb85-411c-b666-413ef083d802</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;I understand this awneil. What i actually wanted to know is how to write that data properly to a file. Should i i read all the data and store it in some sort of buffer and write it to a file with a single command, or write to the file by chunks of every 20 bytes, because i imagine that writing to a file takes a while, and my peripheral will be sending a large to stream, so i was wondering if android will have enough time to do all this and not to miss received packets? Thank you for your comments.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68178?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2016 08:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaa13dac-e8bb-49ad-9950-56328ef447c0</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;I&amp;#39;d start with Nordic&amp;#39;s DFU library for Android:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nordicSemiconductor/Android-DFU-Library"&gt;github.com/.../Android-DFU-Library&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Find the classes in there that send the application/sd/bootloader image over the air from central to peripheral. You have the reverse situation: you&amp;#39;ll be reading from a characteristic repeatedly, not writing, but perhaps you can turn their code around a bit.&lt;/p&gt;
&lt;p&gt;100 kB / 20 bytes per characteristic read = 5,120 reads. It&amp;#39;ll take a while.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68176?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2016 22:35:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad45879c-7467-4b94-b958-c951108335eb</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;BLE packets are only 20 bytes; it shouldn&amp;#39;t be a problem to write 20 bytes at a time to a file.&lt;/p&gt;
&lt;p&gt;Again, this has nothing specifically to do with Nordic or Bluetooth - a file neither knows nor cares where the data came from!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68175?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2016 20:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a43c017-e76e-4faf-9385-83076108f1c3</guid><dc:creator>Artucas</dc:creator><description>&lt;p&gt;I just want to save received data to the file, and as i said, it would be about a 100kB of data. It is just that i am still learning the android and simply i just don&amp;#39;t know what is the correct way in android to receive such amount of data and how to deal with it. (What i have done is that i created a characteristic on my peripheral device with notification property. then from android device i write a descriptor value to enable notifications and trigger data send start by writing to the characteristic. From that point my peripheral just goes to the loop and uses &lt;code&gt;sd_ble_gatts_hvx();&lt;/code&gt; to send out the data. When my android device receives the data, &lt;code&gt;onCharacteristicChanged();&lt;/code&gt; method is called and i can see a received data. But since i am not really an android developer, i don&amp;#39;t know how exactly to handle that data(should i create a big buffer and store data there, or write everything to the file instantly if that is possible or whatever). I intended to basically ask: What is the best way to receive about 100kB of data with an android device and save it to a file, but i cann&amp;#39;t find any examples from Nordic how to do something like that. Hope i make it clear now :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving large amount of data in android via BLE</title><link>https://devzone.nordicsemi.com/thread/68174?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2016 20:05:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbe88588-9dc5-450d-813f-0c7bdf712692</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;What is your actual  problem here?&lt;/p&gt;
&lt;p&gt;BLE is neither particularly high-speed nor high-volume;  certainly not relative to other interfaces common to Android (eg, WiFi) - so there shouldn&amp;#39;t be any issues specific to BLE here.&lt;/p&gt;
&lt;p&gt;What are you intending to do with the data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>