How I changed the PASSKEY in NRF52832??

I want to change static_passkey from "000000" to "0000".

But It doesn't work when I update changed code to board.

I changed like below pictures.(000000 -> 0000)

And this is the code of PASSKEY

Please help me.

  • "Doesn't work" means I can't find this device when I scanned by app.

  • Hello,

    Setting the STATIC_PASSKEY value to "0000" is indeed the right way to do do. You might also need to adjust the following parameters for it:

    #define SEC_PARAM_MITM                      1
    #define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_DISPLAY_ONLY 

    This has been described in this ticket: (https://devzone.nordicsemi.com/f/nordic-q-a/101940/how-to-config-lesc?ReplyFilter=Answers&ReplySortBy=Answers&ReplySortOrder=Descending) and shows an example on how to implement these changes in the context of the ble_app_hrs example.

    Hope this helps.

    Best Regards,

    Swathy 

  • Oh, Sorry.
    I didn't write that part.

    I coded that part like this :

    #define SEC_PARAM_BOND                  1                                       /**< Perform bonding. */
    #define SEC_PARAM_MITM 1 /**< Man In The Middle protection not required. */
    #define SEC_PARAM_LESC 0 /**< LE Secure Connections not enabled. */
    #define SEC_PARAM_KEYPRESS 0 /**< Keypress notifications not enabled. */
    #define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY /**< Display only I/O capabilities. */
    #define SEC_PARAM_OOB 0 /**< Out Of Band data not available. */
    #define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
    #define SEC_PARAM_MAX_KEY_SIZE 16 /**< Maximum encryption key size. */

    #define STATIC_PASSKEY "000000" /**< Paring pass-key */

    But I found the reason of this issue.

    The passkey must be 6 digits. So I can't change passkey to 4 digits.

    I heard that this is related to Bluetooth, Android security regulations.

    Is it right??

  • Hello,
    You are correct. The passkey for Bluetooth pairing must indeed be 6 digits long. This is not just related to Android security regulations, but is a requirement specified in the Bluetooth standard itself.
    The passkey is always a 6-digit number, ranging from 000000 to 999999. Attempting to use a 4-digit passkey (like "0000") would not comply with the Bluetooth specification and thus would not work correctly for pairing.
    Regards,
    Swathy
Related