This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Central: multiple connection at the same time

Hi,

I'm using S130 with PCA10028 and I would like to connect my central device to multiple peripheral at the same time.

According to my understanding, the only way I have to achieve this goal is to use whitelist. However, once the first device acknowledge my connect, scanning seems to stop and no more connections are done.

Is my understanding correct ? and if yes why ? Where come from this limitation ? (SDK, Bluetooth, hardware...)

Does I have any way to continue connection on other devices without recalling sd_ble_gap_connect again ?

Thanks for your support

Parents
  • This is just how it is implemented in the SoftDevice, it will connect to the first device found in the whitelist then it will stop scanning. Then you can for example call sd_ble_gap_connect() again when you get the BLE_GAP_EVT_CONNECTED event.

    There is no limitation on this, it could have been implemented the way you describe, but it is not. I will add this as a feature request/improvement internally.

Reply
  • This is just how it is implemented in the SoftDevice, it will connect to the first device found in the whitelist then it will stop scanning. Then you can for example call sd_ble_gap_connect() again when you get the BLE_GAP_EVT_CONNECTED event.

    There is no limitation on this, it could have been implemented the way you describe, but it is not. I will add this as a feature request/improvement internally.

Children
  • Great, thank you for your reply.

    Just one more question, regarding connect behavior, I notice it's not possible to connect to 2 devices in the same time. We have to wait for previous CONNECT ACK before requesting a new connect. Is it also a Nordic behavior ? Or a BLE behavior ?

  • When the central receives an advertising packet from one of the devices in the whitelist, it will send a connection request. Then there are certain timings that needs to be followed when before the peripheral answers. For more information see Vol. 6, Part B, Section 4.5.3 in the Bluetooth Core spec 4.2. The timings depend on the connection interval, but normally you have a short connection interval on initial connection. So the connection should be established quickly compared to the advertising interval of the second device you want to connect to. My point is that it shouldn't be necessary to send another connection request before the previous connection is established.

  • As long as one follows the timings in the spec, I guess one can implement a solution where a new connection request is sent in the window between the previous connection request and the transmitWindowSize (here the radio is in RX and busy). But you would actually need to receive an advertising packet and send a connection request in this window. So in short, Nordic's implementation is to establish one connection at the time, establishing two connections by may or may not be possible, I don't know.

  • It would be easier to help you if you state what your requirements have, and what you experience, but then I think you should add a new question.

  • Got it.

    Regarding our requirements: typically, user will press a button on central device and the central will have to send a specific command to a list of peripherals (~8).

    Of course, this action have to be done as fast as possible and central is not connected to peripherals, so originally I tried to connect to all devices at same time:

    for (int i=0; i<8; i++)
        connect(....)
    

    But only 1 connect succeed and others returned INVALID_STATE. So after that I change my algorithm by something like:

    connect() //First device
    CONNECT_EVENT: //When connect event is received  
        connect() //connect to next device
    

    And this last algorithm worked, however because my goal is to connect as fast as possible, I tried to use whitelist in order to connect to all devices in same time.

Related