This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: CC2541 BLE secured pairing using MITM & passkey

Part Number: CC2541

Hi,
Greetings.

I made few changes in hidemukbd.c file related to pairing of BLE to Mobile phone. Like: -

//  Default passcode
// #define DEFAULT_PASSCODE                      0
#define DEFAULT_PASSCODE                        123                                // By Devendra

//  Default GAP pairing mode
//  #define DEFAULT_PAIRING_MODE            GAPBOND_PAIRING_MODE_INITIATE
#define DEFAULT_PAIRING_MODE                GAPBOND_PAIRING_MODE_WAIT_FOR_REQ                      // By Devendra

// Default MITM mode (TRUE to require passcode or OOB when pairing)
// #define DEFAULT_MITM_MODE                     FALSE
#define DEFAULT_MITM_MODE                       TRUE                                //By Devendra

I have doubts: -

First, But If I  unpair my device from mobile phone after above changes & restart download & debug again pairing doen't ask for Password. It paired directly. Is there any other thing to take care in gapbondmanager or somewhere else.

Second, I like to rename the BLE for 23 character length excluding NULL character. I tried but I guess only 12 character can be used(correct me if i am wrong). For this I change default size 21 to 24 as well in (#define
GAP_DEVICE_NAME_LEN                     21 // Excluding null-terminate char) but after doing this BLE device was not in available devices.

Third, How can I restrict BLE not to be available/pair with other mobile phone unless the pair information erased permanently. Pls suggest. Thank you. Regards, Devendra
  • Hi Devendra,

    Your change to DEFAULT_PAIRING_MODE is what is causing the behavior in the first concern.

    This allows the phone to connect to the device, but not initiate pairing . You can force pairing by changing the code back - or changing the GATT table to have characteristics that require authorization. (Then the phone should initiate pairing or get it's saved key and encrypt the connection)

    Second - I'm not sure why that's happening. What string are you sending to the GGS?

    Third - upon connection, you can check number of bonds and choose not to pair. (The phone may still send a encryption request, you can decline to encrypt by using the GAPBondMgr Set Parameter API) Or instead you could erase all bonds too via similar API.

    Regards,
    Rebel