I am trying to get the hci_pwre_ctrl demo working with a nrf5340dk using nrfconnect 3.1. I got it running with a nrf52840dk and it works fine. I created a 2nd build for the nrf5340dk but am getting these errors:
[00:01:30.299,316] <inf> app: Set Tx power level to 0 [00:01:30.299,957] <wrn> bt_hci_core: opcode 0xfc0e status 0x01 [00:01:30.299,987] <err> app: Set Tx power err: -5
I have been trying to get the get_tx_power and set_tx_power working on a different build but was getting the same errors so I tried to simpliy and get it working on the base example first. My goal is to set and test ble range with various boards and configurations. I started with trying to read the value in the other build but am getting the same error. I saw this post hci_power_ctrl throws bt_hci_core: opcode 0xfc0f status 0x01 on my nRF5340 but did not see a solution.
Here was one change I made to support the nrf5340dk:
#ifdef CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP
static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {3, 0, -3, -8,-15, -18, -23, -30};
#else
static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,-15, -18, -23, -30};
#endifIn debugging I see this:
and the since the status=1 the -5 value is returned:
Here are some more log entries:
[00:20:27.732,666] <inf> app: Set Tx power level to 3 [00:20:27.732,666] <dbg> bt_hci_core: bt_hci_cmd_alloc: buf 0x200094e0 [00:20:27.732,696] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x200094e0 opcode 0xfc0e len 4 [00:20:27.732,696] <dbg> bt_hci_core: bt_hci_cmd_send: opcode 0xfc0e param_len 4 [00:20:27.732,727] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:27.732,757] <dbg> bt_hci_core: tx_processor: TX process start [00:20:27.732,757] <dbg> bt_hci_core: hci_core_send_cmd: fetch cmd [00:20:27.732,788] <dbg> bt_hci_core: hci_core_send_cmd: Sending command 0xfc0e (buf 0x200094e0) to driver [00:20:27.732,788] <dbg> bt_hci_core: bt_send: buf 0x200094e0 len 8 type 1 [00:20:27.732,818] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:27.732,849] <dbg> bt_hci_core: tx_processor: TX process start [00:20:27.733,337] <dbg> bt_hci_core: bt_recv_unsafe: buf 0x20009174 len 7 [00:20:27.733,367] <dbg> bt_hci_core: hci_cmd_status: opcode 0xfc0e [00:20:27.733,398] <dbg> bt_hci_core: hci_cmd_done: opcode 0xfc0e status 0x01 buf 0x20009174 [00:20:27.733,398] <dbg> bt_hci_core: hci_cmd_done: sync cmd released [00:20:27.733,428] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:27.733,489] <wrn> bt_hci_core: opcode 0xfc0e status 0x01 [00:20:27.733,489] <err> app: Set Tx power err: -5 [00:20:27.733,520] <dbg> bt_hci_core: tx_processor: TX process start [00:20:32.733,581] <inf> app: Get Tx power level -> [00:20:32.733,612] <dbg> bt_hci_core: bt_hci_cmd_alloc: buf 0x200094e0 [00:20:32.733,612] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x200094e0 opcode 0xfc0f len 3 [00:20:32.733,642] <dbg> bt_hci_core: bt_hci_cmd_send: opcode 0xfc0f param_len 3 [00:20:32.733,642] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:32.733,673] <dbg> bt_hci_core: tx_processor: TX process start [00:20:32.733,703] <dbg> bt_hci_core: hci_core_send_cmd: fetch cmd [00:20:32.733,703] <dbg> bt_hci_core: hci_core_send_cmd: Sending command 0xfc0f (buf 0x200094e0) to driver [00:20:32.733,703] <dbg> bt_hci_core: bt_send: buf 0x200094e0 len 7 type 1 [00:20:32.733,764] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:32.733,795] <dbg> bt_hci_core: tx_processor: TX process start [00:20:32.734,283] <dbg> bt_hci_core: bt_recv_unsafe: buf 0x20009174 len 7 [00:20:32.734,283] <dbg> bt_hci_core: hci_cmd_status: opcode 0xfc0f [00:20:32.734,344] <dbg> bt_hci_core: hci_cmd_done: opcode 0xfc0f status 0x01 buf 0x20009174 [00:20:32.734,344] <dbg> bt_hci_core: hci_cmd_done: sync cmd released [00:20:32.734,375] <dbg> bt_hci_core: bt_tx_irq_raise: kick TX [00:20:32.734,436] <wrn> bt_hci_core: opcode 0xfc0f status 0x01 [00:20:32.734,436] <err> app: Read Tx power err: -5



