nRF5340-DK Current Measurement Problems

Hello Nordic Team,

I am using nRF5340-DK and I have a PPK-2 for current measurements. My development environment is NRF Connect SDK v2.5.2. I used https://infocenter.nordicsemi.com/pdf/PPK_2_User_Guide_20201201.pdf this guide to configure my board and ppk2. Firstly, I used section 6.3 Measuring current in Ampere Meter mode.

On board side, switches status are like below: 

VEXT->NRF SWITCH = OFF
NRF ONLY | DEFAULT SWITCH = NRF ONLY
 

Firstly, I erased both application and network cores. After that, I used very simple app to measure current consumption. 

main.cpp

#include <zephyr/kernel.h>
#include <zephyr/device.h>

#include "Leds.h"

LOG_MODULE_REGISTER(main, ATM_LOG_LEVEL_INF);

int main(void)
{   
	LOG_INF("SLEEP TEST PROJECT!");	

	LEDS::Init();
	LEDS::GreenOn();
	LEDS::RedOn();
    
	k_sleep(K_MSEC(1000));

	LEDS::GreenOff();
	LEDS::RedOff();

	// Start operations...
	LOG_INF("Started operations...");	

	while(1)
	{
		k_sleep(K_FOREVER);
	}

	return 0;
}

# Config Peripherals
CONFIG_GPIO=y
CONFIG_PM_DEVICE=y
CONFIG_BOARD_ENABLE_DCDC_APP=y
CONFIG_BOARD_ENABLE_DCDC_NET=y
####

# CPP
CONFIG_CPP=y
CONFIG_GLIBCXX_LIBCPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_STD_CPP17=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y
####

# General Settings
CONFIG_FPU=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_ASSERT=y
CONFIG_RING_BUFFER=y
CONFIG_REBOOT=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=16384
####

# # Config LOGGER (Close while sleep test)
# CONFIG_LOG=y
# CONFIG_USE_SEGGER_RTT=y
# CONFIG_LOG_BACKEND_RTT=y
# CONFIG_LOG_BACKEND_UART=n
# CONFIG_LOG_PRINTK=y
# CONFIG_LOG_MODE_IMMEDIATE=n
# # to see DBG messages
# #CONFIG_LOG_DEFAULT_LEVEL=4
# ####

# Necessary options for low power consumption (Enabled while sleep test)
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=n
CONFIG_USB_DEVICE_STACK=n
CONFIG_DEBUG_OPTIMIZATIONS=n
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_BT_DEBUG_LOG=n
####

According to following settings I am seeing 3.7 - 3.8uA as idle current and there are no peaks. I am seeing this idle current constantly. However, according to online power profiler web page, I must see 3.1uA. (There is no big difference between the results. So, I feel that my settings are correct. Is there way to decrease idle current or my settings are correct?)

After that, I want to add network core to my project. Again, I prepared a simple ble scanner example. (Because, I will use nRF5340 as a scanner on my project.)

#include <zephyr/kernel.h>
#include <zephyr/device.h>

#include "Leds.h"
#include "BLECentralScan.h"

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);


int main(void)
{   
	LOG_INF("SLEEP TEST PROJECT!");	

	LEDS::Init();
	LEDS::GreenOn();
	LEDS::RedOn();
    
	k_sleep(K_MSEC(1000));

	int err = BLECentralScan::Init();
	if(err != 0)
		ATM_LOG_ERR("Scanner initilazation failed: %d!", err);

	LEDS::GreenOff();
	LEDS::RedOff();

	// Start operations...
	// BLECentralScan::StartScan();
	ATM_LOG_INF("Started operations...");	

	while(1)
	{
		k_sleep(K_FOREVER);
	}

	return 0;
}

nrf5340dk_nrf5340_cpuapp.conf

CONFIG_SPI=n
CONFIG_NCS_SAMPLES_DEFAULTS=n

CONFIG_BOARD_ENABLE_DCDC_NET=y
CONFIG_BOARD_ENABLE_DCDC_APP=y
# IF RUNNING DIRECTLY ON A LIPO, CONNECTED TO VDDH
# CONFIG_BOARD_ENABLE_DCDC_HV=y

// child_image/hci_rpmsg.conf

CONFIG_BOARD_ENABLE_DCDC_NET=y

# Necessary options for low power consumption
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_BT_DEBUG_LOG=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=n
CONFIG_USB_DEVICE_STACK=n
CONFIG_DEBUG_OPTIMIZATIONS=n
####

CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502

CONFIG_BT_MAX_CONN=1

CONFIG_BT_CTLR_PHY_2M=y
# CONFIG_BT_CTLR_PHY_CODED=y
# CONFIG_BT_CTLR_RX_BUFFERS=2

By using these project settings, I am getting 5.81uA average current and I am starting to see peak currents at every seconds. Is this expected behavior? Also, even DCDC converter is enabled for both mcu cores, I am seeing 4.45uA idle current. (Again, according to online power profiler, it is 3.1uA. There is a huge difference. Is this normal or I must apply some other configuration or I must use different app instead of hci_rpmsg?)

There, I have one more question. If I configure board and ppk2 according to section 6.3, I am not able to measure any external sensor currents. I even connect board's VDD and GND pins a power led but average current stays same. Because of that, I configured my board and ppk2 according to section 6.2. Now, I am able to sense external components current like a LED. However,my average current jumps from 5.81uA to 12uA and idle current jump form 4.45uA to 10.4uA. Is this expected behavior? (Which components I must removed from DK to decrease sleep current?)

Thanks.

Parents
  • Hi 

    I will look into your case. 

    To start with I am wondering if you have prepared the DK as described here

    Could you also show me your BLECentralScan function? I'm wondering if maybe something spawned another thread since I can't see anything else in your main that should indicate that it wakes up every second. 

    I would suggest trying one of our samples to see if you see the same behaviour.

    Regarding your last part, I would start by preparing the DK before doing anything else

    It could also be worth having a look at this old blog for inspiration. However it seems to me you have an idea of what to do

    Regards

    Runar

  • Hello,

    Thank you for very quick response.

    To start with I am wondering if you have prepared the DK as described here.
    >>> Yes. I prepared board as described.

    Could you also show me your BLECentralScan function? I'm wondering if maybe something spawned another thread since I can't see anything else in your main that should indicate that it wakes up every second.
    >>> You are completely right. I solved this one second ticking problem. I am so sorry. My new idle current is 4.3uA. According to online power profiler, it must be 3.1uA. Difference between these two results are expected or not.


    (Idle current while application and network core active. Both cores DCDC converters are enabled.)

    BleCentralScanner.cpp
    
    int BLECentralScan::Init(void)
    {
    	int err;
    
        uint16_t size = sizeof(scanner_data_t);
        ATM_LOG_INF("Size of scanner item: %d-byte", size);
    	__ASSERT((size%4)==0, "Scanner item size is not devidable by 4.");
    
    	err = bt_enable(NULL);
    	if (err) {
    		ATM_LOG_INF("Bluetooth init failed (err %d)\n", err);
    		return err;
    	}
    	
    	bt_conn_cb_register(&conn_callbacks);
    
    	bt_addr_le_t addr = {0};
    	size_t count = 1;
    	bt_id_get(&addr, &count);
    
    	static char mac_str[18];
    	sprintf(mac_str, "%02X:%02X:%02X:%02X:%02X:%02X", addr.a.val[5], 
    													  addr.a.val[4], 					
    													  addr.a.val[3], 
    													  addr.a.val[2], 
    													  addr.a.val[1], 
    													  addr.a.val[0]);
    
    	ATM_LOG_INF("Bluetooth initialized. MAC: %s", mac_str);	
    	return 0;
    }


    I would suggest trying one of our samples to see if you see the same behaviour.
    >>> Ticking problem is solved. I am not seeing any peak while both core are active and at the idle state.

    It could also be worth having a look at this old blog for inspiration.
    >>> I will check it. Thanks for the suggestion.

    Thanks.

  • Hi

    Could you try to do the measurement in power mode? Power mode will reduce the amount of USB noise induced into the system

    Just remember to match the supply voltage to VDD so you don't get any leakage 

    It's not necessary to use NRF ONLY | DEFAULT SWITCH = NRF ONLY

    Regards

    Runar

  • Hello,

    I make measurements at in power mode again. Switch positions are

    VEXT->NRF SWITCH = OFF
    NRF ONLY | DEFAULT SWITCH = NRF ONLY

    My board consumes 16.3uA at your suggested case. I make measurements again for other case.

    (section 6.2) --> 8.9uA
    If I remove P22 header, the power consumption decreases to 5.4uA. I feel that smt on my boards consumes 5.4uA. 
    (section 6.3) --> 4uA

    I don't know what I do wrongly.

    Thanks.
  • Hi

    I ran your numbers through one of our experts on power consumption just to be sure. 4.3µA on idle if you got full RAM retention on both cores is good. The idle current in the PS is a typical value so some device to device variation is to be expected. Just to make sure you have no offset in your measurement, you can try to put the device in system OFF, and if you then measure over 1µA you will know you have some offsett in the measurements. 

    If you need a lower current draw, it it might be possible to run your application with less RAM as RAM retention as most of the leakage in idle is from the RAM retention. 

    Regards

    Runar

Reply
  • Hi

    I ran your numbers through one of our experts on power consumption just to be sure. 4.3µA on idle if you got full RAM retention on both cores is good. The idle current in the PS is a typical value so some device to device variation is to be expected. Just to make sure you have no offset in your measurement, you can try to put the device in system OFF, and if you then measure over 1µA you will know you have some offsett in the measurements. 

    If you need a lower current draw, it it might be possible to run your application with less RAM as RAM retention as most of the leakage in idle is from the RAM retention. 

    Regards

    Runar

Children
Related