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

Changing DEVICE_MANAGER_MAX_BONDS in device_manager_cnfg.h

Custom Board with MCU NordicSemi nRF51822-QFAA

  • Softdevice S110 7.1

  • IAR for ARM 7.1

  • SDK 7.2 using a merged service (HID keyboard example + NUS example + HRS example)

  • Testing with iPhone 5S, 6 and iPad air (iOS 8.1.3)

    / Nexus 5 and Galaxy Note 3 (Android 4.4.2).

/******************************************************************************************************************/

I want to change DEVICE_MANAGER_MAX_BONDS.

/**
* @brief Maximum bonds that Device Manager should manage.
*
* @details Maximum bonds that Device Manager should manage.
*          Minimum value : 1
*          Maximum value : 254.
*          Dependencies  : None.
* @note In case of GAP Peripheral role, the Device Manager will accept bonding procedure 
*       requests from peers even if this limit is reached, but bonding information will not 
*       be stored. In such cases, application will be notified with DM_DEVICE_CONTEXT_FULL 
*       as event result at the completion of the security procedure.
*/
#define DEVICE_MANAGER_MAX_BONDS         7

As you see, there are no dependencies. So I changed the number to 80.

However, the program fell into assert_error loop before connecting to any centrals.

image description

After the pointer passes here, it returns err_code 7 (NRF_ERROR_INVALID_PARAM).

If I keep use 7 as MAX_BONDS, it is fine though.

What could be the problem?

Regards, Mango922

Parents
  • Please see this question.

    @Mango922: One page is 1024. The size of on bond is 128. 80 bonds will be 80*128 = 10240 which is exactly 10 pages (10240/1024). You can increase the size of each bond to 256 or 512 (since both 1024%256 and 1024%512 is 0), but I don't understand why you would do that.

  • Thanks for the link.

    In the link, you changed

    #define ALL_CONTEXT_SIZE 128
    

    .

    I didn't understand clearly.

    Why setting this to 128 ensure that a bond are not stored in two separate pages?

    Can't I set it to 256 or 512 (since in my case I want to store like 80 bond info)?

    --Edited

    Oh, you mean

    #define BOND_SIZE                  (sizeof(bond_context_t))
    

    this value is 128 ?

    You meant since the bond's size is 128, setting to the exact size will ensure that they will be in the

    same page? At first, I didn't understand why you set the value to 128.

Reply
  • Thanks for the link.

    In the link, you changed

    #define ALL_CONTEXT_SIZE 128
    

    .

    I didn't understand clearly.

    Why setting this to 128 ensure that a bond are not stored in two separate pages?

    Can't I set it to 256 or 512 (since in my case I want to store like 80 bond info)?

    --Edited

    Oh, you mean

    #define BOND_SIZE                  (sizeof(bond_context_t))
    

    this value is 128 ?

    You meant since the bond's size is 128, setting to the exact size will ensure that they will be in the

    same page? At first, I didn't understand why you set the value to 128.

Children
No Data
Related