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: BLE 5, Long Range connection

Part Number: CC2640R2F
Other Parts Discussed in Thread: LAUNCHXL-CC2640R2

Hello Team,

In Github example "BLE5-Stack Long Range Central" described:
A GATT write to the Throughput PHY Characteristic to have the peripheral start negotiation the use of the Coded PHY (S8).

As I understand, we can use Long range mode only after connecting at short range, isnt it?
It looks strange.. For example if you make a data acquisition system and instal it in the large house, after system power down you should reupdate every node?
In this case you will need to take every node close to the Central Station to establish link with Coded PHY (S8) for long range connection.

Please clarify this for us.

We have 5 CC2640R2F Launchpads, please help us ot understand how to make a Long Range Link at long range :)
We tested the examples and we see strong range improvement, but after power down we need again at first connect nodes at short range. this is not suitable for our application.

Ilya.



  • Hey Ilya Mazurenko,

    the examples on the github website only support to change the PHY in a normal connection. What you need is to request the Beta software here:

    only with this beta sw it is possible to do advertising with s8 phy and connection establishment with s8 phy!

    Best Regards,

    Roman

  • Hello Roman,

    Thank you for the reply!

    We have installed SIMPLELINK-CC2640R2-BLE5-EVAL (simplelink_cc2640r2_sdk_1_50_00_71.exe).
    But in SDK User's Guide we did not found "advertising with s8".
    There are the same phrase: "Connections are always formed at 1M PHY".

    1) Is SDK simplelink_cc2640r2_sdk_1_50_00_71 the most fresh software?
    2) Can we do advertising with s8 phy using SDK simplelink_cc2640r2_sdk_1_50_00_71?
    3) Are there any example of it?
    4) in simplelink_cc2640r2_sdk_1_50_00_71 there are 3 API functions for phy selection:
    HCI_LE_ReadPhyCmd(...)
    HCI_LE_SetDefaultPhyCmd(...)
    HCI_LE_SetPhyCmd(...)
    Which function is used to set "s8 phy"? We want to make all advertising messages with s8 phy, not only for the established link.

    Could you help us with this questions please?

    Ilya.
  • Hi Ilya,

    This is a hole in the documentation, sorry about that. Did you take a look at the simple_peripheral example? You will notice that per default it advertises both on LE 1M PHY and LE Coded PHY. This is how long range advertising is configured in SimplePeripheral_processGapMessage().

            // Use long range params to create long range set #2
            GapAdv_params_t advParamLongRange = GAPADV_PARAMS_AE_LONG_RANGE_CONN;
    
            // Create Advertisement set #2 and assign handle
            status = GapAdv_create(&SimplePeripheral_advCallback, &advParamLongRange,
                                   &advHandleLongRange);
            SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);
    
            // Load advertising data for set #2 that is statically allocated by the app
            status = GapAdv_loadByHandle(advHandleLongRange, GAP_ADV_DATA_TYPE_ADV,
                                         sizeof(advertData), advertData);
            SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);
    
            // Load scan response data for set #2 that is statically allocated by the app
            status = GapAdv_loadByHandle(advHandleLongRange, GAP_ADV_DATA_TYPE_SCAN_RSP,
                                         sizeof(scanRspData), scanRspData);
            SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);
    
            // Set event mask for set #2
            status = GapAdv_setEventMask(advHandleLongRange,
                                         GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                         GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                         GAP_ADV_EVT_MASK_SET_TERMINATED);
    
            // Enable long range advertising for set #2
            status = GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
            SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);

    To set the phy option to S=8, change the advParamLongRange.primPhy parameter to GAP_ADV_PRIM_PHY_CODED_S8.

    // Use long range params to create long range set #2
    GapAdv_params_t advParamLongRange = GAPADV_PARAMS_AE_LONG_RANGE_CONN;
    
    advParamLongRange.primPhy = GAP_ADV_PRIM_PHY_CODED_S8;
    

  • Hello Marie,

    Thank you for detailed reply!

    But this example did not fully resolve our issue.

    We have tested Long Range example from SDK_1_50_00_71 (Example_SDK_1_50_00_71.7z)

    In the example we commented GAP_ADV_PRIM_PHY_1_MBPS and left only work with GAP_ADV_PRIM_PHY_CODED_S8.

    Also we changed another file from SDK: C:\ti\simplelink_cc2640r2_sdk\source\ti\ble5stack\inc\gap_advertiser.h

    /**

     * Default parameters for long range, connectable, advertising extension

     */

    #define GAPADV_PARAMS_AE_LONG_RANGE_CONN {                              

      \

      .eventProps = GAP_ADV_PROP_CONNECTABLE,                                

      \

      .primIntMin = 160,                                                    

      \

      .primIntMax = 160,                                                    

      \

      .primChanMap = GAP_ADV_CHAN_ALL,                                      

      \

      .peerAddrType = ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                          

      \

      .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                    

      \

      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,                            

      \

      .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,                            

      \

      .primPhy = GAP_ADV_PRIM_PHY_CODED_S8,                                  

      \

      .secPhy = GAP_ADV_SEC_PHY_CODED_S8,                                    

      \

      .sid = 0                                                              

      \

    }

    As result we got advertising with s8 phy Long Range, but the range of advertising is lower than the range after the connection established.

    For example:
    After connection establised we can close the metal door and the link will still exist. BUT if the connection lost, we CANT get another connection through the same door on the same range.
    The connection returns only after we open a metal door and come closer.
    Tests was done on 2 LAUNCHXL-CC2640R2.

    Compared to BLE4 advertising we got longer range, and 3dB better RSSI.

    May be we are doing something wrong... Could you help us please? This is very important project for us..

    P.S. Also in attachment example from the Github, with this example we could not do s8 phy advertising, but after connection was establised this example show better range than example from new SDK..  (OLD_Example_longrange.7z).

    Ilya.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/538/Example_5F00_SDK_5F00_1_5F00_50_5F00_00_5F00_71.7zhttps://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/538/OLD_5F00_Example_5F00_longrange.7z

  • Marie,

    Is there any way to extend the range of s8 phy advertising?

    Ilya.
  • Hi Ilya,

    The obvious way of increasing the range is to raise the Tx Power...

    Are you sure the devices are not going back to LE 1M PHY after the connection is established? The parameters in gap_advertiser.h only governs the device when advertising.

    Can you try setting the (connection) preferred PHYs of the devices with HCI_LE_SetDefaultPhyCmd()?
  • Hello Marie,

    Thank you for the reply!

    Tx power in tests was setted to it's maximum.

    Could you provide the source code with Long Range example using Only s8 phy?

    In the existing example in beta SDK_1_50_00_71 used both PHYs and they switches based on RSSI.

    I mean we just need to test the maximum range CC2640R2F can provide in advertising and link.

    Ilya.
  • Hi Ilya,

    We don't have a ready example of this.

    You should be able to disable the RSSI PHY switches quite easily.
  • Hi Ilya,

    The observation you are making with the metal door can be due to the connection process itself. When connecting, the devices must exchange an uninterrupted change of packets to be successful. However when the devices are in a connection a relatively large packet drop can be accepted while still retaining the link. This makes the connection itself a bit more robust than the connection establishment.

    Regards,
    Fredrik