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.

RTOS/CC2642R: Query Regarding CC2642R Sample Codes on BLE 4.2

Part Number: CC2642R
Other Parts Discussed in Thread: CC2640R2F

Tool/software: TI-RTOS

Hi ,
We are using SDK simplelink_cc26x2_sdk_2_20_00_36, all codes are given with BLE5 support.
Can we downgrade it to BLE4.2? If yes, can you provide some documentation on how to do that?
  • Hey Vidushi,

    BLE5 is backwards compatible with BLE4.2. There's more information about this answered here.

    In short, you don't need to worry about altering code in the examples to work with BLE4.2. When a connection is established, both devices will negotiate which standard to use.

  • Hi Ammar,

    In our case we are using hostTest app when we are using 2640R2f app with BLE 4.2 then it is working with our interfacing code of BLE which is on Linux Platform but when we are using BLE 5.0 with chip CC2640R2f or CC2642R its not working.
  • Would you mind provide some more information? How are you testing the devices? What commands are you sending to the hostTest application? What are your results?
  • Sure Ammar,

    We are proving some commands using UART that is customized protocol.

    We will get 4 bytes of data on UART - in Hosttest app after getting that 44 particular bytes we need to respond.

    We have checked with cc2640r2f board, the code is working with our interfacing module in case ble 4.2 stack code. However,
    with cc2640r2f/cc2642 not working with ble5 stack code.. its giving stack success message but stuck after that.
  • I'm sorry for the delay. There are some differences going from BLE4.2 to BLE5 in terms of the commands sent. On Windows, BTool is an application that interfaces with compatible boards running Host Test. Here is the sequence of calls BTool uses to initialize the host test device running the BLE5 stack. Can you try sending these commands? Let me know what is received (it should match the below Tx/Rx).

    [1] : <Info> - 10:38:10.065
    Port opened at 10/9/2018 10:38:10 AM
    --------------------------------------------------------------------
    [2] : <Tx> - 10:38:10.196
    -Type           : 0x01 (Command)
    -OpCode         : 0xFC1D (HCIExt_ResetSystemCmd)
    -Data Length    : 0x01 (1) byte(s)
     Type           : 0x00 (0) (Chip Reset)
    Dump(Tx):
    0000:01 1D FC 01 00                                  .....
    --------------------------------------------------------------------
    [3] : <Rx> - 10:38:10.350
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x05 (5) bytes(s)
     Event          : 0x041D (1053) (HCIExt_ResetSystemCmdDone)
     Status         : 0x00 (0) (SUCCESS)
     CmdOpCode      : 0xFC1D (HCIExt_ResetSystemCmd)
    Dump(Rx):
    0000:04 FF 05 1D 04 00 1D FC                         ........
    --------------------------------------------------------------------
    [4] : <Tx> - 10:38:10.851
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE00 (GAP_DeviceInit)
    -Data Length    : 0x08 (8) byte(s)
     ProfileRole    : 0x08 (8) (
                      Central)
     AddrMode       : 0x00 (0) (ADDRMODE_PUBLIC)
     RandomAddr     : 00:00:00:00:00:00
    Dump(Tx):
    0000:01 00 FE 08 08 00 00 00 00 00 00 00             ............
    --------------------------------------------------------------------
    [5] : <Rx> - 10:38:10.974
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x06 (6) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (SUCCESS)
     OpCode         : 0xFE00 (GAP_DeviceInit)
     DataLength     : 0x00 (0)
    Dump(Rx):
    0000:04 FF 06 7F 06 00 00 FE 00                      .........
    --------------------------------------------------------------------
    [6] : <Rx> - 10:38:10.985
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x2C (44) bytes(s)
     Event          : 0x0600 (1536) (GAP_DeviceInitDone)
     Status         : 0x00 (0) (SUCCESS)
     DevAddr        : 54:6C:0E:A0:40:4C
     DataPktLen     : 0x00FF (255)
     NumDataPkts    : 0x05 (5)
     IRK            : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
     CSRK           : 68:B8:A7:F5:DC:3C:AE:B9:3B:F8:31:B5:2B:BD:F1:AF
    Dump(Rx):
    0000:04 FF 2C 00 06 00 4C 40 A0 0E 6C 54 FF 00 05 00 ..,...L@..lT....
    0010:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 ...............h
    0020:B8 A7 F5 DC 3C AE B9 3B F8 31 B5 2B BD F1 AF    ....<..;.1.+...
    --------------------------------------------------------------------
    [7] : <Tx> - 10:38:11.038
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE61 (GapInit_getPhyParam)
    -Data Length    : 0x02 (2) byte(s)
     PHY            : 0x01 (1) (INIT_PHY_1M)
     ParamId        : 0x02 (2) (INIT_PHYPARAM_CONN_INT_MIN)
    Dump(Tx):
    0000:01 61 FE 02 01 02                               .a....
    --------------------------------------------------------------------
    [8] : <Tx> - 10:38:11.049
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE61 (GapInit_getPhyParam)
    -Data Length    : 0x02 (2) byte(s)
     PHY            : 0x01 (1) (INIT_PHY_1M)
     ParamId        : 0x03 (3) (INIT_PHYPARAM_CONN_INT_MAX)
    Dump(Tx):
    0000:01 61 FE 02 01 03                               .a....
    --------------------------------------------------------------------
    [9] : <Tx> - 10:38:11.059
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE61 (GapInit_getPhyParam)
    -Data Length    : 0x02 (2) byte(s)
     PHY            : 0x01 (1) (INIT_PHY_1M)
     ParamId        : 0x04 (4) (INIT_PHYPARAM_CONN_LATENCY)
    Dump(Tx):
    0000:01 61 FE 02 01 04                               .a....
    --------------------------------------------------------------------
    [10] : <Tx> - 10:38:11.070
    -Type           : 0x01 (Command)
    -OpCode         : 0xFE61 (GapInit_getPhyParam)
    -Data Length    : 0x02 (2) byte(s)
     PHY            : 0x01 (1) (INIT_PHY_1M)
     ParamId        : 0x05 (5) (INIT_PHYPARAM_SUP_TIMEOUT)
    Dump(Tx):
    0000:01 61 FE 02 01 05                               .a....
    --------------------------------------------------------------------
    [11] : <Rx> - 10:38:11.070
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x09 (9) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (SUCCESS)
     OpCode         : 0xFE61 (GapInit_getPhyParam)
     DataLength     : 0x03 (3)
     ParamId        : 0x02 (2) (INIT_PHYPARAM_CONN_INT_MIN)
     MinConnectInter: 0x0050 (80)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 02 50 00             ......a...P.
    --------------------------------------------------------------------
    [12] : <Rx> - 10:38:11.092
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x09 (9) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (SUCCESS)
     OpCode         : 0xFE61 (GapInit_getPhyParam)
     DataLength     : 0x03 (3)
     ParamId        : 0x03 (3) (INIT_PHYPARAM_CONN_INT_MAX)
     MaxConnectInter: 0x0050 (80)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 03 50 00             ......a...P.
    --------------------------------------------------------------------
    [13] : <Rx> - 10:38:11.113
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x09 (9) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (SUCCESS)
     OpCode         : 0xFE61 (GapInit_getPhyParam)
     DataLength     : 0x03 (3)
     ParamId        : 0x04 (4) (INIT_PHYPARAM_CONN_LATENCY)
     ConnectLatency : 0x0000 (0)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 04 00 00             ......a.....
    --------------------------------------------------------------------
    [14] : <Rx> - 10:38:11.124
    -Type           : 0x04 (Event)
    -EventCode      : 0x00FF (HCI_LE_ExtEvent)
    -Data Length    : 0x09 (9) bytes(s)
     Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
     Status         : 0x00 (0) (SUCCESS)
     OpCode         : 0xFE61 (GapInit_getPhyParam)
     DataLength     : 0x03 (3)
     ParamId        : 0x05 (5) (INIT_PHYPARAM_SUP_TIMEOUT)
     SuperTimeout   : 0x07D0 (2000)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 05 D0 07             ......a.....
    --------------------------------------------------------------------
  • Hi Ammar,

    No worries i appreciate your response.

    One last thing do you have any sample code of HOSTTEst app for cc2642 chip with BLE 4.2 and working on SDK 1.50?
  • Unfortunately, we don't. The CC2642 should be backwards compatible with BLE 4.2 so there isn't a different version of the BLE5 stack example.

    There may be an error somewhere else if the device does not function as intended when running the BLE5 example.
  • OK

    Will analyze more and will get back to you.
  • Hi Ammar,

    Below are the command responses which we are getting from BTool(Version 1.42.08- BLE5). We are sending the same commands from our Linux code. We have used default CC2642R HostTest firmware (simplelink_cc26x2_sdk_2_20_00_36).  Our use case is we are enabling the peripheral mode from HostTest app and start advertising with some data. Same flow is working with cc2640r2f  BLE4.2 HostTest App code.

    But when we are trying same thing with the CC2642r HostTest (or CC2640r2f BLE5 HostTest App), device is returning below error.

    [1] : <Info> - 01:57:57.360
    Port opened at 10/10/2018 1:57:57 PM
    --------------------------------------------------------------------
    [2] : <Tx> - 01:57:57.516
    -Type : 0x01 (Command)
    -OpCode : 0xFC1D (HCIExt_ResetSystemCmd)
    -Data Length : 0x01 (1) byte(s)
    Type : 0x00 (0) (Chip Reset)
    Dump(Tx):
    0000:01 1D FC 01 00 .....
    --------------------------------------------------------------------
    [3] : <Rx> - 01:57:57.813
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x05 (5) bytes(s)
    Event : 0x041D (1053) (HCIExt_ResetSystemCmdDone)
    Status : 0x00 (0) (SUCCESS)
    CmdOpCode : 0xFC1D (HCIExt_ResetSystemCmd)
    Dump(Rx):
    0000:04 FF 05 1D 04 00 1D FC ........
    --------------------------------------------------------------------
    [4] : <Tx> - 01:57:58.391
    -Type : 0x01 (Command)
    -OpCode : 0xFE00 (GAP_DeviceInit)
    -Data Length : 0x08 (8) byte(s)
    ProfileRole : 0x08 (8) (
    Central)
    AddrMode : 0x00 (0) (ADDRMODE_PUBLIC)
    RandomAddr : 00:00:00:00:00:00
    Dump(Tx):
    0000:01 00 FE 08 08 00 00 00 00 00 00 00 ............
    --------------------------------------------------------------------
    [5] : <Rx> - 01:57:58.585
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x06 (6) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x00 (0) (SUCCESS)
    OpCode : 0xFE00 (GAP_DeviceInit)
    DataLength : 0x00 (0)
    Dump(Rx):
    0000:04 FF 06 7F 06 00 00 FE 00 .........
    --------------------------------------------------------------------
    [6] : <Rx> - 01:57:58.601
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x2C (44) bytes(s)
    Event : 0x0600 (1536) (GAP_DeviceInitDone)
    Status : 0x00 (0) (SUCCESS)
    DevAddr : F0:F8:F2:D2:B5:95
    DataPktLen : 0x00FF (255)
    NumDataPkts : 0x05 (5)
    IRK : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    CSRK : 7C:6D:37:BC:AF:67:63:38:69:AA:99:4B:5A:C6:77:5A
    Dump(Rx):
    0000:04 FF 2C 00 06 00 95 B5 D2 F2 F8 F0 FF 00 05 00 ..,.............
    0010:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7C ...............|
    0020:6D 37 BC AF 67 63 38 69 AA 99 4B 5A C6 77 5A m7..gc8i..KZ.wZ
    --------------------------------------------------------------------
    [7] : <Tx> - 01:57:58.648
    -Type : 0x01 (Command)
    -OpCode : 0xFE61 (GapInit_getPhyParam)
    -Data Length : 0x02 (2) byte(s)
    PHY : 0x01 (1) (INIT_PHY_1M)
    ParamId : 0x02 (2) (INIT_PHYPARAM_CONN_INT_MIN)
    Dump(Tx):
    0000:01 61 FE 02 01 02 .a....
    --------------------------------------------------------------------
    [8] : <Tx> - 01:57:58.679
    -Type : 0x01 (Command)
    -OpCode : 0xFE61 (GapInit_getPhyParam)
    -Data Length : 0x02 (2) byte(s)
    PHY : 0x01 (1) (INIT_PHY_1M)
    ParamId : 0x03 (3) (INIT_PHYPARAM_CONN_INT_MAX)
    Dump(Tx):
    0000:01 61 FE 02 01 03 .a....
    --------------------------------------------------------------------
    [9] : <Tx> - 01:57:58.694
    -Type : 0x01 (Command)
    -OpCode : 0xFE61 (GapInit_getPhyParam)
    -Data Length : 0x02 (2) byte(s)
    PHY : 0x01 (1) (INIT_PHY_1M)
    ParamId : 0x04 (4) (INIT_PHYPARAM_CONN_LATENCY)
    Dump(Tx):
    0000:01 61 FE 02 01 04 .a....
    --------------------------------------------------------------------
    [10] : <Tx> - 01:57:58.710
    -Type : 0x01 (Command)
    -OpCode : 0xFE61 (GapInit_getPhyParam)
    -Data Length : 0x02 (2) byte(s)
    PHY : 0x01 (1) (INIT_PHY_1M)
    ParamId : 0x05 (5) (INIT_PHYPARAM_SUP_TIMEOUT)
    Dump(Tx):
    0000:01 61 FE 02 01 05 .a....
    --------------------------------------------------------------------
    [11] : <Rx> - 01:57:58.710
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x09 (9) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x00 (0) (SUCCESS)
    OpCode : 0xFE61 (GapInit_getPhyParam)
    DataLength : 0x03 (3)
    ParamId : 0x02 (2) (INIT_PHYPARAM_CONN_INT_MIN)
    MinConnectInter: 0x0050 (80)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 02 50 00 ......a...P.
    --------------------------------------------------------------------
    [12] : <Rx> - 01:57:58.741
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x09 (9) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x00 (0) (SUCCESS)
    OpCode : 0xFE61 (GapInit_getPhyParam)
    DataLength : 0x03 (3)
    ParamId : 0x03 (3) (INIT_PHYPARAM_CONN_INT_MAX)
    MaxConnectInter: 0x0050 (80)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 03 50 00 ......a...P.
    --------------------------------------------------------------------
    [13] : <Rx> - 01:57:58.773
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x09 (9) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x00 (0) (SUCCESS)
    OpCode : 0xFE61 (GapInit_getPhyParam)
    DataLength : 0x03 (3)
    ParamId : 0x04 (4) (INIT_PHYPARAM_CONN_LATENCY)
    ConnectLatency : 0x0000 (0)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 04 00 00 ......a.....
    --------------------------------------------------------------------
    [14] : <Rx> - 01:57:58.804
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x09 (9) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x00 (0) (SUCCESS)
    OpCode : 0xFE61 (GapInit_getPhyParam)
    DataLength : 0x03 (3)
    ParamId : 0x05 (5) (INIT_PHYPARAM_SUP_TIMEOUT)
    SuperTimeout : 0x07D0 (2000)
    Dump(Rx):
    0000:04 FF 09 7F 06 00 61 FE 03 05 D0 07 ......a.....
    --------------------------------------------------------------------
    [15] : <Tx> - 01:58:32.440
    -Type : 0x01 (Command)
    -OpCode : 0x0C03 (HCI_Reset)
    -Data Length : 0x00 (0) byte(s)
    Dump(Tx):
    0000:01 03 0C 00 ....
    --------------------------------------------------------------------
    [16] : <Rx> - 01:58:32.487
    -Type : 0x04 (Event)
    -EventCode : 0x000E (HCI_CommandCompleteEvent)
    -Data Length : 0x04 (4) bytes(s)
    Packets : 0x01 (1)
    OpCode : 0x0C03 (HCI_Reset)
    Status : 0x00 (0) (SUCCESS)
    Dump(Rx):
    0000:04 0E 04 01 03 0C 00 .......
    --------------------------------------------------------------------
    [17] : <Tx> - 01:58:46.129
    -Type : 0x01 (Command)
    -OpCode : 0xFE00 (GAP_DeviceInit)
    -Data Length : 0x08 (8) byte(s)
    ProfileRole : 0x04 (4) (
    Peripheral)
    AddrMode : 0x00 (0) (ADDRMODE_PUBLIC)
    RandomAddr : 00:00:00:00:00:00
    Dump(Tx):
    0000:01 00 FE 08 04 00 00 00 00 00 00 00 ............
    --------------------------------------------------------------------
    [18] : <Rx> - 01:58:46.161
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (HCI_LE_ExtEvent)
    -Data Length : 0x06 (6) bytes(s)
    Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
    Status : 0x12 (18) (bleIncorrectMode)
    OpCode : 0xFE00 (GAP_DeviceInit)
    DataLength : 0x00 (0)
    Dump(Rx):
    0000:04 FF 06 7F 06 12 00 FE 00 .........
    --------------------------------------------------------------------

    Is there any commands which we are missing here? How do we enable Peripheral mode and start advertisement?

     

  • Hey Aditya,

    Thank you for sending me the log. After looking into this further, there are some build configurations that must be set to enable peripheral mode on the CC2640R2F.

    Please go to the ble5_host_test_cc2640r2lp_stack_library project, then to TOOLS, and open the build_config.opt file. Then comment out the central configuration line and include the peripheral config line, as shown below:

    /* BLE Host Build Configurations */
    -DHOST_CONFIG=PERIPHERAL_CFG
    /* -DHOST_CONFIG=CENTRAL_CFG */
    /* -DHOST_CONFIG=BROADCASTER_CFG */
    ...

    Once these changes are made, save the build_config.opt file. Then, clean the stack library project and build it. Do the same with the host test application project and program your CC2640R2F.

    When you open BTOOL, the device will fail to initialize in Central mode (as we've removed it from the build). Proceed by runing the HCIExt_ResetSystemCmd. Then run the GAP_DeviceInit command, making sure to change the profile role to enable the peripheralProfileRole. (You may have to reset the device and try again). Once you receive the SUCCESS confirmation, you can then proceed to enable advertisements by going to GAP AE, and sending the GapAdv_create command followed by the GapAdv_enable command.

    Please let me know if this works!

  • Hi Ammar,

    Thanks for help. With the above changes we are able to switch to peripheral mode properly.

  • Hi Ammar,

    For our use cases, we have switch from Host Test App code to simple peripheral code . We are using default simple peripheral code from sdk simplelink_cc26x2_sdk_2_20_00_36. As per our use case we need to update the scanRspData buffer during Advertisement. Device will receive data from UART and update the scanRspData from uart buffer. Through debugging we are able to check we are getting proper data from UART, but when we are trying to update the scanRspData device is getting hanged in Icall_abort loop.
    We have tried to update the advertisement packet using below code but device is getting hanged in Icall_abort function loop.

    // Scan Response Data
    static uint8_t scanRspData[22] =
    {
    // length of this data,
    // data type,
    // Data of 20 bytes
    };

    We have tried by enabling and disabling the DISABLE_ADV, but in every case device in getting hanged in GAP command. We are not even able to stop the advertisement by GapAdv_disable() API.

    case BLE_ADV:
    #ifdef DISABLE_ADV
    // Stop advertising since there is no room for more connections
    GapAdv_disable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
    GapAdv_disable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
    #endif

    // Disable advertising and prepare the buffer.
    status = GapAdv_prepareLoadByBuffer(ScanRspData, FALSE);
    SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);

    scanRspData[2] = 0x01;
    scanRspData[3] = 0x02;
    scanRspData[4] = 0x03;
    scanRspData[5] = 0x04;
    scanRspData[6] = 0x05;

    // Reload buffer and re-enable advertising
    status = GapAdv_loadByBuffer(sizeof(scanRspData), scanRspData);
    SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);
  • What does is the status after the prepareLoadByBuffer()/loadByBuffer() call? Make sure both GapAdv calls return success.

    Some things I would try are to verify you aren't overwriting the length/data type in the scanRspData array (as this is required by the BLE SIG). I don't think you need to disable advertising to update the scan response data.

    Another thing to try is to keep the scanRspData[] array as is (from the simple_peripheral example), and change it one byte at a time (keeping the size the same for now). Once you've confirmed you can update one byte, then start altering the size and the data in the packet.
  • Aditya,

    Do you have any updates? If you do, simply post a reply. Otherwise this thread will remain closed.
  • Hi Ammar,


    Thanks for help. We have solved the issue, device is getting hanged if we are calling GapAdv_prepareLoadByHandle in our defined function. But if we are calling GapAdv_prepareLoadByHandle API in GAP_EVT_ADV_START event then its working fine. We are able to update data successfully.

    case GAP_EVT_ADV_START:
    // Don't free anything since we're going to use the same buffer to re-load
    GapAdv_prepareLoadByHandle(advHandleLegacy, GAP_ADV_FREE_OPTION_DONT_FREE);

    //Update scanRspData buffer here.

    // Reload buffer to handle
    GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP, sizeof(scanRspData), scanRspData);
    break;