System on high current when wifi is disconnected

Hi,

We are evaluating NRF5340+NRF7002 setup for our customer. We are currently using https client example(sdk v3.0.2) and we would like to benchmark current consumption of the individual chips.I have set up the PPK2s as explained in your technical documentation.

We would like the application to run in a loop where it wakes up and posts some data over https and goes back to sleep. It is not possible at the moment to wakeup periodically from system off state as there is no wakeup option to achieve this without external component. Hence we would like to remain in system on state and try to achieve as low power consumption as possible when device is in sleep. We noticed that bringing up the net interface takes a long time due to a known bug as posted here ->NRF7002DK boot up time - Nordic Q&A - Nordic DevZone - Nordic DevZone. Hence we are avoiding calls to conn_mgr_all_if_up and conn_mgr_all_if_down within the loop. The loop now just establishes connection before http request and then disconnects. This puts the nrf7002 in relatively low power state (average ~16uA). But we noticed that nrf5340 still consumes around ~200uA constant current. On digging deeper it looks like the BUCKEN and IOVDD pins are the reason for this. These are needed to keep nrf7002 powered on and are only disabled when conn_mgr_all_if_down is called. If powered down I believe nrf7002 loses all context and need to be reinitialized. Without powering down nrf7002(using these pins) it looks like it is not possible at the moment to reduce current consumption on host MCU below ~200uA. 

Could you please let me know if there is a way to achieve low power consumption (~1-10uA) in system ON keeping nrf7002 chip on and how this can be done? Else are there any other alternative approaches?

Best Regards,

Arjun

Parents Reply Children
  • Hi,

    Thank you. I tried but it didn't improve for me. It seems still not possible for me to go below the 200uA. The only way to go below seems like is to bring network interface down (setting bucken and iovdd to 0) and hence powering down nrf5340. Could you share your code snippet here and I could give it a go?

    BR,

    Arjun

  • Hi Arjun,

     

    Sorry to hear that the current is still high!

    here's the changes I've done to STA on ncs v3.0.2:

    diff --git a/samples/wifi/sta/prj.conf b/samples/wifi/sta/prj.conf
    index 1be8a75a11..04f897e110 100644
    --- a/samples/wifi/sta/prj.conf
    +++ b/samples/wifi/sta/prj.conf
    @@ -13,8 +13,8 @@ CONFIG_NRF_WIFI_RPU_RECOVERY=y
     
     CONFIG_WIFI_CREDENTIALS=y
     CONFIG_WIFI_CREDENTIALS_STATIC=y
    -CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid"
    -CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="Mypassword"
    +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="OpenWrt"
    +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="redacted"
     
     # Networking
     CONFIG_NETWORKING=y
    @@ -82,3 +82,5 @@ CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.1.1"
     # design in net_mgmt. So, use a higher timeout for a crowded
     # environment.
     CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000
    +CONFIG_SERIAL=n
    +CONFIG_PINCTRL=y
    diff --git a/samples/wifi/sta/src/main.c b/samples/wifi/sta/src/main.c
    index 0402216e27..445b07d6bd 100644
    --- a/samples/wifi/sta/src/main.c
    +++ b/samples/wifi/sta/src/main.c
    @@ -401,11 +401,11 @@ static int register_wifi_ready(void)
            return ret;
     }
     #endif /* CONFIG_WIFI_READY_LIB */
    -
    +#include <hal/nrf_gpio.h>
     int main(void)
     {
            int ret = 0;
    -
    +       nrf_gpio_cfg_input(18, NRF_GPIO_PIN_PULLUP);
            net_mgmt_callback_init();
     
     #ifdef CONFIG_WIFI_READY_LIB
    
     

    And here's the current consumption of the nRF5340:

     

    Let me know if this helps.

     

    Kind regards,

    Håkon

  • Hi Håkon,

    I tried to reproduce what you said but I am still not able to achieve a low current when nrf5340 is in idle state. I would like to give you a detailed description of what I am trying to do here so that if possible, you can reproduce the behavior I have.

    Hardware: nrf7002dk

    Software version: ncs v3.0.2

    example: samples/net/https_client

    Measurement setup: https://docs.nordicsemi.com/bundle/ug_nrf7002_dk/page/UG/nrf7002_DK/nRF5340_nRF7002_measure_current.html

    Note: Modify CONFIG_WIFI_CREDENTIALS_STATIC_SSID and CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD to your network setup.

    Scenario 1:

    Below is a patch that you can directly apply to the https_client example.

    diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    index 3167ed614d..9c2b3e2d26 100644
    --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    @@ -23,9 +23,9 @@ CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y
     CONFIG_WIFI_CREDENTIALS=y
     
     # Shell
    -CONFIG_SHELL=y
    -CONFIG_SHELL_STACK_SIZE=6144
    -CONFIG_NET_L2_WIFI_SHELL=y
    +#CONFIG_SHELL=y
    +#CONFIG_SHELL_STACK_SIZE=6144
    +#CONFIG_NET_L2_WIFI_SHELL=y
     
     # WPA supplicant
     CONFIG_WIFI_NM_WPA_SUPPLICANT=y
    @@ -70,3 +70,11 @@ CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y
     CONFIG_TFM_PROFILE_TYPE_SMALL=y
     CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
     CONFIG_PM_PARTITION_SIZE_TFM=0x20000
    +
    +# Disable UART
    +CONFIG_LOG=n
    +CONFIG_PRINTK=n
    +CONFIG_NCS_BOOT_BANNER=n
    +CONFIG_BOOT_BANNER=n
    +CONFIG_SERIAL=n
    +CONFIG_TFM_LOG_LEVEL_SILENCE=y
    diff --git a/samples/net/https_client/prj.conf b/samples/net/https_client/prj.conf
    index 799bda7db1..6bbd167148 100644
    --- a/samples/net/https_client/prj.conf
    +++ b/samples/net/https_client/prj.conf
    @@ -19,3 +19,8 @@ CONFIG_NET_IPV4=y
     CONFIG_NET_IPV6=y
     CONFIG_NET_CONNECTION_MANAGER=y
     CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=4600
    +
    +CONFIG_WIFI_CREDENTIALS_STATIC=y
    +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="MySSID"        # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="MyPwd"      # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK=y                # <- Modify this
    \ No newline at end of file
    diff --git a/samples/net/https_client/src/main.c b/samples/net/https_client/src/main.c
    index 754f98d9d1..7c4118a72e 100644
    --- a/samples/net/https_client/src/main.c
    +++ b/samples/net/https_client/src/main.c
    @@ -351,10 +351,13 @@ int main(void)
     
     	k_sem_take(&network_connected_sem, K_FOREVER);
     
    -	send_http_request();
    +	while(1)
    +	{
    +		send_http_request();
     
    -	/* A small delay for the TCP connection teardown */
    -	k_sleep(K_SECONDS(1));
    +		/* Idle time */
    +		k_sleep(K_SECONDS(20));
    +	}
     
     	/* The HTTP transaction is done, take the network connection down */
     	err = conn_mgr_all_if_disconnect(true);

    west build -b nrf7002dk/nrf5340/cpuapp/ns -p always
    west flash

    As you can notice now in the patch I have disabled the use of console and can confirm that there is nothing on both uart0(ttyACM0) and uart1(ttyACM1). The application is altered to send http request in a loop with 20 seconds idle time between requests. With this setup below is the power profile of the nrf7002(left) and nrf5340(right). 

    Both device can be seen to some activity when https request is being sent before going to idle mode(nrf5340) and dtim mode(nr7002)

    Also one can see the base current of nrf5340 always stays above 300uA during idle time(20 seconds) which I am not sure why. Please note that this is the case even if I put the nrf7002 in twt mode or extended PS mode(DTIM skip)

    Scenario 2:

    Revert the changes to https client and apply the patch below which in addition to sending http request in a loop also connects and disconnects from AP. In this case you can notice that nrf7002 power consumption is low ~15.8uA but the nrf5340 idle current still remains above ~300uA

    diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    index 3167ed614d..9c2b3e2d26 100644
    --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    @@ -23,9 +23,9 @@ CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y
     CONFIG_WIFI_CREDENTIALS=y
     
     # Shell
    -CONFIG_SHELL=y
    -CONFIG_SHELL_STACK_SIZE=6144
    -CONFIG_NET_L2_WIFI_SHELL=y
    +#CONFIG_SHELL=y
    +#CONFIG_SHELL_STACK_SIZE=6144
    +#CONFIG_NET_L2_WIFI_SHELL=y
     
     # WPA supplicant
     CONFIG_WIFI_NM_WPA_SUPPLICANT=y
    @@ -70,3 +70,11 @@ CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y
     CONFIG_TFM_PROFILE_TYPE_SMALL=y
     CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
     CONFIG_PM_PARTITION_SIZE_TFM=0x20000
    +
    +# Disable UART
    +CONFIG_LOG=n
    +CONFIG_PRINTK=n
    +CONFIG_NCS_BOOT_BANNER=n
    +CONFIG_BOOT_BANNER=n
    +CONFIG_SERIAL=n
    +CONFIG_TFM_LOG_LEVEL_SILENCE=y
    diff --git a/samples/net/https_client/prj.conf b/samples/net/https_client/prj.conf
    index 799bda7db1..6bbd167148 100644
    --- a/samples/net/https_client/prj.conf
    +++ b/samples/net/https_client/prj.conf
    @@ -19,3 +19,8 @@ CONFIG_NET_IPV4=y
     CONFIG_NET_IPV6=y
     CONFIG_NET_CONNECTION_MANAGER=y
     CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=4600
    +
    +CONFIG_WIFI_CREDENTIALS_STATIC=y
    +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="MySSID"        # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="MyPWD"      # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK=y                # <- Modify this
    \ No newline at end of file
    diff --git a/samples/net/https_client/src/main.c b/samples/net/https_client/src/main.c
    index 754f98d9d1..7647d6bc63 100644
    --- a/samples/net/https_client/src/main.c
    +++ b/samples/net/https_client/src/main.c
    @@ -331,35 +331,40 @@ int main(void)
     		return 0;
     	}
     
    -	printk("Connecting to the network\n");
    +	while(1)
    +	{
    +		printk("Connecting to the network\n");
     
    -	err = conn_mgr_all_if_connect(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_connect, error: %d\n", err);
    -		return 0;
    -	}
    +		err = conn_mgr_all_if_connect(true);
    +		if (err) {
    +			printk("conn_mgr_all_if_connect, error: %d\n", err);
    +			return 0;
    +		}
     
    -	/* Resend connection status if the sample is built for NATIVE_SIM.
    -	 * This is necessary because the network interface is automatically brought up
    -	 * at SYS_INIT() before main() is called.
    -	 * This means that NET_EVENT_L4_CONNECTED fires before the
    -	 * appropriate handler l4_event_handler() is registered.
    -	 */
    -	if (IS_ENABLED(CONFIG_BOARD_NATIVE_SIM)) {
    -		conn_mgr_mon_resend_status();
    -	}
    +		/* Resend connection status if the sample is built for NATIVE_SIM.
    +		* This is necessary because the network interface is automatically brought up
    +		* at SYS_INIT() before main() is called.
    +		* This means that NET_EVENT_L4_CONNECTED fires before the
    +		* appropriate handler l4_event_handler() is registered.
    +		*/
    +		if (IS_ENABLED(CONFIG_BOARD_NATIVE_SIM)) {
    +			conn_mgr_mon_resend_status();
    +		}
     
    -	k_sem_take(&network_connected_sem, K_FOREVER);
    +		k_sem_take(&network_connected_sem, K_FOREVER);
     
    -	send_http_request();
    +		send_http_request();
     
    -	/* A small delay for the TCP connection teardown */
    -	k_sleep(K_SECONDS(1));
    +		k_sleep(K_SECONDS(1));
     
    -	/* The HTTP transaction is done, take the network connection down */
    -	err = conn_mgr_all_if_disconnect(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_disconnect, error: %d\n", err);
    +		/* The HTTP transaction is done, take the network connection down */
    +		err = conn_mgr_all_if_disconnect(true);
    +		if (err) {
    +			printk("conn_mgr_all_if_disconnect, error: %d\n", err);
    +		}
    +
    +		/* Idle time */
    +		k_sleep(K_SECONDS(20));
     	}
     
     	err = conn_mgr_all_if_down(true);

    Scenario 3:

    Revert the changes to https client and apply the patch below which also adds network interface setup(conn_mgr_all_if_up) and teardown(conn_mgr_all_if_down) in the loop. In this case you can notice that nrf7002 in lowest power state ~1.7uA and the nrf5340 idle current now reduces to ~130 uA.

    diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    index 3167ed614d..9c2b3e2d26 100644
    --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf
    @@ -23,9 +23,9 @@ CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y
     CONFIG_WIFI_CREDENTIALS=y
     
     # Shell
    -CONFIG_SHELL=y
    -CONFIG_SHELL_STACK_SIZE=6144
    -CONFIG_NET_L2_WIFI_SHELL=y
    +#CONFIG_SHELL=y
    +#CONFIG_SHELL_STACK_SIZE=6144
    +#CONFIG_NET_L2_WIFI_SHELL=y
     
     # WPA supplicant
     CONFIG_WIFI_NM_WPA_SUPPLICANT=y
    @@ -70,3 +70,11 @@ CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y
     CONFIG_TFM_PROFILE_TYPE_SMALL=y
     CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
     CONFIG_PM_PARTITION_SIZE_TFM=0x20000
    +
    +# Disable UART
    +CONFIG_LOG=n
    +CONFIG_PRINTK=n
    +CONFIG_NCS_BOOT_BANNER=n
    +CONFIG_BOOT_BANNER=n
    +CONFIG_SERIAL=n
    +CONFIG_TFM_LOG_LEVEL_SILENCE=y
    diff --git a/samples/net/https_client/prj.conf b/samples/net/https_client/prj.conf
    index 799bda7db1..6bbd167148 100644
    --- a/samples/net/https_client/prj.conf
    +++ b/samples/net/https_client/prj.conf
    @@ -19,3 +19,8 @@ CONFIG_NET_IPV4=y
     CONFIG_NET_IPV6=y
     CONFIG_NET_CONNECTION_MANAGER=y
     CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=4600
    +
    +CONFIG_WIFI_CREDENTIALS_STATIC=y
    +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="MySSID"        # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="MyPWD"      # <- Modify this
    +CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK=y                # <- Modify this
    \ No newline at end of file
    diff --git a/samples/net/https_client/src/main.c b/samples/net/https_client/src/main.c
    index 754f98d9d1..3ce5743c17 100644
    --- a/samples/net/https_client/src/main.c
    +++ b/samples/net/https_client/src/main.c
    @@ -314,57 +314,63 @@ int main(void)
     	net_mgmt_init_event_callback(&conn_cb, connectivity_event_handler, CONN_LAYER_EVENT_MASK);
     	net_mgmt_add_event_callback(&conn_cb);
     
    -	printk("Bringing network interface up\n");
    +	while(1)
    +	{
    +		printk("Bringing network interface up\n");
    +
    +		/* Connecting to the configured connectivity layer.
    +		* Wi-Fi or LTE depending on the board that the sample was built for.
    +		*/
    +		err = conn_mgr_all_if_up(true);
    +		if (err) {
    +			printk("conn_mgr_all_if_up, error: %d\n", err);
    +			return err;
    +		}
     
    -	/* Connecting to the configured connectivity layer.
    -	 * Wi-Fi or LTE depending on the board that the sample was built for.
    -	 */
    -	err = conn_mgr_all_if_up(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_up, error: %d\n", err);
    -		return err;
    -	}
    +		/* Provision certificates before connecting to the network */
    +		err = cert_provision();
    +		if (err) {
    +			return 0;
    +		}
     
    -	 /* Provision certificates before connecting to the network */
    -	err = cert_provision();
    -	if (err) {
    -		return 0;
    -	}
    +		printk("Connecting to the network\n");
     
    -	printk("Connecting to the network\n");
    +		err = conn_mgr_all_if_connect(true);
    +		if (err) {
    +			printk("conn_mgr_all_if_connect, error: %d\n", err);
    +			return 0;
    +		}
     
    -	err = conn_mgr_all_if_connect(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_connect, error: %d\n", err);
    -		return 0;
    -	}
    +		/* Resend connection status if the sample is built for NATIVE_SIM.
    +		* This is necessary because the network interface is automatically brought up
    +		* at SYS_INIT() before main() is called.
    +		* This means that NET_EVENT_L4_CONNECTED fires before the
    +		* appropriate handler l4_event_handler() is registered.
    +		*/
    +		if (IS_ENABLED(CONFIG_BOARD_NATIVE_SIM)) {
    +			conn_mgr_mon_resend_status();
    +		}
     
    -	/* Resend connection status if the sample is built for NATIVE_SIM.
    -	 * This is necessary because the network interface is automatically brought up
    -	 * at SYS_INIT() before main() is called.
    -	 * This means that NET_EVENT_L4_CONNECTED fires before the
    -	 * appropriate handler l4_event_handler() is registered.
    -	 */
    -	if (IS_ENABLED(CONFIG_BOARD_NATIVE_SIM)) {
    -		conn_mgr_mon_resend_status();
    -	}
    +		k_sem_take(&network_connected_sem, K_FOREVER);
     
    -	k_sem_take(&network_connected_sem, K_FOREVER);
    +		send_http_request();
     
    -	send_http_request();
    +		k_sleep(K_SECONDS(1));
     
    -	/* A small delay for the TCP connection teardown */
    -	k_sleep(K_SECONDS(1));
    +		/* The HTTP transaction is done, take the network connection down */
    +		err = conn_mgr_all_if_disconnect(true);
    +		if (err) {
    +			printk("conn_mgr_all_if_disconnect, error: %d\n", err);
    +		}
     
    -	/* The HTTP transaction is done, take the network connection down */
    -	err = conn_mgr_all_if_disconnect(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_disconnect, error: %d\n", err);
    -	}
    +		err = conn_mgr_all_if_down(true);
     
    -	err = conn_mgr_all_if_down(true);
    -	if (err) {
    -		printk("conn_mgr_all_if_down, error: %d\n", err);
    +		if (err) {
    +			printk("conn_mgr_all_if_down, error: %d\n", err);
    +		}
    +
    +		/* Idle time */
    +		k_sleep(K_SECONDS(20));
     	}
     
     	return 0;

    I also applied the change you suggested to /CSN pin you suggested just before going to sleep in the main thread and this does not improve the idle current.

    For our customer the scenario 1 is the main requirement because at the moment connect API takes a long time as discussed before due to the crypto backend. So, we would like to reduce wakeup time and also use twt or DTIM skip to reduce power consumption as much as possible on both ICs. But it looks like we are not able to reduce idle base current of nrf5340(host MCU) at the moment. We would like to understand why and whether this a limitation we cannot avoid as we were under the assumption that when nrf7002 stays in power saving state the host mcu should also consume as low power as possible.

    Apologies for long post. But any help is greatly appreciated. Slight smile

    Best Regards,

    Arjun

     

  • Hi Arjun,

     

    Q1: Could you try to run wifi/sta, compiled for board "nrf7002dk/nrf5340/cpuapp" with the configuration that I suggested to see if this yields expected results?

    Q2: Which revision of the nRF7002-DK do you have?

    Q3: There is a statical current in your measurements, ie. the current is flat at around 300 uA, indicating a resistive load.

    Have you altered the external flash connection? Ie. Have you tried cutting SB8 and soldering SB10 to connect the ext flash to the VDDMEAS net?

    https://docs.nordicsemi.com/bundle/ug_nrf7002_dk/page/UG/nrf7002_DK/solder_bridge.html

     

    Kind regards,

    Håkon

  • Hi Hakon,

    Thanks for the feedback and sorry for the late reply.

    Q1: Yes, we also tried your modification to the wifi/sta example. You can see the results below. The base current still is above ~300uA. As you can see when the nrf7002 is in DTIM PS mode I expected that the host MCU not consume high current. This can also be tested by putting the wifi IC in twt mode. In twt mode the IC has target wakeup time. During this time host MCU pretty much will have nothing to do and yet we see base current of 300uA.

    Q2: We are using PCA10143, 1.0.2, 2023.25 . This is what it says on the label of the DK

    Q3: We have done no other modification to the dev kit except closing SB17 and cutting SB16. This is as recommended for dual current measurement setup.

    Best Regards,

    Arjun

Related