BLE concurrent peripheral connections

Posted on
  • I am attempting to connect to a few bluetooth peripherals from the BangleJS-2. But I get the following error after the first one connects, and the second attempts to establish a connection: ERR 0x12 (CONN_COUNT)

    Are multiple BLE connections possible on the BangleJS-2.

    Cheers.

  • Are multiple BLE connections possible on the BangleJS-2.

    No, currently just one central and one peripheral connection, two in total. More connections need more statically allocated memory for bluetooth stack => less memory for Espruino. However Bangle2 is nrf52840 so memory is no longer such big issue so it can be added in future. It also needs some changes in code, currently the code expects single connection everywhere (see e.g. https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L186)

    I am attempting to connect to a few bluetooth peripherals from the BangleJS-2.

    How many is 'a few'? Even if this limit is increased it still won't be much.
    The Bluetooth stack has theoretical upper limit of 20 https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/s140.html?cp=4_7_4_0

    You can get data from more devices concurrently via advertising.

  • Okay thanks for the detailed response, it all makes sense.. Is this feature for BangleJS-2 multi-ble connections on the roadmap?

    Thankfully it is no problem to develop a work-around solution for my use-case, at least for the POC.

    In my case 'a few' is two devices.

  • There's an issue open for this: https://github.com/espruino/Espruino/issues/1360

    The plan is to do it at some point. I think to date it hasn't been a huge deal but I can see this being more useful with Bangle.js 2 - eg you might want to connect to an ECG and a cycle computer or something like that

  • Hi all,
    I am trying to connect to Android phone (there is GATT server) while debugging in Chrome IDE.
    Getting ERR 0x12 (CONN_COUNT).

    var gatt;
    NRF.requestDevice({ filters: [{ name:'Pixel 4a' }] }).then(function(device) {
      console.log("found device");
      return device.gatt.connect();
    }).then(function(g) {
      gatt = g;
      console.log("connected");
      return gatt.startBonding();
    }).then(function() {
      console.log("bonded", gatt.getSecurityStatus());
      gatt.disconnect();
    }).catch(function(e) {
      console.log("ERROR",e);
    });
    
    =Promise: {  }
    found device
    ERROR ERR 0x12 (CONN_COUNT)
    

    If "one central and one peripheral connection", what is a central and peripheral in my case?
    My understanding B2 acts as service, so it should be peripheral. Am I correct? Then why it does not allow to connect to Android service as central?

  • I've got it. Some connection was there already. I had to reboot B2. Now it connects!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

BLE concurrent peripheral connections

Posted by Avatar for PaulC @PaulC

Actions