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.

CC2640R2F: Pairing/Bonding issue: Missing Bond Status notification

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640, BLE-STACK

Hi all,

I'm in the process of porting our code from the CC2640 (BLE Statck 2.1) to the CC2640R2 (BLE Stack 3.0/3.1). I followed the instruction from the TI porting guide, and the system boots properly, most of the feature are working except the pairing/bonding.

I used a the passkey entry configuration as described in the documentation and example (Simple BLE peripheral)

#elif BLE_PAIRINGMODE == BLE_PAIRING_PASSKEY

    uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
    uint8_t mitm = TRUE;
    uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
    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), &bEnabled);

    uint8_t Enabled = TRUE;
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &Enabled);

And I am sure my PasscodeProcess callback is properly executed at the application layer

    // This app uses a default passcode. A real-life scenario would handle all
    // pairing scenarios and likely generate this randomly.
    uint32_t passcode = 1134;



    uint16_t connectionHandle;
    GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connectionHandle);

    // Send passcode response
    if (GAPBondMgr_PasscodeRsp(connectionHandle, SUCCESS, passcode) != SUCCESS)
        CMSIS_RTOS_errorHandler(RTOS_LOG_CRITICAL, 0);

    m_processCounter++;

However, my pairing/bonding sequence never complete, and stay stuck at 'GAPBOND_PAIRING_STATE_STARTED' until timeout. On the host side, I'm pending on a bond status message until timeout

I've been working on this issue for almost a week now, and I checked the following points

  • I have checked the stack, heapManager, task, etc. System is stable and recovers from the failed paring.
  • I have a LaunchPad Dev board, and the connection is successful with the same parameters.
  • I have tried to connect with a wrong passkey. Device reject the connection successfully with the appropiate error message (bond status sent properly)
  • I have tried using an incompatible configuration (changing parameters mitm, iocap, etc). Device reject the connection successfully with the appropiate error message (bond status sent properly)
  • When pairing/bonding is disabled, connection is successful

I'm running out of ideas to debug this issue. It looks like the issue is somewhere in the BLE Stack after sending the GAPBondMgr_PasscodeRsp, but I don't know how to identify it.

Thanks for your help,

Best regards,

Val

  • I use a Bluegiga BLED112 dongle on the host side. Hereafter is my testbench log:

    DEBUG	09:34:02	api.py		<=[ 80 10 03 00 00 05 CE B9 65 22 91 B0 00 06 00 E8 03 00 00 FF ]
    INFO	09:34:02	api.py		EVT-Connection Status - Handle:0 - Flags:05 - Address:B0912265B9CE - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    INFO	09:34:02	BleCentralApi.py		[STACK NOTIFICATION] EVT-Connection Status - Handle:0 - Flags:05 - Address: b0:91:22:65:b9:ce - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    DEBUG	09:34:02	api.py		<=[ 80 01 05 03 00 ]
    INFO	09:34:02	BleCentralApi.py		EVT-SM Passkey Request
    INFO	09:34:02	api.py		EVT-SM Passkey Request
    INFO	09:34:02	BleCentralApi.py		[STACK NOTIFICATION] Sending PassKey <001134>
    DEBUG	09:34:02	api.py		=>[ 00 05 05 04 00 6E 04 00 00 ]
    DEBUG	09:34:02	api.py		<=[ 00 02 05 04 00 00 ]
    INFO	09:34:02	api.py		RSP-SM Passkey Entry: [OK]
    DEBUG	09:34:02	api.py		<=[ 80 10 03 00 00 03 CE B9 65 22 91 B0 00 06 00 E8 03 00 00 00 ]
    INFO	09:34:02	api.py		EVT-Connection Status - Handle:0 - Flags:03 - Address:B0912265B9CE - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:0
    INFO	09:34:02	BleCentralApi.py		[STACK NOTIFICATION] EVT-Connection Status - Handle:0 - Flags:03 - Address: b0:91:22:65:b9:ce - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:0
    DEBUG	09:34:30	api.py		<=[ 80 03 05 01 00 85 01 ]
    WARNING	09:34:30	BleCentralApi.py		[STACK NOTIFICATION] Bonding Fail: [Timeout]
    WARNING	09:34:30	BleCentralApi.py		Connection failed B0 91 22 65 B9 CE [Timeout = 3.000s]

    A successful connection (with the LauchPad) looks like this:

    DEBUG	09:45:59	api.py		<=[ 80 10 03 00 00 05 37 FD 69 22 91 B0 00 06 00 E8 03 00 00 FF ]
    INFO	09:45:59	api.py		EVT-Connection Status - Handle:0 - Flags:05 - Address:B0912269FD37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    INFO	09:45:59	BleCentralApi.py		[STACK NOTIFICATION] EVT-Connection Status - Handle:0 - Flags:05 - Address: b0:91:22:69:fd:37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    DEBUG	09:45:59	api.py		<=[ 80 01 05 03 00 ]
    INFO	09:45:59	BleCentralApi.py		EVT-SM Passkey Request
    INFO	09:45:59	api.py		EVT-SM Passkey Request
    INFO	09:45:59	BleCentralApi.py		[STACK NOTIFICATION] Sending PassKey <001234>
    DEBUG	09:45:59	api.py		=>[ 00 05 05 04 00 D2 04 00 00 ]
    DEBUG	09:45:59	api.py		<=[ 00 02 05 04 00 00 ]
    
    INFO	09:45:59	api.py		RSP-SM Passkey Entry: [OK]
    DEBUG	09:45:59	api.py		<=[ 80 10 03 00 00 03 37 FD 69 22 91 B0 00 06 00 E8 03 00 00 00 ]
    
    INFO	09:45:59	api.py		EVT-Connection Status - Handle:0 - Flags:03 - Address:B0912269FD37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:0
    INFO	09:45:59	BleCentralApi.py		[STACK NOTIFICATION] EVT-Connection Status - Handle:0 - Flags:03 - Address: b0:91:22:69:fd:37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:0
    DEBUG	09:45:59	api.py		<=[ 80 04 05 04 00 10 01 7B ]
    INFO	09:45:59	BleCentralApi.py		[STACK NOTIFICATION] Bonding successful - Bond:0 - Key Size:16 - MITM:1 - Keys Used Mask:7B
    INFO	09:46:01	BleCentralApi.py		Connected to b0:91:22:69:fd:37

    And a failed connection (wrong passkey) with my device:

    DEBUG	09:39:55	api.py		<=[ 80 10 03 00 00 05 37 FD 69 22 91 B0 00 06 00 E8 03 00 00 FF ]
    INFO	09:39:55	api.py		EVT-Connection Status - Handle:0 - Flags:05 - Address:B0912269FD37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    INFO	09:39:55	BleCentralApi.py		[STACK NOTIFICATION] EVT-Connection Status - Handle:0 - Flags:05 - Address: b0:91:22:69:fd:37 - Address Type:0 - Interval:6 - Timeout:1000 - Latency:0 - Bonding:255
    DEBUG	09:39:55	api.py		<=[ 80 01 05 03 00 ]
    INFO	09:39:55	BleCentralApi.py		EVT-SM Passkey Request
    INFO	09:39:55	api.py		EVT-SM Passkey Request
    INFO	09:39:55	BleCentralApi.py		[STACK NOTIFICATION] Sending PassKey <001134>
    DEBUG	09:39:55	api.py		=>[ 00 05 05 04 00 6E 04 00 00 ]
    DEBUG	09:39:55	api.py		<=[ 00 02 05 04 00 00 ]
    INFO	09:39:55	api.py		RSP-SM Passkey Entry: [OK]
    DEBUG	09:39:55	api.py		<=[ 80 03 05 01 00 04 03 ]
    WARNING	09:39:55	BleCentralApi.py		[STACK NOTIFICATION] Bonding Fail: [Confirm Value Failed]
    WARNING	09:39:55	BleCentralApi.py		Connection failed B0912269FD37 [Timeout = 3.000s]

  • Hi Valerian,

    Have you added the Pairing CBs to your application? This may help with understanding the failure. I would recommend copying the SimpleBLEPeripheral_pairStateCB code from the latest version of simple_peripheral.c.

    Also, have you tried using the default passcode? Depending on which version of the TI BLE-Stack you are using, the default will be 000000 or 123456. This may help figure out if the passcode isn't being set correctly.
  • Hi Rachel,
    Thank you for helping me.
    Yes, I've added the BLE_CM_pairStateCB to my application as I've read that the callbacks are now mandatory. I get the first callback with state = GAPBOND_PAIRING_STATE_STARTED, but I never get another call after the pairing/bonding process completion.
    I also tried sending the wrong passkey (see 3rd host log), and the pairing/bonding process completes successfully with the appropriate error code (Confirm Value Failed).
    I used the SimpleBlePeripheral example as a base for my application
    Please let me know if there are other things I should check for you
    Best
    Valerian
  • Hi all,

    I finally found the answer to my problem... When merging my app with the Simple Ble Peripheral example, I forgot the following initialization in main.c

    #ifdef CACHE_AS_RAM
      // retain cache during standby
      Power_setConstraint(PowerCC26XX_SB_VIMS_CACHE_RETAIN);
      Power_setConstraint(PowerCC26XX_NEED_FLASH_IN_IDLE);
    #else
      // Enable iCache prefetching
      VIMSConfigure(VIMS_BASE, TRUE, TRUE);
      // Enable cache
      VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
    #endif //CACHE_AS_RAM
    
    #ifdef ICALL_JT
      /* Update User Configuration of the stack */
      user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
      user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();
    #endif  /* ICALL_JT */

    Best,

    Val