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.

Gap Bond Manager Callbacks not constitent

Other Parts Discussed in Thread: CC2640

Hello TI. We used the simple peripheral example in BT v2.2.0 as our base code and added the gap bond manager call backs.  We use LEDs to demonstrate when pairing starts (GAPBOND_PAIRING_STATE_STARTED) and when it completes (GAPBOND_PAIRING_STATE_COMPLETE).  For future connections with the same paired device, we expect GAPBOND_PAIRING_STATE_BONDED to be sent to the application.  We use an LED for this event as well.  As we begin adding more of our code, we notice the GAPBOND_PAIRING_STATE_COMPLETE and GAPBOND_PAIRING_STATE_BONDED event callbaacks seem to stop working.  Our leds are no longer firing for these events.  GAPBOND_PAIRING_STATE_STARTED seems to fire appropriately.  To resolve the issue, we have to go back to the initial simple peripheral example with the callbacks for pairing/bonding.  Once we verify the original code works, we switch back to our code.  Now, we see the GAPBOND_PAIRING_STATE_COMPLETE and GAPBOND_PAIRING_STATE_BONDED events working again with no code changes.  This is a strange issue that we cannot seem to pinpoint what causes the failure.  Sniffer traces show that pairing occurs successful.  Traces also show the CC2640 remembers bond connections.  the pairing/bonding code is behaving properly.  The issue is that the callback events are not always firing back to the application.  I have noticed similar issues posted, but no real solution.

  • To add, it appears that the very first phone we connect to the CC2640 works consistently. We receive the appropriate callbacks. As soon as we introduce a new phone, we see the GAPBOND_PAIRING_STATE_STARTED event. We never receive the GAPBOND_PAIRING_STATE_COMPLETE event. The paired device believes it is paired. upon subsequent connections, we check to see if the paired device has previously paired. The CC2460 complains that the paired device was never paired. We did not see this issue in BLE v2.1. Any help would be appreciated.
  • We have continued to test. it appears that as we add code the callbacks stop because the peripheral is not storing bond data for new devices. we compared the map files for when the callbacks for GAPBOND_PAIRING_STATE_STARTED and GAPBOND_PAIRING_STATE_COMPLETE events work and stop working.

    When the events work:
    ENTRY POINT SYMBOL: "ResetISR" address: 000075e1


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH 00000000 0000f000 0000b21e 00003de2 R X
    FLASH_LAST_PAGE 0001f000 00001000 00000000 00001000 R X
    SRAM 20000000 00004368 000037ee 00000b7a RW X


    When the events stop working:
    ENTRY POINT SYMBOL: "ResetISR" address: 00007639


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH 00000000 0000f000 0000b2d2 00003d2e R X
    FLASH_LAST_PAGE 0001f000 00001000 00000000 00001000 R X
    SRAM 20000000 00004368 00003826 00000b42 RW X
  • Hi TI.  any help would be appreciated as this is a big issue for us.  In summary, we get the GAPBOND_PAIRING_STATE_STARTED.  However, we never receive the GAPBOND_PAIRING_STATE_COMPLETE.  i have tried tracing through the code, but cannot set breakpoints in gapbondmgr.c.  the bond data is not being saved to snv so i am assuming that is why the GAPBOND_PAIRING_STATE_COMPLETE callback never fires.  The original simple_peripheral design works, but as we start adding more and more code, the complete callback events just stop firing.  We have tried increasing the GAP_ROLE_STACK_SIZE.  Our Heapmgr_size is set to 0 for auto adjustments.  Our application worked on the BLE v2.1 stack.  However, the same code no longer works on BLEv2.2 after tweaks of course.  At this point, we are out of ideas as we cannot remove functionality from our product to get the bonding working.

  • Hi Taneka,

    I have a few questions about your setup.

    1. What phones are you testing this with? Can you try testing with the Security Central example from the TI BLE github page? github.com/.../ble_examples

    2. What pairing mode are you using?

    3. Do you have a sniffer capture of the failed pairing process?
  • We are testing with an iPhone6S running IOS 10.0.2.  We are using "just works" for pairing/bonding as shown below.  i have enclosed a frontline sniffer trace of the ble connection.  Pairing appears to take place successfully.  However, the link keys are not being stored in the peripheral.  the application receives the GAPBOND_PAIRING_STATE_STARTED event, but not the GAPBOND_PAIRING_STATE_COMPLETE/GAPBOND_PAIRING_STATE_BONDED events.  we have also appended the map file from our application as well.  we do not see this issue when we use the simple_peripheral example.  However, as we begin adding our application, at some point, the link keys stop being stored.  the issue appears to manifest once we start filling up the flash.  We have tried increasing the stack, but the issue persists.

    uint32_t passkey = 0; // passkey "000000"
    uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
    uint8_t mitm = FALSE;
    uint8_t ioCap = GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT;
    uint8_t bonding = TRUE;

    pairing.zip

  • we were able to reduce our code and miraculously we are now receiving events for GAPBOND_PAIRING_STATE_COMPLETE and GAPBOND_PAIRING_STATE_BONDED. we also receive the event the bonds are saved. however, when we call "GAPBondMgr_GetParameter(GAPBOND_BOND_COUNT, &bondCount)", the bondCount is always 0. Has this API changed?
  • miraculously, the api started working today.

  • Hi Taneka,

    I'm glad the API started working for you. Are you still running into issues with code size? Are you using 1 page or 2 page SNV?