<?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>Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22687/faster-respond-for-midi-application</link><description>I am using nrf52 , it&amp;#39;s always connected to an iPhone, and I need a truly real time respond.
I am sending short messages, like 2 characters at a time, and play a sound on the phone according to the messages( e.g &amp;quot;A&amp;quot;,&amp;quot;B&amp;quot;) 
 Right now, it&amp;#39;s fast but not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 11 Jun 2017 09:49:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22687/faster-respond-for-midi-application" /><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89193?ContentTypeID=1</link><pubDate>Sun, 11 Jun 2017 09:49:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9cf298d-c1eb-4b46-b198-4e298496e2fd</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;OK, I will amend my answer to elaborate more on these &amp;quot;cheating&amp;quot; and &amp;quot;forcing&amp;quot; options;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89191?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:32:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa0bd124-8a57-4250-8df7-7eec78127611</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;Thanks, obviously i am using nrf52, so if HID is faster, I am not sure why i have to cheat, I can just use HID because according to Google it is faster for some reason (maybe because there is no direct connection? only updates of advertising data?)&lt;/p&gt;
&lt;p&gt;BTW- examples for BLE devices are simply the Apple wireless keyboard that connects to my iPad, and works flowlessly in real time, same goes for the remote track pad.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89190?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:28:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:713b2263-5d22-4484-b16e-d24e3e134121</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;There are not many ways from iOS app side, what is possible to &amp;quot;force&amp;quot; or &amp;quot;trick&amp;quot; the protocol from the other side. If you have control over the other side of the link (e.g. if it is embedded device running your FW) you can try what I&amp;#39;ve suggested: pretend to be HID device, ask for lower connection interval after iOS connects with these 30ms. If this doesn&amp;#39;t work another option is to let iOS advertise and connect from the other side. I hope these are at least three things you could try;) Good luck&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89189?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1952311-136c-482a-a98d-834cc8e13d72</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;I know there are tones of midi controllers for iPhone, so there probably is some way. Not sure I understood your explanation on how to achieve faster speed on regular BLE, but I am using the iOS API for a long time, and other then few parameters I never saw something that can be related to speed or advertising interval(only in iBeacon). I will keep reading to understand your suggestion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89188?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:13:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83a3c202-8d35-4450-b8fd-eddefdc72d72</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;That&amp;#39;s not true, you can use GAP Broadcaster/Peripheral API since certain iOS version so you can do the opposite scenario. To the MIDI: is there any &amp;quot;solution&amp;quot; working with iOS which has lower latency then 30ms? I guess you can use that trick with HID device service and piggy back on lower connection interval (to go below 15ms) or completely reverse the flow and go even to theoretical minimum of 7.5ms. It should be pretty easy to reverse engineer: purchase or borrow the device you like and sniff with nRF51 DK sniffer the protocol. You will see connection interval used, what GATT features it uses etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89187?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:082fe703-0326-4572-8cd2-df179219724d</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;iOS do not give you any access to the stack(intervals etc) , you can just be central , register to characteristic and get notified, thats it, and that&amp;#39;s what I do right now. It&amp;#39;s fast enough for remote control, but not to play music. I wonder how other BLE midi controllers works, and how midi solves that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89192?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:06:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:254f4548-3b41-4a35-9885-894471ead7e8</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;I did not understand a word from your last note :) Anyway, I think I am at the maximum, I use a regular uart example to send a single letter every time I push a button, and it&amp;#39;s not fast enough .&lt;/p&gt;
&lt;p&gt;I still wonder how midi solves that ( your link says it&amp;#39;s 2.7x more faster )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89184?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:06:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:642e2748-4a30-42aa-ac79-347c6971d363</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;I assume iOS device is GAP Central aka master so it selects connection interval. There is a method to ask for better parameters but it has limited effect (most of mobile devices follow, some ignore it and some will disconnect in reaction). You could try to reverse the flow and let iOS device to Advertise (= GAP Peripheral) while embedded device can be GAP Central. Then you should be able to go below 30ms with connection interval (I would not hope to go down to 7.5ms which is limit by BT SIG Core specification but you could achieve 15ms).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89183?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 21:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7871bd3c-55cd-4a1f-813b-2b997c57e180</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Oh my bad, I&amp;#39;d never thought you use unreliable transfer media such as Advertisement for MIDI;) Sure, you can try to use 20ms adv. interval but you will be loosing packets, iOS scanning will keep up only if screen is woken up, device unlocked and your app on the foreground (and even then I would assume at least 1% loss over some longer time). If you really just advertise then you can easily blame ~100ms delay to simply slow transport of scanning events through the system (I&amp;#39;m not the mobile dev unfortunately to provide more experience). With connection-based link you should easily achieve &amp;quot;every connection interval&amp;quot; latency so delays up to 30ms but not more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89182?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:57:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36418479-0cff-44e1-b847-6c1a5956d912</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;Wait, so is connection interval matter ? I was thinking that it&amp;#39;s about interval between advertising..&lt;/p&gt;
&lt;p&gt;My intervals are :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)             /**&amp;lt; Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89181?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:55:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a30350f6-32ff-4745-a2de-94320ba984ea</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;Thanks, I actually can&amp;#39;t see any problem in firmware/mobile. I print on the firmware when I push the button, and I see in my eyes that it prints fast enough, then it should send via ble, and I print again on mobile right when I get it, but it will print a little bit later, and if I can see in my eyes the little delay that means it&amp;#39;s much more then 30ms :)  , I wonder if that is the limit here .&lt;/p&gt;
&lt;p&gt;Regarding HID:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;So if it&amp;#39;s only about setting the right service, how do you send the relevant data on the nrf52 side ? in the exact same way via characteristic? if so, why would it be faster ?&lt;/li&gt;
&lt;li&gt;Is there anyone who implemented it using iOS? I couldn&amp;#39;t find.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89180?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:54:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:844e7bc4-a7c4-404a-87f1-31bc5f7463cc</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;(2/2) There should be more all over the internet and this forum, I&amp;#39;ve found &lt;a href="https://punchthrough.com/blog/posts/maximizing-ble-throughput-on-ios-and-android"&gt;this&lt;/a&gt; useful article among first 10 Google search hits (it&amp;#39;s focused on throughput but that is related to connection interval - or latency if you want- closely;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89186?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:49:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63a8b562-61cb-4936-9197-dd5db97aaa17</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;For the start if you are unclear what is really happening on the radio (= why you think you send data as fast as possible but they don&amp;#39;t arrive sooner then ~100ms) then get BLE trace through some sniffer. Frontline (Teledyne) or similar pricier device is better but Nordic DK with sniffer software and Wireshark will usually do the job. Then you either will see that data are going optimally over BLE and problem is somewhere in the mobile API/APP (then you are done here and need to employ some mobile dev magic) or you will see that you are wasting some time on embedded side and then back to FW and rework/debug/optimize. To the HID profile on iOS that is managed by the system so simply presence of that Service UUID on GATT Server side shod be enough. And as side effect other services on that device might be able to leverage that short connection interval... (1/2)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89185?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:36:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e11c95c-d2db-41e5-91dc-938b5982bb6b</guid><dc:creator>Lola</dc:creator><description>&lt;p&gt;Thanks a lot, well so how are all the Bluetooth LE keyboards works? they do work on HID, but they still use the same exact Bluetooth technology, so did you mean that it&amp;#39;s possible in another configuration? how is HID different in speed? it uses the exact same BLE protocols.&lt;/p&gt;
&lt;p&gt;How all these midi bluetooth controllers works anyway ? (in iOS you have access to recieve HID midi?)
btw - 30ms is great but I think I am pretty far from it right now, can&amp;#39;t figure why .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Faster respond for midi application ?</title><link>https://devzone.nordicsemi.com/thread/89179?ContentTypeID=1</link><pubDate>Sat, 10 Jun 2017 20:22:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c7944ee-281d-45e9-a30d-814d5045d3ff</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi Lola,&lt;/p&gt;
&lt;p&gt;BLE isn&amp;#39;t really suited for real-time things as it&amp;#39;s based on &amp;quot;little bit of action and lot of silence&amp;quot; principle. Anyway you should be able to achieve 30ms reactivity on iOS assuming you are sending asynchronously data from one side to another over Write or Notify GATT methods (depending if from Server or Client side). That&amp;#39;s all iOS can do today, lower intervals then 30ms are achievable only if you can be declared as HID (human Interface Device).&lt;/p&gt;
&lt;p&gt;Cheers Jan&lt;/p&gt;
&lt;h2&gt;Edit 2017-06-11&lt;/h2&gt;
&lt;p&gt;By &amp;quot;cheating&amp;quot; I mean you could expose Standard HID over GATT Primary Service on your peripheral HW so once it gets discovered by iOS device it should go to faster connection interval then 30ms. You would indeed never send any mouse or keyboard emulating data over HID Service and its Characteristics, but all your other GATT Services will indeed leverage from that short connection interval (= lower latency).&lt;/p&gt;
&lt;p&gt;Another &amp;quot;trick&amp;quot; would be to use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v4.0.2/group___b_l_e___g_a_p___c_p_u___m_s_c.html"&gt;Peripheral Connection Parameter Update&lt;/a&gt; procedure which allows you to request some range of connection interval (this assume your MIDI device is GAP Peripheral similar to Apple keyboard etc.) The central can go to lower range if it want or you could try to limit the range below 30ms so it should go down in every case. Of course this would involve some testing because different HW and SW releases can behave differently (it can also be influenced by fact if there is another BLE connection running on the Central side or not etc.) But in the end you could influence Connection Interval even you have neither access to this through API on mobile side, hence I call it &amp;quot;trick&amp;quot; (but it&amp;#39;s standard BLE procedure according to the specification so I might be too big drama queen here).&lt;/p&gt;
&lt;p&gt;The last &amp;quot;trick&amp;quot; is to reverse the GAP roles. All iOS devices since release 6 should support GAP Peripheral and GATT Server functions so if your MIDI device can be GAP Central and GATT Client (assuming it supports it - which is the case of all nRF5x devices with Nordic Stack - but also your power budget allows it because it will most probably need slightly more energy even it should be almost equal to operate GAP Peripheral or Central role during continuous connection) you could use any Connection Interval down to theoretical minimum of 7.5ms. According to BT SIG spec GAP Peripheral should accept all values however implementations might differ so iOS device can either try to change it (through that Peripheral Connection Parameter Update procedure) or simply terminate the connection (which is valid way how to &amp;quot;politely&amp;quot; refuse such connection interval and still be compliant with the spec;) Anyway again in the end after some experiments you might find configuration which will be better then standard 30ms of latency.&lt;/p&gt;
&lt;p&gt;If you are satisfied with latency of some BLE peripheral such as keyboard and you think your custom device is performing worse then simply load sniffer FW to your nRF5x board (nRF51 DK and Dongle are officially supported but there is unofficial FW for nRF52 DK as well), install Wireshark and record traces of both communication samples (from advertising/scanning phase through connection up to normal operation when commands/data flow over the link) and compare what is different. Note that if devices are using static GATT Server stack or they use Pairing with Bonding you might need to unpair and/or wipe network settings/cache of the device to see full communication flow including GATT Service Discovery (which might be important because you want to see what GATT Services and Characteristics are there).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>