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.

CC2340R5: HCI command for BLE controller example project

Part Number: CC2340R5

Tool/software:

hi Expert,

Can I use BLUEZ hcitool to set and read the tx power with hci command to BLE_controller example project?

There is BLE specific HCI commands below for read and set tx power as below. Can it support in BLE_controller example project?

BT Commands for LE

OGF

OCF

Opcode

Read Transmit Power Level

3

45

0x0C2D

 

Vendor Specific Command

OGF

CSG

CMD

Opcode

HCI_EXT_SetTxPowerCmd

63

0

1

0xFC01

HCI_EXT_SetMaxDtmTxPowerCmd

63

0

17

0xFC11

How can I send the hcitool command? Below is correct?

root@OpenWrt:/tmp# hcitool -i hci0 cmd 0x03 0x002D
< HCI Command: ogf 0x03, ocf 0x002d, plen 0
> HCI Event: 0x0e plen 7
01 2D 0C 00 02 02 00
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# hcitool -i hci0 cmd 0x3F 0x0011 0x00 0x02
< HCI Command: ogf 0x3f, ocf 0x0011, plen 2
00 02
> HCI Event: 0x0e plen 4
01 11 FC 01
root@OpenWrt:/tmp#
root@OpenWrt:/tmp#
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# hcitool -i hci0 cmd 0x03 0x002D
< HCI Command: ogf 0x03, ocf 0x002d, plen 0
> HCI Event: 0x0e plen 7
01 2D 0C 00 00 02 00

BR,

frank

  • Hello Frank,

    You can use the controller only solution with a host app such as BTool or BlueZ (linux). What is the purpose, is it RF/BLE testing or a host-controller full solution?

    You can try the commands using BTool: C:\ti\simplelink_lowpower_f3_sdk_9_11_00_18\tools\ble\btool 

    You can also simply use a script to transmit the TX dump from a host (PC for example) to the controller, like:

    import serial
    import time
    
    # === CONFIGURE UART ===
    UART_PORT = "COM177"  # Adjust based on your system (e.g., COM3 on Windows)
    BAUD_RATE = 115200 # High baud rate for fast communication
    
    # Open UART connection
    uart = serial.Serial(UART_PORT, BAUD_RATE)
    
    def send_hci_command(command_hex):
        """Send an HCI command to the CC23xx over UART."""
        command_bytes = bytes.fromhex(command_hex)
        uart.write(command_bytes)
        time.sleep(0.05)
        response = uart.read(uart.in_waiting)
        print(f"HCI Response: {response.hex()}")
    
    # === SETUP HCI TEST ===
    def test_hci_ble():
        print("Testing HCI Commands")
    
        # Clear Adv Sets
        # Send_HCI_LE_ClearAdvSetCmd
        # Wait_HCI_Command_Complete_LE_ClearAdvSetCmd_Event 5000, any, HCI_LE_ClearAdvSetCmd, 0x00
        send_hci_command("01 02 20 00")
    
        # BD_ADDR = "DD:9A:78:56:34:12"
        # Create Adv Set 0
        # Send_HCI_LE_SetExtAdvParamsCmd 0, 0x0013, 50, 50, 0x07, 0x00, 0x00, BD_ADDR, 0x00, 127, 0x01, 0x0, 0x01, 0x00, 0x00
        # Wait_HCI_Command_Complete_LE_SetExtAdvParamsCmd_Event 5000, any, HCI_LE_SetExtAdvParamsCmd, 0x00, 
        send_hci_command("01 36 20 19 00 13 00 32 00 00 32 00 00 07 00 00 12 34 56 78 9a dd 00 7f 01 00 01 00 00")
    
        # Set Adv Data 0
        # Send_HCI_LE_SetExtAdvDataCmd 0x00, 0x03, 0x00, 0x10, "00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F"
        # Wait_HCI_Command_Complete_LE_SetExtAdvDataCmd_Event 5000, any, HCI_LE_SetExtAdvDataCmd, 0x00
        send_hci_command("01 37 20 14 00 03 00 10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f")
    
        # Enable advertising
        # Send_HCI_LE_SetExtAdvEnableCmd 0x01, 0x01, 0, "00:00", 0
        # Wait_HCI_Command_Complete_LE_SetExtAdvEnableCmd_Event 5000, any, HCI_LE_SetExtAdvEnableCmd, 0x00
        send_hci_command("01 39 20 06 01 01 00 00 00 00")
    
        # Send_HCI_EXT_NumComplPktsLimitCmd 2, 0
        #send_hci_command("01 1f fc 02 01 00")
    
        # Send_HCI_LE_Read_Buffer_Size
        send_hci_command("01 02 20 00")
    
        time.sleep(4)
    
        #HCI_LE_SetPhy
        send_hci_command("01 32 20 07 00 00 00 02 02 00 00")
    
        while (1):
            time.sleep(0)
            send_hci_command("02 00 00 78 00 00 11 22 33 44 00 11 22 33 44 00 11 22 33 44 00 11 22 33 44 00 11 22 33 44 00 11 22 33 44")
    
    # === MAIN EXECUTION ===
    test_hci_ble()

    BR,

    David