How to set BLE TX Power in prj.conf for nrf5340

I want to set the TX power in the bluetooth/peripheral_uart example.
I looked through the other posts with similar questions but can't find a working solution.
I don't want to set it dynamically with HCI commands. Instead I would like to just set in in the prj.conf file.

According to this documentation I have to use the following commands to increase the TX power for a nrf5340 chip.

CONFIG_BT_CTLR=y
CONFIG_BT_CTLR_TX_PWR_PLUS_3=y

Apparently I also need to switch from the Nordic Softdevice Controller (SDC) to the Zephyr BT Controller according to this link. After doing that, I still only get warnings and I can't finish a pristine build.

Loading Zephyr default modules (Zephyr base).
-- Application: E:/ncs/projects/essentim/bt_peripheral_uart
-- CMake version: 3.20.5
-- Found Python3: E:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
-- Zephyr version: 3.3.99 (E:/ncs/v2.4.1/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp_ns
-- Found host-tools: zephyr 0.16.0 (E:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (E:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found Dtc: E:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: E:/ncs/v2.4.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_ns.dts


warning: Experimental symbol BT_LL_SW_SPLIT is enabled.


warning: ENTROPY_NRF5_RNG (defined at drivers/entropy/Kconfig.nrf5:14) has direct dependencies !ENTROPY_NRF_FORCE_ALT && DT_HAS_NORDIC_NRF_RNG_ENABLED && ENTROPY_GENERATOR with value n, but is currently being y-selected by the following symbols:
 - BT_LLL_VENDOR_NORDIC (defined at subsys/bluetooth\controller\Kconfig.ll_sw_split:8), with value y, direct dependencies SOC_COMPATIBLE_NRF && !n && !n && BT_LL_SW_SPLIT && BT_CTLR && BT_HCI && BT (value: y), and select condition SOC_COMPATIBLE_NRF && !n && !n && BT_LL_SW_SPLIT && BT_CTLR && BT_HCI && BT (value: y)

error: Aborting due to Kconfig warnings

CMake Error at E:/ncs/v2.4.1/zephyr/cmake/modules/kconfig.cmake:339 (message):
  command failed with return code: 1

-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1:

I'm a bit lost as other commands like "CONFIG_BT_CTLR_TX_PWR_ANTENNA =8" or "CONFIG_BT_CTLR_TX_PWR_PLUS_8" also don't work.

The only other thing that I could try would be to use the net core of the chip as hinted at at this link:

However, that would be a lot of work and I was wondering if it's possible to only use the app core in some way.

I would be very appreciative for some help!

Parents
  • Hello,

    Apparently I also need to switch from the Nordic Softdevice Controller (SDC) to the Zephyr BT Controller according to this link. After doing that, I still only get warnings and I can't finish a pristine build.

    This is a very old answer and is no longer relevant - it is now possible to set it using kconfig configurations.

    I'm a bit lost as other commands like "CONFIG_BT_CTLR_TX_PWR_ANTENNA =8" or "CONFIG_BT_CTLR_TX_PWR_PLUS_8" also don't work.

    Please note that the nRF5340 only can do up to +3 dbm, and so +8 dbm is not possible for this device.

    Could you elaborate what it is that is failing when you set the kconfig to +3 dbm? Have you measured the output power, or are you just not seeing any change to the RSSI measured on a peer device, or does it fail in any other way?

    Best regards,
    Karl

Reply
  • Hello,

    Apparently I also need to switch from the Nordic Softdevice Controller (SDC) to the Zephyr BT Controller according to this link. After doing that, I still only get warnings and I can't finish a pristine build.

    This is a very old answer and is no longer relevant - it is now possible to set it using kconfig configurations.

    I'm a bit lost as other commands like "CONFIG_BT_CTLR_TX_PWR_ANTENNA =8" or "CONFIG_BT_CTLR_TX_PWR_PLUS_8" also don't work.

    Please note that the nRF5340 only can do up to +3 dbm, and so +8 dbm is not possible for this device.

    Could you elaborate what it is that is failing when you set the kconfig to +3 dbm? Have you measured the output power, or are you just not seeing any change to the RSSI measured on a peer device, or does it fail in any other way?

    Best regards,
    Karl

Children
  • Hello Karl,

    okay, I could now verify that the only problem was that apparently the TX Power Settings can only be set when using the netcore of the nrf5340 chip.
    Sorry for the question then. I got confused because bluetooth is generally working on the app core but apparently settings can only be changed on the net core?

    Best regards,
    Matthias

    ps.: using the commands
    CONFIG_BT_CTLR=y
    CONFIG_BT_CTLR_TX_PWR_PLUS_3=y

  • Hello again, Matthias

    tsaim said:
    Sorry for the question then.

    No need to apologize - we're happy to take any question you might have, of course! :) 

    tsaim said:
    okay, I could now verify that the only problem was that apparently the TX Power Settings can only be set when using the netcore of the nrf5340 chip.

    Do I understand you correctly that you are now seeing the expected +3 dbm output?'

    tsaim said:
    I got confused because bluetooth is generally working on the app core but apparently settings can only be changed on the net core?

    I am not sure if I understand your question correctly here, could you elaborate?
    It would be more accurate to say that Bluetooth generally is done on the netcore, with input from the appcore - i.e the application core configures and calls for advertisement to start at a certain powerlevel, and then the netcore will be the one to execute this.

    Best regards,
    Karl

  • Hello Karl,

    thanks for the reply!

    Do I understand you correctly that you are now seeing the expected +3 dbm output?'

    That's correct!

    I am not sure if I understand your question correctly here, could you elaborate?
    It would be more accurate to say that Bluetooth generally is done on the netcore, with input from the appcore - i.e the application core configures and calls for advertisement to start at a certain powerlevel, and then the netcore will be the one to execute this.

    I think my problem was, that I had everything running just on the app core to keep it as simple as possible. I didn't know that usually bluetooth is handled on the netcore Slight smile So now I'll try to seperate it.

    Thanks for the explanation and help!
    Best regards,
    Matthias

  • Hello Matthias,

    tsaim said:
    That's correct!

    Great, I am glad to hear that! :)

    tsaim said:
    I think my problem was, that I had everything running just on the app core to keep it as simple as possible. I didn't know that usually bluetooth is handled on the netcore Slight smile So now I'll try to seperate it.

    Aha, I see!
    The Bluetooth host will be on the application core, and then the Bluetooth Controller will be on the netcore. You can read more about this split here.

    tsaim said:
    thanks for the reply!
    tsaim said:
    Thanks for the explanation and help!

    It is no problem at all! :) 
    Please do not hesitate to open another ticket if you should encounter any other issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Related