NRF7002 DK system shutdown

Hi,

Background:

My questions are:

  1. Which sample shall I base my project on?
  2. The wifi/shutdown sample page states that "This also demonstrates how to achieve the lowest possible power consumption in the Host SoC (nRF53, nRF52 or nRF91 Series) when Wi-Fi is enabled but not being used." - How is this achieved? I can only see function net_if_down() is used. I assume this will only turn off the nRF7002 wifi chip, but not the host?
  3. The system_off sample uses sys_poweroff() function, will this shut down both nRF5340 and nRF7002 chips? What happens when BT and/or Wifi are being used?

Many thanks in advance! 

Parents
  • Hi,

     

    Background:

    My questions are:

    1. Which sample shall I base my project on?

    To shut down the nRF700x device, please see the sequence given in samples/wifi/shutdown.

    This will completely turn off the power to the nRF700x.

     

    The wifi/shutdown sample page states that "This also demonstrates how to achieve the lowest possible power consumption in the Host SoC (nRF53, nRF52 or nRF91 Series) when Wi-Fi is enabled but not being used." - How is this achieved? I can only see function net_if_down() is used. I assume this will only turn off the nRF7002 wifi chip, but not the host?

    This is not entirely true, as the logger is enabled. This will cause the host controller to draw approx. 0.5 mA in sleep. I will report this internally as a documentation error.

    To get to a lower current consumption, disabling of the serial interface is required (CONFIG_LOG=n and CONFIG_SERIAL=n).

     

     This example will show how to set the nRF5-device into "SystemOff", which should consume <1 uA:

    This is the lowest power mode, and the device can only be awoken from combinatory logic (GPIO/RESET signal for instance).

    The system_off sample uses sys_poweroff() function, will this shut down both nRF5340 and nRF7002 chips? What happens when BT and/or Wifi are being used?

    This will only shut down the host controller.

    The nRF700x must be taken down by implementing the wifi/shutdown/main.c::shutdown_wifi() function.

     

    Kind regards,

    Håkon 

  • Thanks for your reply. Are you suggesting that I only need to use net_if_down() if I want to turn off both host and wifi chip (regardless of the logging for now)?

  • Hi,

     

    The nRF5340 will continue running code afterwards, and it will require specific code in order to enter SystemOn or SystemOff mode.

    The shutdown sample, from the nRF5340 point of view, does not do much, so there it will enter the idle thread with serial logging enabled, giving a floor current of approx. 0.5 mA.

     

    If you disable all bus peripherals, ie. logging and such, it will be in the lower uA range. Entering systemoff will be even lower.

     

    Kind regards,

    Håkon

  • Thank you, this is more clearer!
    So below is my shutdown sequence for the wifi chip.

    It works if I just use net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0) to connect to the existing wifi.

    However, if I'm doing BT-provisioning (copied from the BT-wifi provisioning sample), this routine won't run successfully, it will get stuck at net_if_down(iface). I suspect this is because the wifi stack is still running.
    So my question is how do I stop an on-going provisioning service so that I can turn off the wifi chip completely afterwards?
    Many thanks!

    int shutdown_wifi()
    {
    	int ret;
      	struct net_if *iface = net_if_get_default();
    
    	if (!net_if_is_admin_up(iface)) {
    		return 0;
    	}
    
    	if (!net_if_is_up(iface)){
    		return 0;
    	}
    	ret = net_if_down(iface);
    	if (ret) {
    		LOG_ERR("net_if_down failed: %d", ret);
    		return ret;
    	}
    
    	LOG_INF("Interface down");
    
    	return 0;
    }

  • Hi,

     

    Can you share a log showing the issue?

    Where is the shutdown_wifi() function called from? This should not be called from a interrupt.

     

    Kind regards,

    Håkon

  • Hi, 
    I'm calling it from a callback function of a watchdog timer. Please see below:

    void system_shutdown()
    {
    	shutdown_wifi();
    	k_sleep(K_SECONDS(1));
    	sys_poweroff();
    }
    
    void timer_system_shutdown(struct k_timer *timer_id)
    {
    	LOG_ERR("watchdog triggered");
    	system_shutdown();
    }
    
    K_TIMER_DEFINE(watchdog_timer, timer_system_shutdown, NULL);
    
    void kick_watchdog()
    {
    	  k_timer_start(&watchdog_timer, K_MINUTES(CONFIG_WATCHDOG_KICK_INTERVAL_MINUTES), K_MINUTES(CONFIG_WATCHDOG_KICK_INTERVAL_MINUTES));
    }

  • Hi,

     

    k_timer runs in interrupt context. You should schedule this to main / thread context, for instance using a workqueue.

     

    Kind regards,

    Håkon

Reply Children
No Data
Related