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.

CC2642R: How to know if connected to a BLE 4 or 5 device ?

Part Number: CC2642R

Hi All
I'm developing a project based on the multi role example.
Basically my device starts as a central and becomes a Peripheral after few seconds if no connection is established, then it cycles as central -> peripheral until a connection is performed.

I've implemented the PHY change on both central and peripheral, I found the CODEC PHY S2 is the one that results in the better range versus speed and power consumption, so once the connection is established, I send a PHY change request to enable this S2 PHY.
Unfortunately this PHY change request drops the connection with some BLE 4 devices.

Since BLE 4 devices only supports the legacy 1M PHY, I would like to avoid sending this PHY change request, my question is : how can I check if the connected device is BLE 4 or 5, after the connection is established ? This question is for both the central and peripheral roles ?

Thanks to all.
Jerome

  • Great question, Jerome! I never thought of that.

    I will assign an expert to help you out. Someone should come back with an answer in the next couple of (work) days. Please stay tuned.

    By the way, can you please let us know what SDK version are you using?

    -Luis

  • Hi Jerome,

    When you send a HCI_LE_SetPhyCmd() this translates in the BLE stack to a Link Layer command called LL_PHY_REQ. If the peer device is a Bluetooth 4.x device it should respond with a link layer unknown command response packet. (It should not disconnect.)

    You can use theHCI_LE_ReadRemoteUsedFeaturesCmd() to read the LL features supported by the peer device. Please see ll_common.h for all the bytes and bits in the returned ll feature bit mask. As you can see, if the peer device supports LE Coded PHY bit 3 of byte 1 is set to 1. 

    // Byte 1
    #define LL_FEATURE_2M_PHY                              0x01
    #define LL_FEATURE_STABLE_MODULATION_INDEX_TX          0x02
    #define LL_FEATURE_STABLE_MODULATION_INDEX_RX          0x04
    #define LL_FEATURE_CODED_PHY                           0x08
    #define LL_FEATURE_EXTENDED_ADVERTISING                0x10
    #define LL_FEATURE_PERIODIC_ADVERTISING                0x20
    #define LL_FEATURE_CHAN_ALGO_2                         0x40
    #define LL_FEATURE_LE_POWER_CLASS_1                    0x80

  • Hi 
    Thanks for you answer.
    Could you please provide some source code to parse the response to HCI_LE_ReadRemoteUsedFeaturesCmd() ?

    I cannot find any example to retrieve the hciEvt_BLEReadRemoteFeatureComplete_t and check the supported features.

    Thanks

  • Hi Jerome,

    After the HCI_LE_ReadRemoteUsedFeaturesCmd() has gone over the air and the peer device has responded you will get a hciEvt_BLEReadRemoteFeatureComplete_t event in the application. You can process it in the _processStackMsg function in your application. Taking SimpleCentral_processStackMsg from simple central as an example:

    static uint8_t SimpleCentral_processStackMsg(ICall_Hdr *pMsg)
    {
      //...
      switch (pMsg->event)
      {
        //...
        case HCI_GAP_EVENT_EVENT:
        {
          // Process HCI message
          switch (pMsg->status)
          {
            case HCI_READ_REMOTE_INFO_COMPLETE_EVENT_CODE:
            {
               hciEvt_BLEReadRemoteFeatureComplete_t*pMyMsg = (hciEvt_BLEReadRemoteFeatureComplete_t*)pMsg;
               uint8_t featSet[8];
               // Get current feature set from received event 
               memcpy( featSet, &pMyMsg ->features[2], 8 );