Connection interval woes

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am using the BLE Pioneer Kit with the PSoC BLE Module and the connection example code from AN92584.

   

I am able to achieve similar connection current measurements as AN92584 but only at 30ms interval wjile connected to CySmart on my iPhone.

   

In the code I found this, which I believe is where connIntv is set:

   

    #if CONNECTION_UPDATE
    if(connected && connUpdate)
    {
        CYBLE_API_RESULT_T conResult;
        static CYBLE_GAP_CONN_UPDATE_PARAM_T hrmConnectionParam =
        {
            800,        /* Minimum connection interval of 1000 ms */
            800,        /* Maximum connection interval of 1000 ms */
            0,          /* Slave latency */
            500        /* Supervision timeout of 5 seconds */
        };

   

        conResult = CyBle_L2capLeConnectionParamUpdateRequest(cyBle_connHandle.bdHandle, &hrmConnectionParam);
            
        if(conResult != CYBLE_ERROR_OK)
        {
           connUpdate = 0;
        }
        }
   #endif

   

No matter  what values I put in for Min and Max interval, the project just connects at 30ms interval.

   

I know this because I have a scope across my ammeter on J15 and can see waveforms similar to AN92584 and always 30 ms apart.

   

What else must I do to set the connection interval?

   

I tried debugging but I am not real good at that process here yet.

   

Thanks,

   

Dale

0 Likes
4 Replies
Anonymous
Not applicable

WOW, I can answer one of my own questions, sort of.

   

So I decided to try out CySmart using the dongle on my PC.  Very cool!

   

I was able to change the connection interval there to anything I wanted.

   

It looks like the GATT Client (iPhone or PC) can just ignore what the GATT Server wants for a connection interval.

   

There is probably a way to override that but since I will be writing the PC and iPhone and Android apps, I can live with it the way it is (I think).

   

Now on to the next learning curve 🙂

0 Likes
Anonymous
Not applicable

@Dale,

   

As you have already figured out, CySmart PC Tool would accept any connection interval value (within BLE spec limits) that is sent to it. This is not true for iOS. The have restriction on  the connection interval that can be used.

   

See section 3.6 of the Bluetooth Accessory Design Guidelines for Apple Products: https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf 

   

As you can see, it supports a minimum interval of 20 ms and other bunch of conditions.

0 Likes
Anonymous
Not applicable

So with IOS:

   

Apple states (Bluetooth Accessory Design Guidelines for Apple Products):

   

3.6 Connection Parameters
The accessory is responsible for the connection parameters used for the Low Energy connection. The accessory should request connection parameters appropriate for its use case by sending an L2CAP Connection Parameter Update Request at the appropriate time. See the Bluetooth 4.0 specification, Volume 3, Part A, Section 4.20 for details. The connection parameter request may be rejected if it does not comply with all of these rules:
       Interval Max * (Slave Latency + 1) <= 2 seconds
       Interval Min >= 20 ms
       Interval Min + 20 ms <= Interval Max
       Slave Latency <= 4
       connSupervisionTimeout <= 6 seconds
       Interval Max * (Slave Latency + 1) * 3 < connSupervisionTimeout
If Bluetooth Low Energy HID is one of the connected services of an accessory, connection interval down to 11.25 ms may be accepted by the Apple product.  The Apple product will not read or use the parameters in the Peripheral Preferred Connection Parameters characteristic. See the Bluetooth 4.0 specification, Volume 3, Part C, Section 12.5.

   

And, Cypress states (BLE 1.2):

   

Note The above parameters are used for connection parameters update procedure over L2CAP if a GAP central device does not use the peripheral preferred connection parameters. For example, iOS7 ignores peripheral preferred connection parameter Characteristics and establishes a connection with a default 30 ms connection interval. The peripheral device should request a connection parameter update by sending an L2CAP connection parameter update request at an appropriate time.

   

I believe this results in IOS GATT Clients (iPhone, iPad etc) ignoring connection parameters in the BLE component properties in your .cysch file and starts all connections at 30ms connection interval.

   

Then, if you have correctly set the parameters in the code section of your main.c which I referenced in my 1st post (be careful, these are in units of 1.25ms, not 1ms and the Timeout unit is 10ms not 1ms), AND an update request is generated by the IOS GATT Client (in the heart rate example, that request is not generated until you enter the Heart Rate Service on the IOS CySmart app), you may get an actual connection interval close to what you expect (I used 40,56,0,100 expecting to get 50ms interval and actual was 67.5ms).

   

Apparently the update request can be generated by the GATT Server too but I haven't figured out how to do that yet, any ideas out there?

   

Phew, that was a mouth full.

   

Dale

0 Likes
Anonymous
Not applicable

@Dale,

   

1) The connection parameters set in the BLE component are not used if you are a GAP Peripheral. They will only matter if you are GAP Central. This is because during setting up the connection, the Master/Central device sets the connection interval+slave latency (BLE Spec).

   

2) The default connection interval for iOS is 30 ms, Android (atleast the ones I have seen) is 50 ms and with the CySmart PC Tool (default settings) ~8.75 ms.

   

3) You can send a L2CAP Connection parameter update request to connected Central using the method shown in the project at https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day019_Con... . This way, the peripheral can ASK to have a new set of connection parameters (but only when the connection has been made). Also, it is not necessary that a Central device accepts all the requests.

0 Likes