CONFIG_BT_ID_MAX = 2

For nrf Connect SDK, can I config CONFIG_BT_ID_MAX = 2, both adress type are Public for below use case?

ID with index = 0 for peripheral role and  for connect and bonded with sartphone.

ID with index =1 for centrol role and for connect and bonding with other ble peripheral.

Because whenever unpaired with Smartphone, we need to change ID with index  = 0 to other ble address.

But, for ID with index = 1, we not going to change it unless doing factory reset, so that it won't affect the reconnection for the bonded peripheral devices.

Parents
  • The scenario described above does not require 2 BT IDs. I'm running a device with both central and peripherial roles on a single ID successfully.

    The ID rotation stuff is not required when you allow a pairing to be overwritten somehow. Can be configured via prj.conf file but should have additional application code ("pairing mode").

  • Hi Turbo J, yes currently we also  running a device with both central and peripherial roles on a single ID. But the problem is that after paired and bonded with iPhone, if we delete the bonding info at device side and keep the same BLE mac address, iPhone os will try to connect the the device again and again, due to bonding info lost at device side, the connection will fail, so it keep connect and disconnect forever... so after unpaired with smartphone we change to another ble macaddress.

    Now we need to support bonding with other peripheral device such as Heart Rate sensor, but if we use samd ID but the ID changed, our devcie can't connected wtih boned peripheral device any more.

    That is why we want to check if it is possible with two BLE ID  can be the solution.

  • Hi Edvin,  from the multiple_adv_sets example, I still not get it for how to config and use ID with index = 0 for ble advertising....

    As a central, how to  make sure it use ID=1 and to be consistent when connect to a device?

  • Typically, you would have two different advertising sets. One for each ID. Then the central (phone) will search for something that is only present in one of your advertising sets. Perhaps there is a specific UUID or an advertising name that is only used in one of the advertising sets.

    John said:
    As a central, how to  make sure it use ID=1 and to be consistent when connect to a device?

    You make sure that the advertising packet that is being used by ID=1 has something that the other advertising packet doesn't have.

    Best regards,

    Edvin

  • hi Edwin,  I sitll not get it...

    Any example source code avaiable?  for setting CONFIG_BT_ID_MAX = 2, and

    ID with index = 0 for peripheral role and  for connect and bonded with sartphone.

    ID with index =1 for centrol role and for connect and bonding with other ble peripheral.

  • Pretty sure you need to use ID zero (default ID) for the CENTRAL mode connections. I don't see proper support for any other BT ID in the conn,h functions at least in SDK 3.3.3 version.

    The advertiser seems to support different IDs - just don't set up any advertising on ID zero. There is a sample in the SDK that sets up peripherial with multiple identities. Can be trivially modified to not use ID zero.

  • That is correct. The central will always be ID 0, but there is really no use in changing the central BLE ID, when you think about it. 

    As a peripheral, you don't really have any control over who connects to you. This is why, in your case, you want to separate between different IDs. What it really does is set up multiple Bluetooth Addresses, one for each ID. This way, you can use e.g. ID 0 when you are connected as a peripheral with the phone. If you are bonded, the phone will typically try to reconnect whenever it sees the advertisements from this device. 

    But if you add a second ID, which will use it's own address, the phone will not know that this is the same device, and it will not try to connect. 

    In the other case, when your nRF is the central in the connection, it is up to you who you want to connect to. Typically, you would set up a scanner, looking for advertisements, where you do some filtering. Whenever you find a device you want to connect to, you would then call the bt_connect() API using the address of the peripheral that you want to connect to.

    So if the reason you want to have more Bluetooth IDs is that you don't want your phone to connect to you, you can use one dedicated ID (BLE address) for the phone (when the nRF is the peripheral), and one for the other connections when the nRF is the peripheral.

    Strictly, it is not needed. You can also set the CONFIG_BT_MAX_CONN = 2, to allow for multiple connections. Then you can just restart advertising once the phone connects. The phone is already connected, so it probably will not create a second connection to the same device. 

    Best regards,

    Edvin

Reply
  • That is correct. The central will always be ID 0, but there is really no use in changing the central BLE ID, when you think about it. 

    As a peripheral, you don't really have any control over who connects to you. This is why, in your case, you want to separate between different IDs. What it really does is set up multiple Bluetooth Addresses, one for each ID. This way, you can use e.g. ID 0 when you are connected as a peripheral with the phone. If you are bonded, the phone will typically try to reconnect whenever it sees the advertisements from this device. 

    But if you add a second ID, which will use it's own address, the phone will not know that this is the same device, and it will not try to connect. 

    In the other case, when your nRF is the central in the connection, it is up to you who you want to connect to. Typically, you would set up a scanner, looking for advertisements, where you do some filtering. Whenever you find a device you want to connect to, you would then call the bt_connect() API using the address of the peripheral that you want to connect to.

    So if the reason you want to have more Bluetooth IDs is that you don't want your phone to connect to you, you can use one dedicated ID (BLE address) for the phone (when the nRF is the peripheral), and one for the other connections when the nRF is the peripheral.

    Strictly, it is not needed. You can also set the CONFIG_BT_MAX_CONN = 2, to allow for multiple connections. Then you can just restart advertising once the phone connects. The phone is already connected, so it probably will not create a second connection to the same device. 

    Best regards,

    Edvin

Children
No Data
Related