How to setting TX power through HCI command?

Hi Sir,

We reference example "/nrf/samples/bluetooth/hci_uart" and test on nRF52833.

Now we want to set the Tx power by sending appropriate HCI commands from the host.

We tried the below command but got an error.

"hcitool -a hci0 inqtpl 4"

Can't set inquiry transmit power level on hci0: Input/output error (5)

Could you share the command for how to set the TX power level?

Thank you.

BRs, Han

Parents Reply Children
  • Hi,

    Have you tried the second option?

    Best regards,

    Dejan

  • Hi Dejan,

    The result of second option as below. And I can see the "success" from "btmon".

    But what is the result stand for?

    And which command can set the tx power?

    # Terminal

    # btmon

    Thank you.

    BRs, Han

  • Hi,

    The ogf part of the opcode has 6 bits and it denotes the opcode group field. In your case 0x3f is reserved for vendor specific command. The ocf part has 10 bits and it is known as opcode command field. A Command Complete HCI Event specifies the corresponding Vendor specific debug command opcode. For more information, please refer to the bluetooth specification.

    One good explanation of the hcitool command output can be found here

    Setting the transmit power value is vendor specific command. Please check hci_zephyr and hci_softdevice.

    There is also an example in zephyr\samples\bluetooth\hci_pwr_ctrl.

    Best regards,
    Dejan

  • Hi, 

    As said previously, please note that hcitool is deprecated in BlueZ and should not be used anymore. Instead, you should use bluetoothctl tool.

    For BlueZ related questions, please consider joining BlueZ mailing list.

    Best regards,
    Dejan

  • Hi Dejans,

    Unfortunately, I cannot set the tx power from "Write Tx Power Level" and also from bluetoothctl command.

    Below is the test result.

    Sorry that I'm not familiar w/ hci tool, could you share the hint which step or concept I missed.

    1. Write TX power, but got fail return "unknow hci command".

        sudo hciattach -s 115200 /dev/ttyACM0 any 115200 noflow nosleep

        sudo hciconfig hci0 up // bring up device

        sudo hciconfig hci0

        sudo hcitool -i hci0 cmd 0x3f 0x000e 0x00 0x6461 4 //set tx power level 4

        sudo hcitool -i hci0 cmd 0x3f 0x000e 0x02 0x6461 4

    2. bluetoothctl

    I tried to use "bluetootlctl", but i cannot find the parameter for tx power level setting from help.

    Does the command of tx power level has been hidden? or this is a sub command?

    Thank you.

    BRs, Hanyu

Related