LPRF BLE HCITester

From Texas Instruments Wiki
Jump to: navigation, search

Bluetooth Low Energy Wiki Main Page

HCI Tester

HCI Tester is a Windows PC scripting tool which will send/receive serial HCI packets to CC254X or CC2640/CC2650. This can be use to control a supported BLE device which is programmed with HostTestRelease hex file.
HCI Tester will work with the following configurations

  • PC to CC2540 USB Dongle
  • PC to CC254X EM on SmartRF board (over USB to Serial Cable)
  • PC to CC254X with UART pins connected
  • PC to CC2640 with UART pins connected (e.g., CC2650DK with COM port exposed via USB JTAG connection)

Overview

HCITesterDiagram1.png

Program USB Dongle and KeyFob

See QuickStart guide on how to program USB Dongle and KeyFob. QuickStartGuide
A prebuilt HostTestrelease hex can be found in the accessories folder.
<install>/BLE-CC254x-x.x.x/Accessories/HexFiles/CC2540_USBdongle_HostTestRelease_All.hex

A prebuilt SimpleBlePeripheral hex can be found in the accessories folder.
<install>/BLE-CC254x-x.x.x/Accessories/HexFiles/CC2540_SimpleBlePeripheral.hex

Download, Install and Configure HCI Tester

There is no official support for this tool, but you can download it from the WILINK-BT_WIFI-WIRELESS_TOOLS page.
One installed, you will need configure HCITester to point to the latest .XML library file. This file contains all of the supported HCI commands. Click on the middle icon in the Command Library pane to change HCI libraries.
File:HCITesterXML.zip
HCITesterDiagram2.png


Running HCI Tester

Once configured, goto menu and select com port.
Note for CC2640: Use "Flow Control" set to 'None' in the Serial Port setup menu.

HCITesterDiagram3.png

Download this script file which contains the central commands to discover, connect and pair with SimpleBlePeripheral running on the keyFob.
File:Central commands sbp.zip


HCITester with script loaded.
HCITesterDiagram4.png


If using keyFob loaded with SimpleBlePeripheral, advertise by pressing right button. After this, press the "go" button on HCITester to run the script.


Script Listing

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, , , , , 

Log File

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 --