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

BLE - bonding

Hi,

I'm using nrf52840 in order to connect to a mobile and PC.

When connecting to a mobile, connection is bonded, but when connection to a PC, it's not, although m_sec_param.bond = 1.

Can it be related to the fact that PC doesn't support bonding, as a central?

Thanks!

  • Hi,

    What services do you have on the device, and do you use some software handling it on the PC, or is it just using native support for some specific profile?

    Can it be related to the fact that PC doesn't support bonding, as a central?

    That is highly unlikely. It is more likely that the PC does not initiate bonding for some reason.

    When you configure m_sec_param.bond = 1 that means that you enable bonding in the nRF device (i.e. it supports bonding). It does not enforce bonding, though. Typically you would have some characteristics that have security parameters set so that they cannot be read or written to without bonding. There are several way to handle this.

    For instance iOS normally does not bond until it does not get access to a characteristic, in other words it bonds only when needed. With other systems (Android and most desktop systems) there are APIs that can be used to trigger bonding. Also, some systems will automatically bond in cases some services are present (like HID), but not others.

    There are several options to solve this: For instance, the nRF peripheral can request pairing/bonding, you can use some API on the central to trigger bonding, or others, depending on what makes sense in your use case.

  • Hi,

    I have NUS and device information services.

    Actually, when connection to a mobile, I have a bonded connection, but not when connection to a PC.

    I would like to know - how does the NRF device knows if it's bonding or not? The meaning of bonding is saving the keys, but how can the NRF device know if the other side is saving those keys as well? Because if the other side doesn't bond, so NRF device isn't bonded as well.

    Thanks!

  • Hi,

    Roei said:
    I would like to know - how does the NRF device knows if it's bonding or not?

    That is part of the pairing procedure. Specifically the pairing request packet indicates with a flag if bonding or just pairing. So both peers know at the beginning of the procedure if they are going to store the data for later use (bond) or not (pair). If pairing is initiated from the PC side, then the you should configure it to bond from the PC. Are you testing with some software you wrote on your own on the PC side, or for instance using nRF Connect for Desktop, or something else?

  • I'm testing it with my own PC software.

    Can you please tell me if I can see the pairing request from the PC with the bond flags, on my NRF code?

    Thanks

  • What OS is on the PC? Which Bluetooth API are you using?

Related