This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2540: Using HCI_EXT_ConnEventNoticeCmd as Central with multiple peripheral connections

Part Number: CC2540

Is it possible to get an event when the connection event for each connected peripheral finish?

Let's explain with an example, I have 2 connections, suppose that the both connection intervals are the same for both peripherals, and this is the timeline of the connection intervals

-----1--2-----------1--2-----------1--2----> time

I want to receive an event everytime 1 or 2 has a connection event, do some processing for this connection,

However, I think there are some other considerations that have to be taken. According to the Software developer guide:

7.7.2 Limit Application Processing During Bluetooth Low Energy Activity
Because of the time-dependent nature of the Bluetooth Low Energy protocol, the controller (LL_ProcessEvent()) must process before each connection event or advertising event. If the controller does not get process, advertising restarts or the connection drops. Because OSAL is not multithreaded, each task must stop processing to let the controller process. The stack layers do not have this issue.
Ensure that the application processes less than the following: (connection/advertising interval) – 2 ms
The 2 ms are added as buffer to account for controller processing time. If extensive processing is required in the application task, split it up using OSAL events in Section 3.3.

This is easily achievable when there's only one peripheral connected, however, when there are 2 or more, I'm assuming that you must ensure to stop the processing to le the controller handle any connection events.

Therefore these are my questions:

  1. When calling HCI_EXT_ConnEventNoticeCmd  do I have to set different taskEvents for each peripherals or there's a way to know which connHandle corresponds to the event?
  2. What happen if when I'm doing the processing for 1, the connect event of 2 happens before giving the control to the controller? The connection with 2 will be dropped?
  3. Is there anything that says how many time the controller will wait between connection intervals of different peripherals? Is this specified or controllable?
  4. How the controller schedule the connection intervals for multiple peripherals? Is this accessible from the code?
  5. Is it possible to have multiple connections with different connection intervals? (I'm guessing that's not possible or recommendable because they could overlap)
  6. Is there a way to get know how many time will be available until the next connection event happens?

A little more context for this question: I'm having problems when writing and reading characteristics from 2 connection at the same time:

https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/bluetooth-forum/989507/cc2540-as-central-connecting-to-2-devices-at-the-same-time-the-connection-to-one-peripheral-suddenly-but-the-cc2540-still-believe-it-s-connected/3678262#3678262

  • Hello Nicolas,

    I have personally assigned myself to this thread and I will be looking into this and getting back to you as soon as possible. I have also assigned myself to the other 2 related E2E posts.[Thread 1, Thread 2]. I truly apologize for the delay. I will update you soon. Expect an update by the end of tomorrow.

    Regards,

    Jan

  • Hi Nicolas,

    I have some answers for your queries:

    1. I am not too familiar with this API call, but upon reviewing the Software Developer's Guide for the 1.5.1.1 SDK, it seems this API is expected to be called by the peripheral. It also seems that it only supports a peripheral connected to a single central. However, I would still encourage you to test this and verify, just to be sure.

    2. The master should schedule out the connection events in such a way that they do not interfere with each other. This is discussed somewhat in the following E2E thread.

    3. In BLE, the slave latency is a parameter that is configured by the Central that specifies how many connection events a Peripheral may skip before the Central will initiate a disconnect. The following thread discusses slave latency somewhat.

    4. This is done internally by the stack.

    5. I believe it is possible for a central to be connected to multiple peripherals (each with different connection interval). I would recommend testing this, but I don't believe there should be any issue.

    6. I don't believe there is a way to get the time until the next connection event through an API call, but the connection interval should be a known value and you may be able to use the HCI_EXT_ConnEventNoticeCmd() function as a start point to time to calculate when (approximately) the next connection event will occur.

    If you need any further clarification, then please let me know.

    Regards,

    Jan