7002 power consumption

I'm using custom board of nrf5340 with nrf7002.

Use helloworld sample and have set "config serial=n" and "config device pm =y".

The current is 90 ma when I don't do anything in the code, so I must initialize wifi interface to let the current be much lower.

There are two situations what I encounter.

1. The current is 1 ma when I use api, "interface down", to shutdown nrf7002.

2. The current is 0.5 ma when modify hardware to let the line of iovdd of nrf7002 disconnect.

The current difference of two situations is 0.5 ma, what causes the difference of current? How can I further reduce the current? 

  • Hi,

    Since the nRF5340, you need to disable serial on both cores. What do you run on the network core?

    The same would be true for other child images as well. Do you run a bootloader?

    Regards,
    Sigurd Hellesvik

  • Hi, I've disable serial in both cores(include mcuboot, hcirpmsg, b0n), and it's 1ma for shutdown 7002(wifi interface down).This project enable bluetooth, so it has network core image.

    ////wifi////
    static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb)
    {
    	const struct wifi_scan_result *entry =
    		(const struct wifi_scan_result *)cb->info;
    	uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")];
    
    	scan_result++;
    
    	if (scan_result == 1U)
    	{
    		printk("%-4s | %-32s %-5s | %-4s | %-4s | %-5s | %s\n",
    			   "Num", "SSID", "(len)", "Chan", "RSSI", "Security", "BSSID");
    	}
    
    	printk("%-4d | %-32s %-5u | %-4u | %-4d | %-5s | %s\n",
    		   scan_result, entry->ssid, entry->ssid_length,
    		   entry->channel, entry->rssi,
    		   (entry->security == WIFI_SECURITY_TYPE_PSK ? "WPA/WPA2" : "Open    "),
    		   ((entry->mac_length) ? net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN, mac_string_buf,
    														 sizeof(mac_string_buf))
    								: ""));
    }
    
    static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb)
    {
    	const struct wifi_status *status =
    		(const struct wifi_status *)cb->info;
    
    	if (status->status)
    	{
    		LOG_ERR("Scan request failed (%d)", status->status);
    	}
    	else
    	{
    		LOG_INF("Scan request done\n");
    	}
    
    	scan_result = 0U;
    	k_sem_give(&scan_sem);
    }
    
    static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb,
    									uint32_t mgmt_event, struct net_if *iface)
    {
    	switch (mgmt_event)
    	{
    	case NET_EVENT_WIFI_SCAN_RESULT:
    		handle_wifi_scan_result(cb);
    		break;
    	case NET_EVENT_WIFI_SCAN_DONE:
    		handle_wifi_scan_done(cb);
    		break;
    	default:
    		break;
    	}
    }
    
    static int wifi_scan(void)
    {
    	struct net_if *iface = net_if_get_default();
    
    	if (net_mgmt(NET_REQUEST_WIFI_SCAN, iface, NULL, 0))
    	{
    		LOG_ERR("Scan request failed");
    
    		return -ENOEXEC;
    	}
    
    	LOG_INF("Scan requested\n");
    
    	k_sem_take(&scan_sem, K_MSEC(SCAN_TIMEOUT_MS));
    
    	return 0;
    }
    
    static bool is_mac_addr_set(struct net_if *iface)
    {
    	struct net_linkaddr *linkaddr = net_if_get_link_addr(iface);
    	struct net_eth_addr wifi_addr;
    
    	if (!linkaddr || linkaddr->len != WIFI_MAC_ADDR_LEN)
    	{
    		return false;
    	}
    
    	memcpy(wifi_addr.addr, linkaddr->addr, WIFI_MAC_ADDR_LEN);
    
    	return net_eth_is_addr_valid(&wifi_addr);
    }
    
    // static void button_handler_cb(uint32_t button_state, uint32_t has_changed)
    // {
    //         if ((has_changed & DK_BTN1_MSK) && (button_state & DK_BTN1_MSK))
    //         {
    //                 exit_shutdown_mode();
    //         }
    //         else if ((has_changed & DK_BTN2_MSK) && (button_state & DK_BTN2_MSK))
    //         {
    //                 enter_shutdown_mode();
    //         }
    // }
    
    // static void buttons_init(void)
    // {
    //         int err;
    
    //         err = dk_buttons_init(button_handler_cb);
    //         if (err)
    //         {
    //                 LOG_ERR("Buttons initialization failed.\n");
    //                 return;
    //         }
    // }
    
    int shutdown_wifi(struct net_if *iface)
    {
    	int ret;
    
    	if (!net_if_is_admin_up(iface))
    	{
    		return 0;
    	}
    
    	ret = net_if_down(iface);
    	if (ret)
    	{
    		LOG_ERR("Cannot bring down iface (%d)", ret);
    		return ret;
    	}
    
    	LOG_INF("Interface down");
    
    	return 0;
    }
    
    int startup_wifi(struct net_if *iface)
    {
    	int ret;
    
    	if (!net_if_is_admin_up(iface))
    	{
    		ret = net_if_up(iface);
    		if (ret)
    		{
    			LOG_ERR("Cannot bring up iface (%d)", ret);
    			return ret;
    		}
    
    		LOG_INF("Interface up");
    	}
    
    	wifi_scan();
    
    	return 0;
    }
    
    void enter_shutdown_mode(void)
    {
    	struct net_if *iface = net_if_get_default();
    
    	shutdown_wifi(iface);
    }
    
    void exit_shutdown_mode(void)
    {
    	struct net_if *iface = net_if_get_default();
    
    	startup_wifi(iface);
    }
    void wifi_init_and_shutdown(void)
    {
    	scan_result = 0U;
    
    	net_mgmt_init_event_callback(&wifi_shell_mgmt_cb,
    								 wifi_mgmt_event_handler,
    								 WIFI_SHELL_MGMT_EVENTS);
    
    	net_mgmt_add_event_callback(&wifi_shell_mgmt_cb);
    
    	printk("Starting %s with CPU frequency: %d MHz\n", CONFIG_BOARD, SystemCoreClock / MHZ(1));
    
    	if (!is_mac_addr_set(net_if_get_default()))
    	{
    		struct net_if *iface = net_if_get_default();
    		int ret;
    		struct ethernet_req_params params;
    
    		if (net_if_is_up(iface))
    		{
    			/* Set a local MAC address with Nordic OUI */
    			ret = net_if_down(iface);
    			if (ret)
    			{
    				printk("Cannot bring down iface (%d)\n", ret);
    				return ret;
    			}
    		}
    
    		ret = net_bytes_from_str(params.mac_address.addr, sizeof(CONFIG_WIFI_MAC_ADDRESS), CONFIG_WIFI_MAC_ADDRESS);
    		if (ret)
    		{
    			printk("Failed to parse MAC address: %s (%d)\n",
    				   CONFIG_WIFI_MAC_ADDRESS, ret);
    			return ret;
    		}
    
    		net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, iface,
    				 &params, sizeof(params));
    		// net_mgmt(NET_REQUEST_WIFI_PS, iface, &params, sizeof(params)); // test
    		ret = net_if_up(iface);
    		if (ret)
    		{
    			printk("Cannot bring up iface (%d)\n", ret);
    			return ret;
    		}
    
    		LOG_INF("OTP not programmed, proceeding with local MAC: %s\n", net_sprint_ll_addr(
    																		   net_if_get_link_addr(iface)->addr,
    																		   net_if_get_link_addr(iface)->len));
    	}
    
    	// buttons_init();
    
    	// exit_shutdown_mode();
    
    	enter_shutdown_mode();
    }
    ////wifi////
    // const struct device *uart_dev = DEVICE_DT_GET(DT_NODELABEL(nrf7002));
    
    int main(void)
    {
    	wifi_init_and_shutdown();
    	NRF_POWER->TASKS_LOWPWR = 1;
    	power_down_unused_ram();
    	while (1)
    	{
    		/* code */
    		// k_msleep(1000);
    		k_cpu_idle();
    	}
    
    	return 0;
    }	

    I also have tried another project which only print helloworld and shutdown 7002, and it only has app core image, don't have bootloader and network core image, it's 1 ma.

    And also I tried the project which only print helloworld with disconnecting the iovdd line on the nrf7002 ic, it's 0.36ma  

    #include <stdio.h>
    #include <zephyr/drivers/gpio.h>
    #include <zephyr/logging/log.h>
    #include <zephyr/kernel.h>
    LOG_MODULE_REGISTER(ctrl, LOG_LEVEL_INF);
    struct gpio_dt_spec PWR_UP = GPIO_DT_SPEC_GET(DT_NODELABEL(pwrup), gpios);
    
    int main(void)
    {
    	printk("Starting %s with CPU frequency:% d MHz\n", CONFIG_BOARD, SystemCoreClock / MHZ(1));
    	gpio_pin_configure_dt(&PWR_UP, GPIO_OUTPUT);
    	gpio_pin_set_dt(&PWR_UP, 1);
    	printf("Hello World! %s\n", CONFIG_BOARD);
    	// NRF_POWER->TASKS_LOWPWR = 1;
    	// power_down_unused_ram();
    	while (1)
    	{
    		/* code */
    		// k_msleep(1000);
    		k_cpu_idle();
    	}
    	return 0;
    }

    I don't know what is the normal current consumption, can it be 2 micro Amp according to the article says?Or it means only 7002 ic, not include the current of nrf5340?

    Regards,
    Allen

  • Can you test our Wi-Fi shut down sample and see if that shows expected current consumption?

Related