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.

[参考译文] LPRF BLE HCITester

Guru**** 1127450 points
Other Parts Discussed in Thread: CC2640, CC2650, CC2540, LAUNCHXL-CC2640R2, CC2640R2F, LAUNCHXL-CC26X2R1
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/962602/lprf-ble-hcitester

主题中讨论的其他器件:CC2640CC2650CC2540LAUNCHXL-CC2640R2CC2640R2FLAUNCHXL-CC26X2R1

HCI 测试仪

HCI 测试仪是一款 Windows PC 脚本工具、可向 CC254X 或 CC2640/CC2650发送/接收串行 HCI 数据包。 这可用于控制支持的 BLE 器件、该器件使用 HostTestRelease 十六进制文件进行编程。
HCI 测试仪将使用以下配置

  • PC 到 CC2540 USB 软件狗
  • SmartRF 板上的 PC 到 CC254X EM (通过 USB 转串行电缆)
  • 连接 UART 引脚的 PC 到 CC254X
  • 连接 UART 引脚的 PC 到 CC2640 (例如、通过 USB JTAG 连接暴露 COM 端口的 CC2650DK)
  • 连接 UART 引脚的 PC 到 CC2640R2F (例如、通过 XDS110连接暴露 COM 端口的 LAUNCHXL-CC2640R2)
  • 连接 UART 引脚的 PC 到 CC26x2 (例如、通过 XDS110连接暴露 COM 端口的 LAUNCHXL-CC26X2R1)

概述

 HCITesterDiagram1.png

对 USB 软件狗、密钥卡或 Launchpad 进行编程

请参阅快速入门指南、了解如何对 USB 软件狗和密钥卡进行编程。 快速入门指南
预构建的 HostTestrelease hex 可以在 Accessories 文件夹中找到。
/BLE-CC254x-x.x.x/Accessories/HexFiles\CC2540_USBdongle_HostTestRelease_All.hex

预构建的 SimpleBlePeripheral 十六进制文件可在 Accessories 文件夹中找到。
/BLE-CC254x-x.x.x.x/Accessories/HexFiles/CC2540_SimpleBlePeripheral.hex

对于 CC2640R2和 CC26x2器件、您可以使用 host_test 示例。 您的 SDK 中提供了预构建的十六进制文件。

下载、安装和配置 HCI 测试仪

此工具没有官方支持、但您可以从 WiLink-BT_WIFI-WIRELESS_TOOLS 页面下载。
安装后、您需要配置 HCITester 以指向最新的.XML 库文件。 此文件包含所有支持的 HCI 命令。 单击"Command Library"窗格中的中间图标以更改 HCI 库。
以下是适用于相应 BLE 无线多路复用器和支持的协议栈版本的 HCITester 库文件:
CC254x:

e2e.ti.com/.../20170119182836_2100_HCITesterXML.zip

CC26xx:

e2e.ti.com/.../20171128003351_2100_HCITesterXML.zip

e2e.ti.com/.../7167.HCITesterXML.zip

CC2640R2和 CC26x2:

e2e.ti.com/.../Tester_5F00_HCILib_5F00_blestack_5F00_3_5F00_x.xml

e2e.ti.com/.../Tester_5F00_HCILib_5F00_ble5stack_5F00_2_5F00_02_5F00_00_5F00_00.xml

运行 HCI 测试仪

配置完成后、转到菜单并选择 COM 端口。
CC2640注意事项:使用"Flow Control"设置为"None (无)"(在串行端口设置菜单中)。



下载此脚本文件、其中包含用于查找、连接和与密钥卡上运行的 SimpleBlePeripheral 配对的中央命令。

e2e.ti.com/.../Central_5F00_commands_5F00_sbp.zip


已加载脚本的 HCITester。

如果使用装有 SimpleBlePeripheral 的密钥卡、请按右按钮进行广播。 之后、按下 HCITester 上的"Go"按钮以运行脚本。

脚本列表

Sctipt
ClearTrace
Send_HCI_Reset
sleep (2000)
#init
Send_GAP_DeviceInit 8, 3, 0, 0, 1
Wait_HCI_Vendor_Specific_Event 5000, 0x67f, , , 
Wait_HCI_Vendor_Specific_Event 5000, 0x600, , , , , , 
#scan for 5 seconds
Send_GAP_SetParam 2, 10000 
Wait_HCI_Vendor_Specific_Event 5000, 0x67f, , , 
#start scan
Send_GAP_DeviceDiscoveryRequest 0x03, 0x00, 0
#wait for scan to complete
OnEventWait_HCI_Vendor_Specific_Event 10000, 0x601, , 
OnTimeout
ClearTimeout
OnMismatch
ClearMismatch
RestartEvent
End Event
WaitForAllEvents 12000, True
ClearAllEvents
#establish link
Send_GAP_EstablishLinkReq 0, 0, 0, "3C:2D:B7:84:0D:A5" 
Wait_HCI_Vendor_Specific_Event 5000, 0x67f, , ,
Wait_HCI_Vendor_Specific_Event 10000, 0x605, , , , , , , , 
#pair
Send_GAP_Authenticate 0, 0x03, 0, "4d:9f:88:5a:6e:03:12:fe:00:00:00:00:00:00:00:00", 0x00, 16, 63, 0, 0x03, 0, 0x00, 16, 63
Wait_HCI_Vendor_Specific_Event 10000, 0x67f, , ,
Wait_HCI_Vendor_Specific_Event 10000, 0x60a, , , , , , , , , , , , , , , , , , , 
#linkParamUpdate
Wait_HCI_Vendor_Specific_Event 10000, 0x607, , , , , 

日志文件

13:27:21.257 --
13:27:21.257 Packet "GAP_DeviceInit", Opcode 0xfe00
13:27:21.257 Parameters:
13:27:21.257 | profileRole      : 8 (GAP_PROFILE_CENTRAL)
13:27:21.257 | maxScanResponses : 3
13:27:21.257 | IRK              : "0"
13:27:21.257 | CSRK             : "0"
13:27:21.257 | signCounter      : 1
13:27:21.257 --
13:27:21.257 Outgoing Dump:
13:27:21.257     0000: 01 00 fe 26 08 03 00 00 00 00 00 00 00 00 00 00 ...&............
13:27:21.257     0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
13:27:21.257     0020: 00 00 00 00 00 00 01 00 00 00                   ..........
13:27:21.261 Incoming Dump:
13:27:21.261     0000: 04 ff 06 7f 06 00 00 fe 00                      .........
13:27:21.288 --
13:27:21.288 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:21.306 Parameters:
13:27:21.306 | Event Opcode : 0x067f (CommandStatus)
13:27:21.306 | Status       : 0x00 (SUCCESS)
13:27:21.306 | opCode       : 0xfe00 (GAP_DeviceInit)
13:27:21.306 | dataLen      : 0x00
13:27:21.306 --
13:27:21.320 Incoming Dump:
13:27:21.320     0000: 04 ff 2c 00 06 00 07 7e 70 e5 c5 78 1b 00 04 15 ..,....~p..x....
13:27:21.320     0010: ce 86 0f 2b 63 f9 5d 50 c2 32 bf ec 94 f5 4e d8 ...+c.]P.2....N.
13:27:21.320     0020: 21 aa 99 d1 3e 7a 5c a8 62 f1 bd c0 04 ef 93    !...>z\.b......
13:27:21.335 --
13:27:21.335 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:21.351 Parameters:
13:27:21.351 | Event Opcode : 0x0600 (GAP_DeviceInitDone)
13:27:21.351 | Status       : 0x00 (SUCCESS)
13:27:21.351 | devAddr      : "78:C5:E5:70:7E:07"
13:27:21.351 | dataPktLen   : 0x001b
13:27:21.351 | numDataPkts  : 0x04
13:27:21.351 | IRK          : "15:CE:86:0F:2B:63:F9:5D:50:C2:32:BF:EC:94:F5:4E"
13:27:21.351 | CSRK         : "D8:21:AA:99:D1:3E:7A:5C:A8:62:F1:BD:C0:04:EF:93"
13:27:21.351 --
13:27:21.365 --
13:27:21.365 Packet "GAP_SetParam", Opcode 0xfe30
13:27:21.365 Parameters:
13:27:21.365 | paramID    : 2 (TGAP_GEN_DISC_SCAN)
13:27:21.365 | paramValue : 10000
13:27:21.365 --
13:27:21.365 Outgoing Dump:
13:27:21.365     0000: 01 30 fe 03 02 10 27                            .0....'
13:27:21.367 Incoming Dump:
13:27:21.367     0000: 04 ff 06 7f 06 00 30 fe 00                      ......0..
13:27:21.384 --
13:27:21.384 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:21.399 Parameters:
13:27:21.399 | Event Opcode : 0x067f (CommandStatus)
13:27:21.399 | Status       : 0x00 (SUCCESS)
13:27:21.399 | opCode       : 0xfe30 (GAP_SetParam)
13:27:21.399 | dataLen      : 0x00
13:27:21.399 --
13:27:21.410 --
13:27:21.410 Packet "GAP_DeviceDiscoveryRequest", Opcode 0xfe04
13:27:21.410 Parameters:
13:27:21.410 | mode       : 0x03 (DEVDISC_MODE_ALL)
13:27:21.410 | activeScan : 0x00 (Disabled)
13:27:21.410 | whiteList  : 0 (Disabled)
13:27:21.411 --
13:27:21.411 Outgoing Dump:
13:27:21.411     0000: 01 04 fe 03 03 00 00                            .......
13:27:21.415 Incoming Dump:
13:27:21.415     0000: 04 ff 06 7f 06 00 04 fe 00                      .........
13:27:21.429 --
13:27:21.430 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:21.443 Parameters:
13:27:21.443 | Event Opcode : 0x067f (CommandStatus)
13:27:21.443 | Status       : 0x00 (SUCCESS)
13:27:21.443 | opCode       : 0xfe04 (GAP_DeviceDiscoveryRequest)
13:27:21.443 | dataLen      : 0x00
13:27:21.443 --
13:27:21.576 Incoming Dump:
13:27:21.577     0000: 04 ff 14 0d 06 00 00 00 6b d6 e3 14 33 88 bb 07 ........k...3...
13:27:21.577     0010: 02 01 06 03 02 f0 ff                            .......
13:27:21.600 --
13:27:21.600 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:21.610 Parameters:
13:27:21.610 | Event Opcode : 0x060d (GAP_DeviceInformation)
13:27:21.610 | Status       : 0x00 (SUCCESS)
13:27:21.610 | eventTypes   : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:21.610 | addrType     : 0x00 (ADDRTYPE_PUBLIC)
13:27:21.610 | addr         : "88:33:14:E3:D6:6B"
13:27:21.610 | rssi         : -69
13:27:21.610 | dataLen      : 0x07
13:27:21.610 | dataField    : "02:01:06:03:02:F0:FF"
13:27:21.610 --
13:27:24.016 Incoming Dump:
13:27:24.016     0000: 04 ff 14 0d 06 00 00 00 a5 0d 84 b7 2d 3c d5 07 ............-<..
13:27:24.016     0010: 02 01 06 03 02 f0 ff                            .......
13:27:24.042 --
13:27:24.042 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:24.063 Parameters:
13:27:24.063 | Event Opcode : 0x060d (GAP_DeviceInformation)
13:27:24.063 | Status       : 0x00 (SUCCESS)
13:27:24.063 | eventTypes   : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:24.063 | addrType     : 0x00 (ADDRTYPE_PUBLIC)
13:27:24.063 | addr         : "3C:2D:B7:84:0D:A5"
13:27:24.063 | rssi         : -43
13:27:24.063 | dataLen      : 0x07
13:27:24.063 | dataField    : "02:01:06:03:02:F0:FF"
13:27:24.063 --
13:27:28.602 Incoming Dump:
13:27:28.602     0000: 04 ff 28 0d 06 00 00 01 de bc 22 2d 9f c7 a7 1b ..(......."-....
13:27:28.602     0010: 02 01 06 11 06 ba 56 89 a6 fa bf a2 bd 01 46 7d ......V.......F}
13:27:28.602     0020: 6e 56 63 ab ad 05 16 0a 18 08 04                nVc........
13:27:28.612 --
13:27:28.612 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:28.627 Parameters:
13:27:28.627 | Event Opcode : 0x060d (GAP_DeviceInformation)
13:27:28.627 | Status       : 0x00 (SUCCESS)
13:27:28.627 | eventTypes   : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:28.627 | addrType     : 0x01 (ADDRTYPE_STATIC)
13:27:28.627 | addr         : "C7:9F:2D:22:BC:DE"
13:27:28.627 | rssi         : -89
13:27:28.627 | dataLen      : 0x1b
13:27:28.627 | dataField    : "02:01:06:11:06:BA:56:89:A6:FA:BF:A2:BD:01:46:7D:6E:56:63:AB:AD:05:16:0A:18:08:04"
13:27:28.627 --
13:27:31.415 Incoming Dump:
13:27:31.415     0000: 04 ff 1c 01 06 00 03 00 00 6b d6 e3 14 33 88 00 .........k...3..
13:27:31.415     0010: 00 a5 0d 84 b7 2d 3c 00 01 de bc 22 2d 9f c7    .....-<...."-..
13:27:31.425 --
13:27:31.425 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:31.434 Parameters:
13:27:31.434 | Event Opcode : 0x0601 (GAP_DeviceDiscovery)
13:27:31.434 | Status       : 0x00 (SUCCESS)
13:27:31.434 | numDevs      : 0x03
13:27:31.434 | eventType    : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:31.434 | addrType     : 0x00 (ADDRTYPE_PUBLIC)
13:27:31.434 | addr         : "88:33:14:E3:D6:6B"
13:27:31.434 | eventType    : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:31.434 | addrType     : 0x00 (ADDRTYPE_PUBLIC)
13:27:31.434 | addr         : "3C:2D:B7:84:0D:A5"
13:27:31.434 | eventType    : 0x00 (GAP_ADRPT_ADV_IND - Connectable undirected)
13:27:31.434 | addrType     : 0x01 (ADDRTYPE_STATIC)
13:27:31.434 | addr         : "C7:9F:2D:22:BC:DE"
13:27:31.434 --
13:27:31.444 --
13:27:31.444 Packet "GAP_EstablishLinkReq", Opcode 0xfe09
13:27:31.445 Parameters:
13:27:31.445 | highDutyCycle : 0 (Disabled)
13:27:31.445 | whiteList     : 0 (Disabled)
13:27:31.445 | addrTypePeer  : 0 (ADDRTYPE_PUBLIC)
13:27:31.445 | peerAddr      : "3C:2D:B7:84:0D:A5"
13:27:31.445 --
13:27:31.445 Outgoing Dump:
13:27:31.445     0000: 01 09 fe 09 00 00 00 a5 0d 84 b7 2d 3c          ...........-<
13:27:31.451 Incoming Dump:
13:27:31.451     0000: 04 ff 06 7f 06 00 09 fe 00                      .........
13:27:31.463 --
13:27:31.464 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:31.476 Parameters:
13:27:31.476 | Event Opcode : 0x067f (CommandStatus)
13:27:31.476 | Status       : 0x00 (SUCCESS)
13:27:31.476 | opCode       : 0xfe09 (GAP_EstablishLinkReq)
13:27:31.476 | dataLen      : 0x00
13:27:31.476 --
13:27:31.614 Incoming Dump:
13:27:31.614     0000: 04 ff 13 05 06 00 00 a5 0d 84 b7 2d 3c 00 00 50 ...........-<..P
13:27:31.614     0010: 00 00 00 d0 07 00                               ......
13:27:31.624 --
13:27:31.624 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:31.634 Parameters:
13:27:31.633 | Event Opcode        : 0x0605 (GAP_LinkEstablished)
13:27:31.634 | Status              : 0x00 (SUCCESS)
13:27:31.634 | Device Address Type : 0x00 (ADDRTYPE_PUBLIC)
13:27:31.634 | Device Address      : "3C:2D:B7:84:0D:A5"
13:27:31.634 | connectionHandle    : 0x0000
13:27:31.634 | connInterval        : 0x0050
13:27:31.634 | connLatency         : 0x0000
13:27:31.634 | connTimeout         : 0x07d0
13:27:31.634 | clockAccuracy       : 0x00
13:27:31.634 --
13:27:31.643 --
13:27:31.643 Packet "GAP_Authenticate", Opcode 0xfe0b
13:27:31.644 Parameters:
13:27:31.643 | connectionHandle      : 0
13:27:31.643 | secReq.ioCaps         : 0x03 (NoInputNoOutput)
13:27:31.643 | secReq.oobAvailable   : 0 (Disabled)
13:27:31.644 | secReq.oob            : "4d:9f:88:5a:6e:03:12:fe:00:00:00:00:00:00:00:00"
13:27:31.644 | secReq.authReq        : 0x00
13:27:31.644 | secReq.maxEncKeySize  : 16
13:27:31.644 | secReq.keyDist        : 63 (sEncKey|sIdKey|sSign|mEncKey|mIdKey|mSign)
13:27:31.644 | pairReq.Enable        : 0 (Disabled)
13:27:31.644 | pairReq.ioCaps        : 0x03 (NoInputNoOutput)
13:27:31.644 | pairReq.oobDataFlag   : 0 (Disabled)
13:27:31.644 | pairReq.authReq       : 0x00
13:27:31.644 | pairReq.maxEncKeySize : 16
13:27:31.644 | pairReq.keyDist       : 63 (sEncKey|sIdKey|sSign|mEncKey|mIdKey|mSign)
13:27:31.644 --
13:27:31.644 Outgoing Dump:
13:27:31.644     0000: 01 0b fe 1d 00 00 03 00 4d 9f 88 5a 6e 03 12 fe ........M..Zn...
13:27:31.644     0010: 00 00 00 00 00 00 00 00 00 10 3f 00 03 00 00 10 ..........?.....
13:27:31.644     0020: 3f                                              ?
13:27:31.647 Incoming Dump:
13:27:31.647     0000: 04 ff 06 7f 06 00 0b fe 00                      .........
13:27:31.658 --
13:27:31.658 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:31.667 Parameters:
13:27:31.667 | Event Opcode : 0x067f (CommandStatus)
13:27:31.667 | Status       : 0x00 (SUCCESS)
13:27:31.667 | opCode       : 0xfe0b (GAP_Authenticate)
13:27:31.667 | dataLen      : 0x00
13:27:31.667 --
13:27:33.922 Incoming Dump:
13:27:33.922     0000: 04 ff 6a 0a 06 00 00 00 00 01 10 ce e8 5c d6 d1 ..j..........\..
13:27:33.922     0010: 39 59 df e1 79 86 0b 28 60 2a 9e 5d fa e3 81 56 9Y..y..(`*.]...V
13:27:33.922     0020: c8 a1 7c 62 7b 01 10 13 c2 a5 8c 62 78 de 2b b9 ..|b{......bx.+.
13:27:33.922     0030: 5a a7 71 92 3b 0d ef c6 d0 39 5c bf 51 d7 31 69 Z.q.;....9\.Q.1i
13:27:33.922     0040: 9f 01 8f 17 18 25 65 8a 6e 68 de 2e 89 1a f8 a5 .....%e.nh......
13:27:33.922     0050: a3 82 a5 0d 84 b7 2d 3c 01 43 07 44 f0 94 33 ad ......-<.C.D..3.
13:27:33.922     0060: 6f e2 7e 36 4b af 94 32 bd ff ff ff ff          o.~6K..2.....
13:27:33.940 --
13:27:33.940 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:33.952 Parameters:
13:27:33.952 | Event Opcode            : 0x060a (GAP_AuthenticationComplete)
13:27:33.952 | Status                  : 0x00 (SUCCESS)
13:27:33.952 | connectionHandle        : 0x0000
13:27:33.952 | authState               : 0x00
13:27:33.952 | securityInfo            : 0x01 (Enabled)
13:27:33.952 | securityInfo.LTKsize    : 0x10
13:27:33.952 | securityInfo.LTK        : "CE:E8:5C:D6:D1:39:59:DF:E1:79:86:0B:28:60:2A:9E"
13:27:33.952 | securityInfo.DIV        : 0xfa5d
13:27:33.952 | securityInfo.rand       : "E3:81:56:C8:A1:7C:62:7B"
13:27:33.952 | devSecInfo              : 0x01 (Enabled)
13:27:33.952 | devSecInfo.LTKsize      : 0x10
13:27:33.952 | devSecInfo.LTK          : "13:C2:A5:8C:62:78:DE:2B:B9:5A:A7:71:92:3B:0D:EF"
13:27:33.952 | devSecInfo.DIV          : 0xd0c6
13:27:33.952 | devSecInfo.rand         : "39:5C:BF:51:D7:31:69:9F"
13:27:33.952 | identityInfo            : 0x01 (Enabled)
13:27:33.952 | identityInfo.IRK        : "8F:17:18:25:65:8A:6E:68:DE:2E:89:1A:F8:A5:A3:82"
13:27:33.952 | identityInfo.BD_ADDR    : "3C:2D:B7:84:0D:A5"
13:27:33.952 | signingInfo             : 0x01 (Enabled)
13:27:33.952 | signingInfo.CSRK        : "43:07:44:F0:94:33:AD:6F:E2:7E:36:4B:AF:94:32:BD"
13:27:33.952 | signingInfo.signCounter : 0xffffffff
13:27:33.952 --
13:27:38.334 Incoming Dump:
13:27:38.334     0000: 04 ff 0b 07 06 00 00 00 20 03 00 00 e8 03       ........ .....
13:27:38.344 --
13:27:38.344 Packet "HCI_Vendor_Specific_Event", Opcode 0x00ff
13:27:38.353 Parameters:
13:27:38.353 | Event Opcode     : 0x0607 (GAP_LinkParamUpdate)
13:27:38.353 | Status           : 0x00 (Success)
13:27:38.353 | connectionHandle : 0x0000
13:27:38.353 | connInterval     : 0x0320
13:27:38.353 | connLatency      : 0x0000
13:27:38.353 | connTimeout      : 0x03e8
13:27:38.353 --
13:27:38.366 --
13:27:38.366 *** Script End ***
13:27:38.366 --

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如对此主题有任何疑问、请点击黄色按钮、在本页右上角提出相关问题。