Part Number: CC2642R
Other Parts Discussed in Thread: CC2640R2F
Tool/software: TI-RTOS
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.
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.
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,
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. 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;