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.

CCS/CC2640R2F: Pairing between Mobile phone and CC2640R2

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hi,

I am working on modified Project zero version, its working great. We are using open source BLE scanner app to read and write data from our device.

Now I want to try a connection from my mobile to CC2640R2 device without any app. I dont want to read or write data, I just want to make a pairing connection with my mobile just like connecting a Bluetooth headset or some other BLE device pairing with mobile phones.

Is this possible?

I have modified the pairing code in Project zero as below, but that didnt work on pairing with mobile.

The below code is in project_zero.c file under Application folder i project zero example project.

  uint32_t passkey = 0; // passkey "000000"
  uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
  uint8_t ioCap = GAPBOND_IO_CAP_KEYBOARD_DISPLAY;

Thanks

JanSom

  • Hello Jan,
    I am not sure.
    I will try to find some answers, but it might take some time.
  • Thanks Eirik, take your time.
    I will also play with this CC2640R2 Launchpadand update here If I get success in this.
    Let me know if you can able to solve this.

    Regards,

    JanSom
  • Hello Jan,
    For iOS I could not find any documentation or references, but an experienced colleague mentioned that a basic peripheral device will not show up in the built-in settings->bluetooth device list before it has connected/paired through an app. Some BLE hid devices show up though so there might be some filtering on BLE advertising packets.

    In android you should be able to find the device with the built in bluetooth menu, but I am not sure how you can pair without an app as we don't recommend GAPBOND_PAIRING_MODE_INITIATE for the peripheral.

    Also please refer to the users guide Section GAP Bond Manager and LE Secure Connections:
    When pairing with smartphone Central devices, it is recommended to use GAPBOND_PAIRING_MODE_WAIT_FOR_REQ as undefined behavior may occur when a Slave Security Request is sent by the Peripheral. Both iOS and Android will initiate pairing when the peripheral responds with an Insufficient Authentication error response when a GATT secure characteristic is accessed.
  • Hi Eirik,

    Thanks for your response. I have already tried what you have said with android but that didn't make device pairing. In mobile, it asks for pairing request when I give accept after seconds a toast message is shown that pairing failed because of incorrect password. I didn't change password from example project zero, its '0'.

    Note:

    I have used GAPBOND_PAIRING_MODE_WAIT_FOR_REQ.

    Thanks

    JanSom

  • Does it work with ioCap  set to GAPBOND_IO_CAP_DISPLAY_ONLY?

    What is printed on your console from the Log_info2 call above this line in project_zero.c (run in debug mode with breakpoint):

        case APP_MSG_SEND_PASSCODE: /* Message about pairing PIN request */
          {
            passcode_req_t *pReq = (passcode_req_t *)pMsg->pdu;
            Log_info2("BondMgr Requested passcode. We are %s passcode %06d",
                      (IArg)(pReq->uiInputs?"Sending":"Displaying"),
                      DEFAULT_PASSCODE);
            // Send passcode response.
            GAPBondMgr_PasscodeRsp(pReq->connHandle, SUCCESS, DEFAULT_PASSCODE);
          }

    Which value is DEFAULT_PASSCODE set to? Is it the same as the requeste passcode printed in Log_info2.

  • Hi Eirik V,

    Sorry for delayed response. I have tried what you said by giving a break point under APP_MSG_SEND_PASSCODE but the program doesn't go there.

    It doesn't work GAPBOND_IO_CAP_DISPLAY_ONLY too.

    I have pasted the logs below, it just shows that Paring started. Still I'm not able to get paired with my mobile.

    Log Print:

    #000001 [ 0.013 ] INFO: (project_zero.c:625) Initialized board LED pins
    #000002 [ 0.014 ] INFO: (project_zero.c:663) Name in advertData array:  PRZV2.0      
    #000003 [ 0.017 ] INFO: (PRZ.c:1449) Temp&Hum Sensor not found

    #000004 [ 0.021 ] INFO: (project_zero.c:1513) (CB) GAP State change: 1, Sending msg to app.
    #000005 [ 0.022 ] INFO: (project_zero.c:1513) (CB) GAP State change: 2, Sending msg to app.
    #000006 [ 0.034 ] INFO: (project_zero.c:1188) GAP is started. Our address: 0x546C0EA044D5
    #000007 [ 0.034 ] INFO: (project_zero.c:1198) Advertising
    #000008 [ 71.434 ] INFO: (project_zero.c:1513) (CB) GAP State change: 6, Sending msg to app.
    #000009 [ 71.434 ] INFO: (project_zero.c:1212) Connected. Peer address: 0x5B826508A073
    #000010 [ 71.749 ] INFO: (project_zero.c:1282) HCI Command Complete Event received
    #000011 [ 71.797 ] INFO: (project_zero.c:1559) Pairing started
    #000012 [ 104.727 ] INFO: (project_zero.c:1513) (CB) GAP State change: 4, Sending msg to app.
    #000013 [ 104.728 ] INFO: (project_zero.c:1513) (CB) GAP State change: 2, Sending msg to app.
    #000014 [ 104.728 ] INFO: (project_zero.c:1228) Disconnected / Idle
    #000015 [ 104.728 ] INFO: (project_zero.c:1198) Advertising

    Thanks & Regards

    JanSom

  • Hello Jan,
    1)
    That's odd. Can you take a BLE air sniffer capture showing the pairing request/response and subsequent SMP operations? That would be a good starting point to figure out if PZ or the app is to blame.

    2)
    Which android version and phone are you using?
    Also refer to this relevant post:
    e2e.ti.com/.../516472

    3) Try these settings also

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

    4) Which SDK and which BLE stack
  • Hi Eirik,

    1) Can you take a BLE air sniffer capture showing the pairing request/response and subsequent SMP operations? That would be a good starting point to figure out if PZ or the app is to blame.

    Ok, I will try with BLE sniffer and keep you posted.

    2) Which android version and phone are you using?

    I am using android 8.1.0.

    3) Try these settings also

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

    I have tried these settings with different combination of  pairMode and ioCap. That didnt make paring with mobile.

    4) Which SDK and which BLE stack

    I am using SDK as simplelink_cc2640r2_sdk_2_30_00_28 and BLE stack as V2.2.2.

    I will try with BLE sniffer as you said and let you know.

    Thanks

    JanSom

  • JanSom,
    Please also try with the latest sdk.
    I'm going to close this post for now then. If you have feedback within a few days you can follow up question to reopen this thread. If it takes longer than please post a new thread by pressing the orange button + Ask a related questions. Please make sure to add info about sdk used, pair settings etc.