Strange behavior of the peripheral role if the device in a dual role (central and peripheral)

This is the first time I've used two roles on one device and I've encountered some oddities.

The topology is as follows:
Device A (nRF52840-DK) operates in dual mode (but in this case I use the role of the periphery), device B (nRF connect on smartphone android) operates only in central mode.

The two devices are paired and bonded.

If after this I disconnected the devices and turn off advertising on device A, and then call the bt_conn_le_create_auto() function or the bt_conn_le_create() function and pass the address of device B then a connection is established between devices A and B!

And this only worked for me if device B was a smartphone with the NRF Connect app.
This does not happen with NRF Connect on a PC Windows, and if device B also nRF52840-DK

If this seems fantastic, I am ready to make a video, if it is normal, then explain why it works like this?)

Parents
  • Hello,

    I am not surprised this may work, because the stored bonding information is not really tied to a role (central or peripheral). Instead the peer is identified using addresses or identity resolving keys, so the previously stored long term keys can be re-used to re-establish security even if role is switched. So if this is something you want to avoid the simplest may be to use a random static address and change the address before each time you want to connect to a new or old peer, or you can intentionally delete the previously stored bond information before you connect to a new or old peer.

    Kenneth

Reply
  • Hello,

    I am not surprised this may work, because the stored bonding information is not really tied to a role (central or peripheral). Instead the peer is identified using addresses or identity resolving keys, so the previously stored long term keys can be re-used to re-establish security even if role is switched. So if this is something you want to avoid the simplest may be to use a random static address and change the address before each time you want to connect to a new or old peer, or you can intentionally delete the previously stored bond information before you connect to a new or old peer.

    Kenneth

Children
  • Did I understand you correctly that if the devices exchanged keys, then the peripherals can initiate a connection with the central one and even without advertising?

    That is, advertising (on the peripheral side) is needed only so that the central one can identify the device it needs and receive its real address, and then connection is possible only with an address?

    If so, why can the peripherals initiate a connection only on an Android smartphone, but this does not happen on a hardware basis like nRF52840-DK

  • Careful: Modern smartphones can do their own advertising and can thus be connected to normally.

    The NRF connect for mobile app has (in newer verions) filters enabled that filter these out by default.

  • It's difficult to give meaningful short answer here, but a connection can be established if one side is scanning and the other side is advertising, and they previously have established a bonded relationship. That is kind of the short answer of it. It's fully possible by either side to either don't allow this or allow this, given the desired software behavior you want for your application.

    Kenneth

Related