Bluetooth LE MIDI connection interval

302 views
Skip to first unread message

Allen Heidorn

unread,
Nov 24, 2015, 5:36:27 PM11/24/15
to android-midi
Hi Phil,

We are progressing on getting our Bluetooth MIDI app for the jamstik+ ready to go and are running into an issue with which I'm hoping you could help us out.

Apple BTLE MIDI protocol recommends a connection interval of 15ms or less, and our jamstik+ does request this upon connection, however we are seeing a connection interval of 48.75ms from our Nexus 9 (running Android 6.0).
Is there a way, or some code, that could award the requested connection interval?

I'm looking at BlueToothDevice and BluetoothGatt, but I think the BluetoothMidiDevice handles the actual connection with the openBluetoothMidi call. If you could point us into the right direction, that would be appreciated.

Also, I'm seeing that the BlueToothDevice.getName() call, which is set as the PROPERTY_NAME in the Properties bundle when the BluetoothMidiDevice is created, is typically NULL. I do cache the BT advertisement name (and address) and am using that name, but was wondering if this is a bug.
If not, is there a way I can set the name of a BluetoothMidiDevice - or is this a read-only property? 
After connecting, iOS queries the Device Info service and sets the Name, Manufacturer and Model properties to make them available in CoreMIDI.
I'm hoping to try do the same on Android and am wondering if you have any suggestions, pointers, or code to help with this.

Thanks,
Allen Heidorn

Phil Burk

unread,
Nov 24, 2015, 8:12:36 PM11/24/15
to android-midi
On Tuesday, November 24, 2015 at 2:36:27 PM UTC-8, Allen Heidorn wrote:
Apple BTLE MIDI protocol recommends a connection interval of 15ms or less, and our jamstik+ does request this upon connection, however we are seeing a connection interval of 48.75ms from our Nexus 9 (running Android 6.0).

Are you measuring this with a BTLE sniffer, or are you getting it using ADB?
 
Is there a way, or some code, that could award the requested connection interval?

The peripheral can ask for a connection interval range. But the final connection interval is decided by the Android host. I know that some devices are capable of 7.5 msec. I will try to find out why the Nexus 9 is so high.

Try turning off the WiFi and reconnecting to see if that makes a difference.

If not, is there a way I can set the name of a BluetoothMidiDevice - or is this a read-only property?

I will get back to you on that.

Phil Burk
 
 

Allen Heidorn

unread,
Nov 25, 2015, 12:05:24 PM11/25/15
to android-midi

Apple BTLE MIDI protocol recommends a connection interval of 15ms or less, and our jamstik+ does request this upon connection, however we are seeing a connection interval of 48.75ms from our Nexus 9 (running Android 6.0).

Are you measuring this with a BTLE sniffer, or are you getting it using ADB?
We are using a hardware debugger right on our peripheral.
  
Is there a way, or some code, that could award the requested connection interval?

The peripheral can ask for a connection interval range. But the final connection interval is decided by the Android host. I know that some devices are capable of 7.5 msec. I will try to find out why the Nexus 9 is so high.

Try turning off the WiFi and reconnecting to see if that makes a difference.
We turned off Wifi on the Android device, but it made no difference. However, we did find this - which is a solution for us, but might be useful information for you:

When we request connection parameters on the BLE device, the function takes the parameters of: minInterval (x 1.25ms), maxInterval (x 1.25ms),
Previously we requested 6,6 as these are the minimum values allowed. iOS couldn't achieve that, but would give its best of 9. It appears that the Nexus 9 couldn't achieve that as well, but awarded 39 (48.75ms)
So, we played with those parameters. Here's what we got:
request 6,6 awarded 39
request 6,16 awarded 15
request 6,12 awarded 12
request 6,9 awarded 9    -  9 is 11.25ms, so we're good
 
What is curious is that requests 6,16 and 6,12 did not yield a 9. We would think that we would be awarded the lowest interval within the range, not the highest.
 
If not, is there a way I can set the name of a BluetoothMidiDevice - or is this a read-only property?

I will get back to you on that.

Thanks! 

Allen

Phil Burk

unread,
Nov 25, 2015, 1:54:32 PM11/25/15
to android-midi
Hello Allen,

This is really helpful information. I have read that if the negotiation fails then one should keep trying with different min and max values. So that strategy seems to work.

I think Android is responding with the high value because it is emphasizing the LE in BTLE. A higher connection interval will consume Lower Energy.

I recommend setting the slave latency fairly high when using such a low connection interval. Otherwise you will use up the battery in the peripheral.
Also set the supervision timeout so that you do not disconnect too often.

I think these are good BTLE connection ranges:
connection interval: 7.5 - 20 msec
slave latency:  80 - 120 msec
supervision timeout:  500 - 1000 msec

What connection settings do you find work well?

Phil Burk

Allen Heidorn

unread,
Dec 6, 2015, 8:52:27 PM12/6/15
to android-midi
What connection settings do you find work well?

We've been experimenting with various settings, but am coming up with inconsistent responses. We are still looking into this to see if there is some sort of pattern and will get back to you with some ranges that seem to work overall.

-Allen 

stdo...@colorado.edu

unread,
Aug 26, 2017, 5:24:37 PM8/26/17
to android-midi
Hi Allen,

Were you able to figure out connection interval parameters that aren't rejected by iOS over Bluetooth MIDI? Every combination I send gets rejected - I'm not sure what I'm doing wrong. 

Thanks,
Steven

Bobcat Cox

unread,
Aug 28, 2017, 12:20:18 PM8/28/17
to android-midi
We're having success with this configuration, connecting to both iOS and Android:

minimum connection interval: 7.5 ms
maximum connection interval: 11.25 ms
slave latency: 0 ms  
supervision timeout:  500 msec

This is on a CYW20737s chip with a call to the blecm_ConnectionUpdate() library function.

Bobcat

Phil Burk

unread,
Aug 28, 2017, 4:29:58 PM8/28/17
to android-midi
You might be able to save some battery power on the peripheral if you increase your slave latency.
Then the peripheral can sometimes not respond when there is no data to transmit.

Phil Burk


--
You received this message because you are subscribed to the Google Groups "android-midi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-midi+unsubscribe@googlegroups.com.
To post to this group, send email to androi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-midi/d9527d93-08ef-4bd0-ac84-e9d4f6cb4b9e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages