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.

Pairing/Bonding to iOS

Other Parts Discussed in Thread: CC2540

I am trying to implement pairing/bond between a cc2540 peripheral and an iPhone.  Is there any formal Ti documentation for adding this.  I see alot of posts about this that have not been answered, clearly this is a common problem people encounter.   My questions regarding this topic are:

1) Does the app need to keep track on the LTK keys for bonding.  I need to make sure that if a phone forgets a device or is powered OFF/ON, that the CC2540 can detect this and erase its LTK keys to restart the bonding process.  Otherwise devices get out of synch and become incommunicable to each other.

2) After forcing a Phone into pair, during reconnection the link become intermittent, constantly disconnecting and reconnecting until final settling.  However at this point not GATT read/writes are possible.

3) Sometimes I notice when attempting to the Phone to see INSUFFICIENT_AUTHENTICATION, instead an UNLIKELY_ERROR is returned.  I can't find any posts or documentation on this error return.

4) Is it possible to create a document in the wiki to cover pairing/bond connections for the CC2540?

Thanks 

  • Hi Kevin,

    1) The iOS app doesn't need to and in fact can't keep track of the LTK. Why would you want to restart bonding if an iOS device is turned on/off ?

    In any case, if the iOS device chooses to forget the pairing, it will restart bonding the next time, if the device sends INSUFFICIENT_AUTHENTICATION (manually in the read/write response, not using the GATT_PERMIT_AUTHEN_READ since that will (correctly) send INSUF_ENCRYPT when it thinks a bond exists) or if the device sends Slave security request after connection establishment (PAIRING_MODE_INITIATE).

    2) This sounds strange. What's the disconnect reason when seen from peripheral.c, case GAP_LINK_TERMINATED_EVENT, pPkt->reason? Do you have a sniffer log of this? Is Wifi enabled, and does it make a difference if you turn this off?

    3) As far as I can see, unlikely error is returned if the stack can't find registered callback functions for either authorization or read/write for a service. This means they are set to NULL, but are configured to be required, such as if GATT_PERMIT_AUTHOR_READ is set for a characteristic. See e.g. gattServiceCBs_t simpleProfileCBs.

    You could also do a search for UNLIKELY using Ctrl+Shift+F and choosing all files and included files to see if something pops up.

    4) Yes, this is a good idea.

    Best regards,
    Aslak

  • 1)  Do you meaning creating a specific GATT characteristic that all it does is response with a INSUFFICIENT_AUTHENTICATION?   Several other posts implied that it must be set in the Characteristic permissions.  

    2) I'll try and capture this event with my debugger.  IAR tends to crash when breakpointing in profile code.  I'll look into using a sniffer.  I was told that a sniffer can only sniff advertisements not connection data, as there is frequency hopping.  However I guess that is incorrect.

    3) I cannot find the source of UNLIKELY_ERROR which means its set in the object code of the stack I presume.

     

    Thanks. 

  • Hi Aslak,
    I have a contrary case:
    - I’m a TI BLE device correctly connected to the iOS app with bonding
    - At certain time I must to clear all bond info in my NVM (via the specific stack API)
    - After that the iOS can not more connect correctly with me, until the user manually unpair the device form his iOS “system setting” menu -> Bluetooth

    Probably the BLE device not send the ATT_ERR_INSUFFICIENT_AUTHOR, my problem is that I not understand in witch way I can do it.
    Have you any recommendation for me to send this message to the iOS Central ?

    P.S. In both READ and WRITE callbacks is already present the check to send the ATT_ERR_INSUFFICIENT_AUTHOR, but in that situation the BLE micro controller never enter in that callbacks when I try to connect to the device with iOS and i.e. read a characteristic.

  • Hi Gabriele,

    I was wondering if you ever found a solution to this issue. At one point I thought I had this solved, but now I've been seeing it again.

    Thanks,
    John