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.

CC2640: Cannot change passkey remotely

Part Number: CC2640

Hi,

I would like to change the default passkey on simpleBLEperipheral from a connected device (smartphone) with bonding enable. My GAP Bond Manager configuration is initialized as following:

  // Setup the GAP Bond Manager
  {
    uint32_t passkey = 123456; // 6-digits passkey "000000"
    uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;	//GAPBOND_PAIRING_MODE_INITIATE; //GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
    uint8_t mitm = TRUE;
    uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
    uint8_t bonding = TRUE;

    GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t), &passkey);
    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
  }

But when I send a new 32bit-passkey from the android device through an attribute and pass it to the following function :

GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t), &passkey); 

.. then the system crashes and the code gets stuck here :

/****************************************************************************/
/* ABORT - ABNORMAL PROGRAM TERMINATION.  CURRENTLY JUST HALTS EXECUTION.   */
/****************************************************************************/
void abort(void)
{
    loader_exit();
    for (;;);   /* SPINS FOREVER */
}

Is it possible to update the passkey in this sort of way or do I need to add a layer by myself to manage a user-defined passkey ? My project is based on ble_sdk_2_02_01_18

In advance, thank you for the help

Regards,

Robin B.

  • Hi Robin,

    I would recommend setting your passcode through a passcodeCB. Please see the Passcode Entry section of the TI BLE Software Developer's Guide for more information. Instead of setting passcode = 11111; like the example in Listing 69, you would set passcode using the value from your remote device.