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, 
    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

  • Ok, I've added a workqueue, so net_if_down() doesn't stuck any more.
    However, it doesn't reduce power consumption, in contrast, it increased current draw.
    Here's the code:

    void system_shutdown()
    {
        shutdown_wifi();
    	sendMsgToSTM(PacketReply_t_nrf_shutdown_tag);
    	k_sleep(K_SECONDS(1));
    	sys_poweroff();
    }
    
    void watchdog_work_handler(struct k_work *work)
    {
        LOG_ERR("Watchdog triggered: handling in work queue");
        system_shutdown();
    }
    
    void timer_system_shutdown(struct k_timer *timer_id)
    {
    	k_work_submit_to_queue(&my_workq, &watchdog_work);
    }
    
    K_TIMER_DEFINE(watchdog_timer, timer_system_shutdown, NULL);
    
    void setUpWatchdog()
    {
    	// Initialize the work queue
        k_work_queue_start(&my_workq, my_workq_stack, 
                           K_THREAD_STACK_SIZEOF(my_workq_stack), 
                           CONFIG_SYSTEM_WORKQUEUE_PRIORITY, NULL);
    
        // Initialize the work item
        k_work_init(&watchdog_work, watchdog_work_handler);
    	LOG_ERR("watchdog triggered");
    }
    
    void kick_watchdog()
    {
    	k_timer_start(&watchdog_timer, K_MINUTES(CONFIG_WATCHDOG_KICK_INTERVAL_MINUTES), K_MINUTES(CONFIG_WATCHDOG_KICK_INTERVAL_MINUTES));
    }

  • In my case, current draw increased from ~10mA to ~120mA when I step in this line inside net_if_down():

    status = net_if_l2(iface)->enable(iface, false);

  • Hi,

     

    You see 120 milliamps?

    That indicates that something went terribly wrong.

     

    Have you checked that the shutdown-sample works as expected on your end? 

    I ran the snippet in the sta/ sample and used the shutdown function as shown here:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.7.0/samples/wifi/shutdown/src/main.c#L155-L172

     

    And measure < 5 uA when it is shut down.

     

    Kind regards,

    Håkon

Reply Children
No Data
Related