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.

CC2652R: How to set TxAdd=1 in the BLE Advertising Packet ?

Part Number: CC2652R
Other Parts Discussed in Thread: BLE-STACK

Hi,

I use a CC2652 and my project is based on the multi-role example application of the CC26X2 SDK 2.10.00.44.

In my multi-role BLE application I need non-connectable and non-scannable undirected advertising with (PDU Type=2)/(TxAdd=1)/(RxAdd=0) fields in PDU header:

Bluetooth Advertisement PDU format

In my multi-role.c file I defined new parameters for GAP advertising:

#define GAPADV_PARAMS_LEGACY_NONCONN  {                                    \
  .eventProps = GAP_ADV_PROP_LEGACY,                                       \
  .primIntMin = 160,                                                       \
  .primIntMax = 160,                                                       \
  .primChanMap = GAP_ADV_CHAN_ALL,                                         \
  .peerAddrType = PEER_ADDRTYPE_RANDOM_OR_RANDOM_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_1_MBPS,                                      \
  .secPhy = GAP_ADV_SEC_PHY_1_MBPS,                                        \
  .sid = 0                                                                 \
}

Also, in my multi-role.c file I changed GAP advertising setup in multi_role_advertInit() to use new parameters for advParamLegacy :

static void multi_role_advertInit(void)
{
  uint8_t status = FAILURE;
  // Setup and start Advertising
  // For more information, see the GAP section in the User's Guide:
  // software-dl.ti.com/.../

  // Temporary memory for advertising parameters for set #1. These will be copied
  // by the GapAdv module
  //GapAdv_params_t advParamLegacy = GAPADV_PARAMS_LEGACY_SCANN_CONN;
  GapAdv_params_t advParamLegacy = GAPADV_PARAMS_LEGACY_NONCONN;

  // Create Advertisement set #1 and assign handle
  GapAdv_create(&multi_role_advCB, &advParamLegacy,
                &advHandleLegacy);

However, I did not see TxAdd=1 in the air :

What is wrong in my approach ?

Thanks.

  • Hi Alexander,

    You are not advertising directed, so you are not using the peerAddrType parameter.

    Are you trying to configure the local device address to random? In that case you should set the addremode in the GAP_DeviceInit() call. For more info see the BLE-Stack User's Guide.
  • Hi Marie,

    Thank you for prompt reply.

    I tried to change addremode in the GAP_DeviceInit () to ADDRMODE_RANDOM by following the step below in my multi-role.c file:

    // Address mode of the local device
    #define DEFAULT_ADDRESS_MODE                  ADDRMODE_RANDOM
    

    However, this change crashes the application and I see the following screen in my terminal:

    In fact, I need non-connectable and non-scannable undirected advertising with (PDU Type=2)/(TxAdd=1)/(RxAdd=0) fields in PDU header.
    I need Advertising packet in the air that I have here :

    Thanks,

    Alex.

  • Hi Alex,

    Did you include a pointer to a random address in GAP_DeviceInit? 

    GAP_DeviceInit(profileRole, taskID, addrType, pRandomAddr)   

  • Hi Marie,

    I did a lot of tests but could not set TxAdd = 1.

    In one of the tests, I followed your offer and changed the address mode:

    // Address mode of the local device
    //#define DEFAULT_ADDRESS_MODE                  ADDRMODE_PUBLIC
    //#define DEFAULT_ADDRESS_MODE                  ADDRMODE_RANDOM
    #define DEFAULT_ADDRESS_MODE                  ADDRMODE_RP_WITH_RANDOM_ID
    
    
    
    static uint8 randomAddr[B_ADDR_LEN] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5};
    static uint8 * pRandomAddr = randomAddr;
    

    GAP_DeviceInit(GAP_PROFILE_PERIPHERAL | GAP_PROFILE_CENTRAL, selfEntity, addrMode, pRandomAddr);

    But these above chages stopped (crashed?) the GAP. So, I still cannot resolve my task.

    Please, help me.

    Thanks,

    Alex.

  • Hi Marie,

    Suddenly, I found that in the address mode = ADDRMODE_RP_WITH_PUBLIC_ID everything is fine and I can set TxAdd = 1!
    Now I'm looking for a way to change the advertising address "on the fly".

    By the way, it seems that the cause of the crash is combined with a random generator. I did not find the code TRNGCC26XX_open () in multi-role project (neither stack no app). I guess that in the address mode = ADDRMODE_RANDOM or ADDRMODE_RP_WITH_RANDOM_ID the GAP uses TRNGCC26XX without correct initialization on my side.

    Could you comment on this?

    Thank you very much for your help.

    Alex.
  • Hi Alex,

    If you are using a resolvable private address (RPA), the BLE-Stack handles changing the RPA at a given frequency at runtime. You can control the interval with the GAP_PARAM_PRIVATE_ADDR_INT. See how to change it here: http://dev.ti.com/tirex/content/simplelink_cc26x2_sdk_2_10_00_44/docs/ble5stack/ble_user_guide/html/ble-stack-5.x/privacy.html#using-privacy-in-stack 

  • Hi Marie,

    Yes, exactly!

    Thanks for useful link. The problem is resolved.

    Best Regards,

    Alex.