How to delete bonding info from central device

I am working with an nRF52832 board, and my application uses BLE to communicate with a central device. After performing a Device Firmware Update (DFU) over-the-air (OTA), I want to automate the process of clearing the bonding information on both the peripheral (nRF52832) and the central device.

The current setup clears bonding info on the peripheral side, but the central device still holds outdated bonding info, requiring manual intervention to clear it.

Is it possible to delete bonding information from central device automatically?

  • Hello,

    You can use bt_unpair() to clear bond information from the central device as well. Try integrating this with the central_uart sample by triggering the bond-clearing function either during disconnection or startup to ensure that the bonding information is deleted from the central side. You can choose when to clear the bonding information based on your application requirements (e.g., after disconnection or on startup). For example, if you want to implement bond clearing during disconnection, you could use something like the following. See here

    static void disconnected(struct bt_conn *conn, uint8_t reason)
    {
        printk("Disconnected (reason %u)\n", reason);
    
        /* Clear bonding information */
        clear_bond_info();  // Call the function to clear bonds
    
    }
    
    static void clear_bond_info(void)
    {
        int err;
    
        /* Clear all bond information */
        err = bt_unpair(BT_ID_DEFAULT, NULL);  
        if (err) {
            printk("Failed to clear bond information (err %d)\n", err);
        } else {
            printk("Bond information cleared successfully\n");
        }
    }
    // This is not a tested code, it's only for reference

    Kind Regards,

    Abhijith

  • As shown in snap above, it is still having bonding info of peripheral device.

  • Because of this issue, I am not able to reconnect to central device again. I need to delete bonding info from central device manually.

  • Hello,

    I apologize for the misunderstanding. I initially assumed you were working with a central device, specifically a device acting as a central unit with your own custom application. However, you've shared a screenshot from a mobile application. Does this mean your central device is a mobile device? AFAIK, the mobile application (nRF Connect App) can only act as a central device. Are you trying to clear the bond information from the mobile device? Please clarify this, and I will respond accordingly. Sorry for the confusion.

    Regards,
    Abhijith

  • I am using nRF52832 as peripheral device and nRF connect app as central device. I am able to remove bonding info from peripheral device using bt_unpair, but I also want to remove bonding info from central device as well.

    Because, after removing bonding info from peripheral device, I am not able to connect to Central device without manually removing bonding info from central device.

Related