Failed to get/set TX power to NRF5340 as \v1.8.0\zephyr\samples\bluetooth\hci_pwr_ctrl

Hi 

As title. Thanks.

Jeffery

Parents
  • Hi Priyanka

    I tested github hci_pwr_ctrl sample you shared to me. Copied this sample at SDK Connect folder

    ( \TOOLCHAIN\v1.8.0\zephyr\samples\bluetooth)

    Then, compiled this sample with DK NRF52840 and DK NRF5340 both.

    NRF52840 DK can work get/set TX power. 

    NRF5340 DK cannot work get/set TX power.

    TX power levels were selected {0, -8, -20} . Both IC can support this levels according to spec .

    Please double check. Attachments are uart log results.

    The log: Reboot DK--> Connected-->Disconnected.

    *** Booting Zephyr OS build v2.7.0-ncs1  ***
    Starting Dynamic Tx Power Beacon Demo
    Bluetooth initialized
    Dynamic Tx power Beacon started
    Get Tx power level ->-> default TXP = 0
    [00:00:00.007,537] <inf> sdc_hci_driver: SoftDevice Controller build revision: 
                                             df c0 4e d6 1f 7c 66 09  0a f5 2b a0 98 f2 43 64 |..N..|f. ..+...Cd
                                             62 c5 a6 2a                                      |b..*             
    [00:00:00.010,345] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.010,345] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.010,345] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 223.20160 Build 1719410646
    [00:00:00.011,444] <inf> bt_hci_core: Identity: E1:E8:60:DB:79:9B (random)
    [00:00:00.011,444] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x12b0, manufacturer 0x0059
    [00:00:00.011,444] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x12b0
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Connected via connection (0) at 7B:30:AF:35:30:7D (random)
    Connection (0) - Initial Tx Power = 0
    Actual Tx Power: 0
    Connection (0) - Tx Power = 0
    Get Tx power level -> TXP = 0
    Connected (0) - RSSI = -47
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -48
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -47
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -49
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -48
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -47
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -49
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -46
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Connected (0) - RSSI = -50
    Adaptive Tx power selected = -20
    Actual Tx Power: -20
    Connection (0) TXP = -20
    Disconnected (reason 0x13)
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -4
    Get Tx power level -> TXP = -4
    Set Tx power level to -8
    Actual Tx Power: -8
    
    *** Booting Zephyr OS build v2.7.0-ncs1  ***
    Flash regions		Domain		Permissions
    00 03 0x00000 0x10000 	Secure		rwxl
    04 63 0x10000 0x100000 	Non-Secure	rwxl
    
    Non-secure callable region 0 placed in flash region 2 with size 32.
    
    SRAM region		Domain		Permissions
    00 03 0x00000 0x08000 	Secure		rwxl
    04 63 0x08000 0x80000 	Non-Secure	rwxl
    
    Peripheral		Domain		Status
    00 NRF_P0               Non-Secure	OK
    01 NRF_CLOCK            Non-Secure	OK
    02 NRF_RTC0             Non-Secure	OK
    03 NRF_RTC1             Non-Secure	OK
    04 NRF_NFCT             Non-Secure	OK
    05 NRF_NVMC             Non-Secure	OK
    06 NRF_UARTE1           Non-Secure	OK
    07 NRF_UARTE2           Secure		SKIP
    08 NRF_TWIM2            Non-Secure	OK
    09 NRF_SPIM3            Non-Secure	OK
    10 NRF_TIMER0           Non-Secure	OK
    11 NRF_TIMER1           Non-Secure	OK
    12 NRF_TIMER2           Non-Secure	OK
    13 NRF_SAADC            Non-Secure	OK
    14 NRF_PWM0             Non-Secure	OK
    15 NRF_PWM1             Non-Secure	OK
    16 NRF_PWM2             Non-Secure	OK
    17 NRF_PWM3             Non-Secure	OK
    18 NRF_IPC              Non-Secure	OK
    19 NRF_VMC              Non-Secure	OK
    20 NRF_FPU              Non-Secure	OK
    21 NRF_EGU0             Non-Secure	OK
    22 NRF_EGU1             Non-Secure	OK
    23 NRF_EGU2             Non-Secure	OK
    24 NRF_EGU3             Non-Secure	OK
    25 NRF_EGU4             Non-Secure	OK
    26 NRF_EGU5             Non-Secure	OK
    27 NRF_DPPIC            Non-Secure	OK
    28 NRF_REGULATORS       Non-Secure	OK
    29 NRF_DCNF             Secure		SKIP
    30 NRF_CTRLAP           Secure		SKIP
    31 NRF_SPIM4            Non-Secure	OK
    32 NRF_WDT0             Non-Secure	OK
    33 NRF_WDT1             Non-Secure	OK
    34 NRF_COMP             Non-Secure	OK
    35 NRF_LPCOMP           Non-Secure	OK
    36 NRF_PDM0             Non-Secure	OK
    37 NRF_I2S0             Non-Secure	OK
    38 NRF_QSPI             Non-Secure	OK
    39 NRF_NFCT             Non-Secure	OK
    40 NRF_MUTEX            Non-Secure	OK
    41 NRF_QDEC0            Non-Secure	OK
    42 NRF_QDEC1            Non-Secure	OK
    43 NRF_USBD             Non-Secure	OK
    44 NRF_USBREGULATOR     Non-Secure	OK
    45 NRF_P1               Non-Secure	OK
    46 NRF_OSCILLATORS      Non-Secure	OK
    47 NRF_RESET            Non-Secure	OK
    48 NRF_GPIOTE1          Non-Secure	OK
    
    SPM: NS image at 0x10000
    SPM: NS MSP at 0x2000afd8
    SPM: NS reset vector at 0x12af1
    SPM: prepare to jump to Non-Secure image.
    *** Booting Zephyr OS build v2.7.0-ncs1  ***
    Starting Dynamic Tx Power Beacon Demo
    Get Tx power level ->Read Tx power err: -5 reason 0x00
    -> default TXP = -1
    Bluetooth initialized
    Dynamic Tx power Beacon started
    [00:00:00.015,472] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:00.033,935] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.033,935] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
    [00:00:00.033,935] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 223.20160 Build 1719410646
    [00:00:00.037,139] <inf> bt_hci_core: Identity: ED:BE:2C:6D:CC:91 (random)
    [00:00:00.037,139] <inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x22b0, manufacturer 0x0059
    [00:00:00.037,139] <inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x22b0
    Set Tx power level to 0
    Set Tx power err: -5 reason 0x00
    [00:00:05.026,092] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to -3
    Set Tx power err: -5 reason 0x00
    [00:00:10.031,738] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:10.038,726] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to -8
    Set Tx power err: -5 reason 0x00
    [00:00:15.044,586] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:15.051,574] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to 0
    Set Tx power err: -5 reason 0x00
    [00:00:20.057,250] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:20.064,208] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to -3
    Set Tx power err: -5 reason 0x00
    [00:00:25.069,885] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:25.076,873] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Connected via connection (15) at 7B:30:AF:35:30:7D (random)
    Read Tx power err: -5 reason 0x00
    Connection (15) - Initial Tx Power = -1
    Set Tx power err: -5 reason 0x00
    Read Tx power err: -5 reason 0x00
    Connection (15) - Tx Power = -1
    [00:00:27.252,532] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:27.259,948] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:27.263,854] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Connected (15) - RSSI = -56
    Adaptive Tx power selected = -20
    Set Tx power err: -5 reason 0x00
    Read Tx power err: -5 reason 0x00
    Connection (15) TXP = -1
    [00:00:30.082,550] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:30.093,688] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:30.097,473] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    Connected (15) - RSSI = -49
    Adaptive Tx power selected = -20
    Set Tx power err: -5 reason 0x00
    Read Tx power err: -5 reason 0x00
    Connection (15) TXP = -1
    [00:00:31.110,046] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:31.113,861] <wrn> bt_hci_coConnected (15) - RSSI = -49
    Adaptive Tx power selected = -20
    re: opcodSet Tx power err: -5 reason 0x00
    e 0xfc0f Read Tx power err: -5 reason 0x00
    Connection (15) TXP = -1
    status 0x01
    [00:00:32.126,556] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:32.130,340] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    Connected (15) - RSSI = -55
    Adaptive Tx power selected = -20
    Set Tx power err: -5 reason 0x00
    Read Tx power err: -5 reason 0x00
    Connection (15) TXP = -1
    [00:00:33.142,883] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:33.146,697] <wrn> bt_hcConnected (15) - RSSI = -58
    Adaptive Tx power selected = -20
    i_core: opSet Tx power err: -5 reason 0x00
    code 0xfcRead Tx power err: -5 reason 0x00
    Connection (15) TXP = -1
    0f status 0x01
    [00:00:34.159,271] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    [00:00:34.163,055] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    Disconnected (reason 0x13)
    Set Tx power level to 0
    Set Tx power err: -5 reason 0x00
    [00:00:35.171,386] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to -3
    Set Tx power err: -5 reason 0x00
    [00:00:40.177,062] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:40.184,051] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to -8
    Set Tx power err: -5 reason 0x00
    [00:00:45.189,819] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
    [00:00:45.196,807] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
    Get Tx power level -> Read Tx power err: -5 reason 0x00
    TXP = -1
    Set Tx power level to 0
    Set Tx power err: -5 reason 0x00
    

  • Hi,

    This sample is already available in the nRF Connect SDK:

    Also, when building with the nRF5340DK, you should flash this into the network core of the DK, i.e., nrf5340dk_nrf5340_cpunet

    Regards,

    Priyanka

  • Hi Priyanka

    1.

    Are you sure to flash hci_pwr_ctrl  to network core? Which core did you flash BLE controller?  It confused

    me.  I did try flashing hci_pwr_ctrl at network cor and empty_app_core at application core. Then, no uart

    log. Nothing works. It thinks wrong.

    2.

    At my test previously,

    Network core: hci_rpmsg sample which included BLE controller.  Application core: hci_pwr_ctrl sample. 

    These two cores used message handler to communicate. So, bluetooth can work. Uart log can work, too.

    My only questions was NRF5340 cannot get/set TX power.

    Could you mind checking this question internally for me? It took me much time to confirm this issue.

    Jeffery

  • Hi Jeffery,

    This looks strange as it did work for me. Could you try this through west? Just open the Toolchain manager and select the "Open Command prompt" and then navigate to your project file location.

    Then try west build -b nrf5340dk_nrf5340_cpunet

    followed by west flash 

    Then you could take another DK which can be used to check the RSSI values obtained from the peripheral DK into which you flashed the hci_pwr_ctrl.

    This DK could be nRF5340DK, nRF52840DK, etc but you should flash the RSSI viewer firmware into it first and then use the RSSI Viewer application in the nRF Connect for Desktop to view the RSSI measurements.

  • Hi 

    1. WEST can work. TX power can be changed at NRF5340. Besides, I found SES also can work. The reason

        why  no uart log data out was that application core was empty. It shall flash empty_app_core at application

        core.

    West vs. SES.docx

    2. Below was from SDK Connect documentation. There are two options for BLE. RPMsg or RPC at network

        core. I chose RPMsg since all bluetooth examples can work at application core. Then, at peripheral_uart

        example,  I used set_tx_power and get_tx_power API from hci_pwr_ctrl to change 5340 tx power. But, it

        failed. 

Reply
  • Hi 

    1. WEST can work. TX power can be changed at NRF5340. Besides, I found SES also can work. The reason

        why  no uart log data out was that application core was empty. It shall flash empty_app_core at application

        core.

    West vs. SES.docx

    2. Below was from SDK Connect documentation. There are two options for BLE. RPMsg or RPC at network

        core. I chose RPMsg since all bluetooth examples can work at application core. Then, at peripheral_uart

        example,  I used set_tx_power and get_tx_power API from hci_pwr_ctrl to change 5340 tx power. But, it

        failed. 

Children
Related