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: Android Phone can't connection

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640

Platform : CC2640R2F

SDK : 3.20.00.21

Android Phone : Sony Z5 ( Android 7.1.1 )

BLE  APP : LightBlue

Issue : Android Phone can't connect with BLE device via APP ( LightBlue )

Our customer used example project <simple_peripheral_cc2640r2lp_app> ( 3.20.00.21 ), and find out used Sony Z5 ( Android 7.1.1 ) can't connect with BLE device.

example project only modify below setting.

---------------------------------------------

// Minimum connection interval (units of 1.25ms, 80=100ms) for automatic

// parameter update request

#define DEFAULT_DESIRED_MIN_CONN_INTERVAL     12  // originally 80

 

// Maximum connection interval (units of 1.25ms, 800=1000ms) for automatic

// parameter update request

#define DEFAULT_DESIRED_MAX_CONN_INTERVAL     60  // originally 800

 

// Slave latency to use for automatic parameter update request

#define DEFAULT_DESIRED_SLAVE_LATENCY         4  // originally 0

 

// Supervision timeout value (units of 10ms, 1000=10s) for automatic parameter

// update request

#define DEFAULT_DESIRED_CONN_TIMEOUT          550  // originally 1000

--------------------------------------------

Also used same setting with <simple_peripheral_cc2640r2lp_app> ( 2.20.00.49 ), but this version was find.

We also used CC2640R2F EVM for testing ( SDK : 3.20.00.21, without any modify ), it also can't connection

CC2640R2F EVM --> Can get connection event, but can't into discovery service.

Android App --> Show connecting, after a while show disconnect.

We also tested other phones, and all test result as below.

Smart Phone Model

OS

BLE paring test

iPhone 6x

iOS 12.1

Pass

小米 Mi 4i

Android 5.0.2

Pass

Sony Z

Android 6.0.1

Pass

iPhone XR

IOS 12.3.1

Pass

IPod Touch 6

IOS 12.3.1

Pass

Sony Z5

Android 7.1.1

Fail

Samsung Galaxy A70

Android 9

Pass

Samsung Galaxy S7

Android 8

Pass

Can anyone give some recommend?

  • Hi Albert,

    Would you be able to sniff the communication on a working case and not? It would provide an opportunity to compare the differences.

  • Hi Albert,

    Do you have any updates for me?

  • Hi Sir,

    We don't have any sniffer right now, need some time to borrow sniffer ( maybe next week ).

    Can you give some comment for me first?

  • Hi Albert,

    The reasons can be many and the sniffer will help reduce and narrow the amount of possibilities.

  • Hi Sir,

    The attached files are
    <1> Capture-2019-08-16_Sony-Z5_2640-SDK-2-20-00-49.zip --- frontline sniffing log
    Sony-Z5 Android phone can connected to CC2640R2 DK with original example source code FW (by SDK-2-20-00-49  --- simple_peripheral_cc2640r2lp_app).
    But Sony-Z5 cannot pass the authentication progress when 'Charater 5 value' is pressed for reading.

    <2> Capture-2019-08-16_Sony-Z5_2640-SDK-3-20-00-21.zip --- frontline sniffing log
    Sony-Z5 Android phone never connects to CC2640R2 DK with original example source code FW (by SDK-3-20-00-21  --- simple_peripheral_cc2640r2lp_app).

    <3> Capture-2019-08-16_Galaxy-J3_2640-SDK-3-20-00-21_with-auto-sync-wl-patched.zip --- frontline sniffing log
    Galaxy J3 android phone can connected to CC2640R2 DK with original example source code FW (by SDK-3-20-00-21  --- simple_peripheral_cc2640r2lp_app)
    when GAPBOND_AUTO_SYNC_WL is true and GAPROLE_ADV_FILTER_POLICY is GAP_FILTER_POLICY_ALL.
    However, once changing GAPROLE_ADV_FILTER_POLICY to GAP_FILTER_POLICY_WHITE_CON, Galaxy J3 will not connect to CC2640R2 DK any more.
    PS: simple_peripheral_cc2640r2lp_app_with-auto-sync-wl-patched.zip & auto-sync-wl.patch are the compiled .bin file and code patch (FYI).
    The CC2640R2 DK's BLE MAC = B0:91:22:69:FB:A0

    Please kindly help analyse logs for any possible hint to fix the issues.

    Galaxy J3 SM-J320YZ Android 5.1.1
    Sony Z5 E6853 Android 7.1.1

    Sincerely thanks.

    To-E2E.zip

  • Hi Sir,

    I try to change 'DEFAULT_ENABLE_UPDATE_REQUEST''s default setting from GAPROLE_LINK_PARAM_UPDATE_WAIT_REMOTE_PARAMS  to  GAPROLE_LINK_PARAM_UPDATE_INITIATE_BOTH_PARAMS,
    then my Sony Z5 phone can connect to device (FW with SDK-3-20-00-21).
    The default value of 'DEFAULT_ENABLE_UPDATE_REQUEST'' is GAPROLE_LINK_PARAM_UPDATE_WAIT_REMOTE_PARAMS on both SDK-3-20-00-21 &  SDK-2-20-00-49.

    However, Sony Z5 android phone can connect to device, but it cannot get paired (bonded) with the device (by SDK-3-20-00-21  --- simple_peripheral_cc2640r2lp_app).
    Just like case <1> issue. 
    Please kindly help on bonded issue and double confirm the 'DEFAULT_ENABLE_UPDATE_REQUEST'' part.


    Sincerely thanks.

  • Hi Jinhua,

    From looking at the sniffer logs:

    <1> Capture-2019-08-16_Sony-Z5_2640-SDK-2-20-00-49.zip:

    It looks like the master sends an LL_CONNECTION_UPDATE_IND and then the Pairing request in the next packet. The sniffer did not register any acks from the slave for any of these packets (does not necessarily mean that the slave did not receive them, just that the sniffer did not register them). 

    - Can you try waiting with sending the Pairing Request until after the connection has been updated to use the new connection interval?

    <2> Capture-2019-08-16_Sony-Z5_2640-SDK-3-20-00-21.zip 

    This sniffer log shows a connection so it doesn't match the described problem.

    I think  there may be some connection parameters the Sony Phone will never accept, but I am not aware that there are any parameters that would cause a disconnection. I would recommend asking on an Android developer's forum.

    <3> Capture-2019-08-16_Galaxy-J3_2640-SDK-3-20-00-21_with-auto-sync-wl-patched.zip 

    If I understand you correctly, the CC2640R2 will 

    1) Advertise with no filter.

    2) Connect to the phone, pair, bond and add the phone to its white list

    3) Disconenct

    4) Advertise with white list filter. This time it can not connect.

    I can see the master is sending a connection request (packet 2641) without the slave responding.

    - Is the slave device using privacy?

    - Did you test this with any other smart phones?

  • Hi Marie,

    <1>
    - Can you try waiting with sending the Pairing Request until after the connection has been updated to use the new connection interval?
    ==>
    The attached Capture-2019-08-20_Sony-Z5_2640-SDK-3-20-00-21__Cannot-bonded.cfa recorded the process of Z5 connected to device ,and then reading character 4 and 5's description value, also enabling character 4's notification.
    After that, Z5 try to read the value of charater 5.
    Device console will show "Pairing started", but Z5's status seems keep waiting for something but then timeout -> disconnected.

    <3> You do understand correctly.
    - Is the slave device using privacy?
    ==>
    How do I confirm if device using privacy?

    - Did you test this with any other smart phones?
    ==>
    Yes, I've tried Mi-4i、Galaxy S7、iPhone 6+, and they can work with auto-sync-wl well.


    Thanks for your support!

    Capture-2019-08-20_Sony-Z5_2640-SDK-3-20-00-21__Cannot-bonded.zip

  • Hi Marie,

    Any update ?

  • Hi Jinhua,

    Sorry for the late reply. I am currently investigating what's going on.

    From the sniffer log it looks like the master (phone) sent the public key and is waiting for the slave to send its public key.

    I will get back to you when I know more, hopefully on Manday or Tuesday.

  • Hi Marie,

    Got it.
    Appreciate your help!

    Sincerely,
    Jinhua

  • Hi Jinhua,

    Looking at the sniffer log I see that the master device keeps updating the connection using LL Connection Update packets. For the purpose of debugging:

    1)     Is the CC2640R2F doing anything else simultaneously? E.g. advertising, scanning, multiple connections?

    2) Can you try programming the master device to wait with the Connection Update until pairing has finished?

    3)      Can you try disabling the LL connection update feature on the CC2640R2 using the following code snippet?

    uint8_t features[8]; 
    uint8_t i; 
     
    features[0] = ( 
                    LL_FEATURE_ENCRYPTION 
                   //|LL_FEATURE_CONN_PARAMS_REQ 
                   | LL_FEATURE_REJECT_IND_EXT 
                   | LL_FEATURE_SLV_FEATURES_EXCHANGE 
                   | LL_FEATURE_PING 
                   | LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION 
                   | LL_FEATURE_PRIVACY 
                   | LL_FEATURE_EXTENDED_SCANNER_FILTER_POLICIES 
                  ); 
     
    for(i=1; i<8; i++) 
    { 
        features[i]=0; 
    } 
    HCI_EXT_SetLocalSupportedFeaturesCmd(features);
    

  • Hi Marie,

    1)     Is the CC2640R2F doing anything else simultaneously? E.g. advertising, scanning, multiple connections?
    ==>
    No, the FW is only doing one thing at the time. Please see attached file what already mentioned by my reply to this issue thread at Aug 16, 2019 10:52 AM.


    2) Can you try programming the master device to wait with the Connection Update until pairing has finished?
    ==>
    I can't and don't know how to program image for my Sony Z5...


    3)      Can you try disabling the LL connection update feature on the CC2640R2 using the following code snippet?
    ==>
    I've confirmed that the test FW already disabled 'LL_FEATURE_CONN_PARAMS_REQ' feature bit.
    8345.To-E2E.zip
    ---------------------------------------------------------------------------------------------------------------

    #if !defined (USE_LL_CONN_PARAM_UPDATE)
    // Get the currently set local supported LE features
    // The HCI will generate an HCI event that will get received in the main
    // loop
    HCI_LE_ReadLocalSupportedFeaturesCmd();
    #endif // !defined (USE_LL_CONN_PARAM_UPDATE)

    ---------------------------------------------------------------------------------------------------------------



    #if !defined (USE_LL_CONN_PARAM_UPDATE)

    // This code will disable the use of the LL_CONNECTION_PARAM_REQ
    // control procedure (for connection parameter updates, the
    // L2CAP Connection Parameter Update procedure will be used
    // instead). To re-enable the LL_CONNECTION_PARAM_REQ control
    // procedures, define the symbol USE_LL_CONN_PARAM_UPDATE
    // The L2CAP Connection Parameter Update procedure is used to
    // support a delta between the minimum and maximum connection
    // intervals required by some iOS devices.

    // Parse Command Complete Event for opcode and status
    hciEvt_CmdComplete_t* command_complete = (hciEvt_CmdComplete_t*) pMsg;
    uint8_t pktStatus = command_complete->pReturnParam[0];

    //find which command this command complete is for
    switch (command_complete->cmdOpcode)
    {
    case HCI_LE_READ_LOCAL_SUPPORTED_FEATURES:
    {
    if (pktStatus == SUCCESS)
    {
    uint8_t featSet[8];

    // Get current feature set from received event (bits 1-9
    // of the returned data
    memcpy( featSet, &command_complete->pReturnParam[1], 8 );

    // Clear bit 1 of byte 0 of feature set to disable LL
    // Connection Parameter Updates
    CLR_FEATURE_FLAG( featSet[0], LL_FEATURE_CONN_PARAMS_REQ );

    // Update controller with modified features
    HCI_EXT_SetLocalSupportedFeaturesCmd( featSet );
    }
    }
    break;

    default:
    //do nothing
    break;
    }
    #endif // !defined (USE_LL_CONN_PARAM_UPDATE)
    ---------------------------------------------------------------------------------------------------------------


    Sincerely,
    Jinhua

  • Hi Jinhua,

    Did you test other pairing methods? From the pairing rquest/response packets I see that you use just works unauthticated pairing. Can you test with the default simple_peripheral example (will use passkey entry)?

  • Hi Marie,

    I've tried the default simple_peripheral example (will use passkey entry), I only changed 
    #define DEFAULT_ENABLE_UPDATE_REQUEST         GAPROLE_LINK_PARAM_UPDATE_WAIT_REMOTE_PARAMS
    to
    #define DEFAULT_ENABLE_UPDATE_REQUEST         GAPROLE_LINK_PARAM_UPDATE_INITIATE_BOTH_PARAMS


    The same to use my Sony Z5 to connect CC2640R2 DK, and then to read Charater 4 、5's description and try to read charater 5's value.
    Z5 asked me to enter the passcode (123456), and waited a while, they disconnected each other.

    The sniffer log as attached.
    The CC2640R2 DK's BLE MAC = B0:91:22:69:FB:A0

    PS: My customer asks us to use just works to pair.

    Capture-2019-09-03_Sony-Z5_2640-SDK-3-20-00-21__Cannot-bonded-by-passCode.zip

    Sincerely,
    Jinhua

  • Hi Jinhua,

    Thank you for testing!

    In this sniffer log, it looks like the master device is in the wrong. It's not starting the encryption process after the pairing has finished...I guess this is somewhat an impasse for your issue.

  • Hi Marie,

    So it seems the wrong behavior by Z5.
    Another quick question, sometimes our customer uses Android phone to connect CC2640 but it shows "connection failed".
    They need to try more 2 ~ 4 times to get successful connection with CC2640.
    Can this problem not be completely resolved , as android system is opensource?   (Reference : https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/671154)


    Thanks for your great support,
    Jinhua

  • Hi Jinhua,

    You can try posting in android developer forums? (I don't know if it will help you if you're not developing your own android app.)

    Regarding connection issues: This can come from several things. The master only sends one conenction request packet to the slave, so if this packet is somehow lost the connection will fail. (E.g. if you're in a noisy environment, if there is some issue with the clock accuracy on either board.)