BLE connection establishment sometimes slow

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

cross mob
lock attach
Attachments are accessible only for community members.
MaLe_1269846
Level 1
Level 1

I experience very unsteady connection times when establishing a connection between twi CYBLE-022001-00 modules.
One module is configured as central, the other a peripheral. The time I am talking about is the time measured between the "CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT" event at the central
and the "CYBLE_EVT_GAP_DEVICE_CONNECTED" event at the peripheral.
Normally this time is wll below 100ms. But sometimes it takes 1 second, or even two seconds until the peripheral receives the "CYBLE_EVT_GAP_DEVICE_CONNECTED" event.

   

For clarification I added two screenshots:
The first "BLE-Connection-Good.png" is the good case.
The second one "BLE-Connection-Bad" is an example of a bad one.
The time scale is the same (100ms/div) in both screenshots.

   

The channels are as follows:
Green, rising edge: central receives "CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT" event
Red, rising edge: central calls "CyBle_GapcConnectDevice()"
Yellow, rising edge: periperal receives "CYBLE_EVT_GAP_DEVICE_CONNECTED" event
Blue: current consumption of peripheral (approx. 20mA/div); when the yellow trace is high, an additional LED current of approx. 40mA flows.

   

Does anyone have a hint for solving this issue? I wouldn't care about a fluctuation of 100ms to 300ms. But more than 1 or 2 seconds?

   

Thanks in advance.

   

Regards,

   

Martin

   

Edit: I just realized that I accidentally uploaded two identical pictures (both were the good case), fixed.

0 Likes
4 Replies
Anonymous
Not applicable

Hi,

   

Do you face this issue when you use our example projects also? Or is it specifc to your firmware only? Can you please check this using our example projects to narrow down this?

   

Regards,

   

- Madhu Sudhan

0 Likes
Anonymous
Not applicable

Enz:

   

I have been experiencing occasional delays of several seconds too.

   

Have also been getting connections with almost immediate disconnections too.

   

If I find out what causes it, I will post the cause.

   

If I find a solution, I will post the solution as well.

   

Tim

0 Likes

Madhu Sudhan: Thanks for the response. And please excuse the delay of my answer.

   

I already opened a case for this issue and meanwhile it could be solved.

   

See my answer to Tim

   

 

   

Reagrds,

   

Martin

0 Likes

Hi Tim,

   

i could solve this issue.

   

The timing between the call to the connect function and the call to the processEvents function is very critical.

   

There should be no delay between these two function calls:

   

    cyble_api_result = CyBle_GapcConnectDevice(&bleRemoteAdr);
    CyBle_ProcessEvents();

   

In my case this was not enough, becuse my SysTickInterrupt does some work, i als added this:

   

    uint8 enableInterrupts;
    enableInterrupts = CyEnterCriticalSection();

   

    cyble_api_result = CyBle_GapcConnectDevice(&bleRemoteAdr);
    CyBle_ProcessEvents();

   

    CyExitCriticalSection(enableInterrupts);

   

This solved this issue for me.

   

I found this solution by removing all hardware dependent code from the project to make it able to run on the DevKits.

   

After doing this the problem was gone, so it must had something to do with my software.

   

And the supporting people from MyCases were very helpful.

   

Regards,

   

Martin

0 Likes