How to set Transmit Power of my Advertisement Packet in nRF Connect SDK 2.5.1

Hello,

I want to set the transmitting power of the advertising packet. How can I set the TX power?

I am using nRF Connect SDK 2.5.1 in Visual Studio Code.

Regards,

Sri

  • I have completed the steps told in the document. But still getting multiple current peaks for each advertisement. The power setting in proj.conf is CONFIG_BT_CTLR_TX_PWR_0=y

     

    The expected current consumption is 10.3 mA in normal mode and 4.9mA in DC/DC mode. So anything I am missing? I followed all the steps in the document you shared to create a custom board.

  • I would recommend that you check of this sample for your current measurement 

    Regards

    Runar

  • Thank you for sharing the documentation. I have followed it and now in idle it is consuming 1.3 - 1.5uA (Avg). I turned off the serial and other unused peripherals. 

    The transmission power is still not matching the values given in the datasheet. It is varying. How do i get the 5mA specified in the datasheet? 

    TIA

    Sri

  • Hi

    I would suspect that the DCDC is not enabled. Can you share your custom board files(for vscode) and your config files?

    Regards

    Runar

  • PFA the contents of the custom board file and the config file of the project. 

    File Name: Kconfig
    Contents: 
    # nRF52833 board configuration
    
    config BOARD_ENABLE_DCDC
        bool "DCDC Mode"
        select SOC_DCDC_NRF52X
        default y
        depends on BOARD_BEACON_NRF52833
    --------------------------------------------------------------------------------------------------------------------
    File Name: Kconfig.board
    Contents:
    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    config BOARD_BEACON_NRF52833
    	bool "BEACON"
    	depends on SOC_NRF52833_QIAA
    ----------------------------------------------------------------------------------------------------------------------
    File Name: Kconfig.defconfig
    Contents:
    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    if BOARD_BEACON_NRF52833
    
    config BOARD
    	default "beacon_nrf52833"
    
    config BT_CTLR
       default BT
    
    
    endif
    --------------------------------------------------------------------------------------------------------------------------
    File Name: beacon_nrf52833.dts
    Contents:
    // Copyright (c) 2024 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52833_qiaa.dtsi>
    #include "beacon_nrf52833-pinctrl.dtsi"
    
    
    / {
    	model = "BEACON";
    	compatible = "ust,beacon-nrf52833";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    		zephyr,console =  &uart0 ;
    		zephyr,shell-uart =  &uart0 ;
    		zephyr,uart-mcumgr = &uart0;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		LED0: led_0 {
    			label = "RED LED";
    			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
    		};
    		LED1: led_1 {
    			label = "GREEN LED";
    			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
    		};
    		LED2: led_2 {
    			label = "BLUE LED";
    			gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
    		};
    		LED3: led_3 {
    			label = "IR LED";
    			gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
    		};
    	};
    
    	buttons {
    		compatible = "gpio-keys";
    		btn0: user_btn {
    			label = "USER BUTTON";
    			gpios = <&gpio1 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
    		};
    	};
    	aliases {
    		led0 = &LED0;
    		led1 = &LED1;
    		led2 = &LED2;
    		sw0 = &btn0;
    		watchdog0 = &wdt0;
    	};
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x3e000 0x32000>;
    		};
    		scratch_partition: partition@70000 {
    			label = "image-scratch";
    			reg = <0x70000 0xa000>;
    		};
    		storage_partition: partition@7a000 {
    			label = "storage";
    			reg = <0x7a000 0x6000>;
    		};
    	};
    };
    
    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default>;
    	pinctrl-1 = <&uart0_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    &gpio0 {
    	status = "okay";
    };
    
    &gpio1 {
    	status = "okay";
    };
    
    &gpiote {
    	status = "okay";
    };
    
    &nfct {
    	status = "disabled";
    };
    
    &acl {
    	status = "disabled";
    };
    ---------------------------------------------------------------------------------------------------------------------------------
    File Name: beacon_nrf52833.yaml 
    Contents: 
    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    identifier: beacon_nrf52833
    name: BEACON
    type: mcu
    arch: arm
    ram: 128
    flash: 512
    toolchain:
      - zephyr
      - gnuarmemb
      - xtools
    ---------------------------------------------------------------------------------------------------------------------------------
    File Name: beacon_nrf52833_defconfig
    Contents:
    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    CONFIG_SOC_SERIES_NRF52X=y
    CONFIG_SOC_NRF52833_QIAA=y
    CONFIG_BOARD_BEACON_NRF52833=y
    
    # Enable MPU
    CONFIG_ARM_MPU=y
    
    # Enable hardware stack protection
    CONFIG_HW_STACK_PROTECTION=y
    
    # Enable GPIO
    CONFIG_GPIO=n
    
    # Enable UART
    CONFIG_SERIAL=n
    
    # Enable Console
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    
    # Enable Pin Control subsystem
    CONFIG_PINCTRL=y
    ---------------------------------------------------------------------------------------------------------------------------------
    File Name: beacon_nrf52833-pinctrl.dtsi
    Contents:
    /*
     * Copyright (c) 2022 Nordic Semiconductor
     * SPDX-License-Identifier: Apache-2.0
     */
    
    &pinctrl {
        uart0_default: uart0_default{
            group1 {
                psels = <NRF_PSEL(UART_TX,0,6)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX,0,8)>;
                bias-pull-up;
            };
        };
        uart0_sleep: uart0_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 6)>,
                        <NRF_PSEL(UART_RX, 0, 8)>;
                low-power-enable;
            };
        };
        
        i2c0_default: i2c0_default {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                        <NRF_PSEL(TWIM_SCL, 0, 12)>;
            };
        };
    
        i2c0_sleep: i2c0_sleep {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                        <NRF_PSEL(TWIM_SCL, 0, 12)>;
                low-power-enable;
            };
        };
    };
    ---------------------------------------------------------------------------------------------------------------------------------
    File Name: board.cmake
    Contents:
    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    board_runner_args(jlink "--device=nrf52833_xxaa" "--speed=4000")
    board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000")
    
    include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
    include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
    include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
    File Name: prj.conf
    Contents:
    # Logger module
    CONFIG_LOG=n
    
    # GPIO Library
    CONFIG_GPIO=n
    
    # Include BLE stack in project
    CONFIG_BT=y
    
    # Set device Name
    CONFIG_BT_DEVICE_NAME="UBC0001"
    
    # Increase stack size for the main thread and System Workqueue
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    CONFIG_MAIN_STACK_SIZE=2048
    
    # Set the default Tx Power of BLE 
    # CONFIG_BT_CTLR_TX_PWR_MINUS_20=y
    # CONFIG_BT_CTLR_TX_PWR_MINUS_16=y
    # CONFIG_BT_CTLR_TX_PWR_MINUS_12=y
    # CONFIG_BT_CTLR_TX_PWR_MINUS_8=y
    # CONFIG_BT_CTLR_TX_PWR_MINUS_4=y
    CONFIG_BT_CTLR_TX_PWR_0=y
    # CONFIG_BT_CTLR_TX_PWR_PLUS_4=y
    # CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
    ---------------------------------------------------------------------------------------------------------------------------------
    

Related