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

Can I bond master when conected?

In the example of hid_mouse, ble device will bond master when disconnect event happen.

I try to add this two codes to Implement my idea.

            err_code = ble_bondmngr_bonded_masters_store();
            APP_ERROR_CHECK(err_code);

But when I did this error appears

error:-559038737 ...line:783 file_name:src\ll_lm.s0.c

It must be some info lack to save when ble device bond the master.

Before func "ble_bondmngr_bonded_masters_store()" runs, what should I get from master?

Or when can I bond master (before disconnect happen)?

Best wishes!

Parents
  • Lets start with the first statement:

    In the example of hid_mouse, ble device will bond master when disconnect event happen.

    This is slightly wrong. It bonds as soon as it is connected. It stores the bond data in non-volatile flash memory on disconnect. The reason for this is that flash write (and especially erase) takes a lot of time and blocks the CPU. So if the link is running the flash operation will delay time-critical interrupts in the stack causing the link to drop.

    But when I did this error appears

    error:-559038737 ...line:783 file_name:src\ll_lm.s0.c

    That is what has happened here. This is actually an assert in the stack because it was not given time to handle a time critical task.

    What version of the SDK are you running? In older version it was only possible to store this bond information when there was no connection. But this has changed recently and it should no longer be a limitation.

    Or when can I bond master (before disconnect happen)?

    It's usually the master (central) who initiates the bonding sequence, but the slave can request the master to do this. There are not a lot of SDK examples of how to do this, but the softdevice call to use are:

    sd_ble_gap_authenticate

    Look it up. Should be fairly simple to use.

Reply
  • Lets start with the first statement:

    In the example of hid_mouse, ble device will bond master when disconnect event happen.

    This is slightly wrong. It bonds as soon as it is connected. It stores the bond data in non-volatile flash memory on disconnect. The reason for this is that flash write (and especially erase) takes a lot of time and blocks the CPU. So if the link is running the flash operation will delay time-critical interrupts in the stack causing the link to drop.

    But when I did this error appears

    error:-559038737 ...line:783 file_name:src\ll_lm.s0.c

    That is what has happened here. This is actually an assert in the stack because it was not given time to handle a time critical task.

    What version of the SDK are you running? In older version it was only possible to store this bond information when there was no connection. But this has changed recently and it should no longer be a limitation.

    Or when can I bond master (before disconnect happen)?

    It's usually the master (central) who initiates the bonding sequence, but the slave can request the master to do this. There are not a lot of SDK examples of how to do this, but the softdevice call to use are:

    sd_ble_gap_authenticate

    Look it up. Should be fairly simple to use.

Children
No Data
Related