This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

High power consumption while enabling interrupt and going into deep sleep

Hello Nordic team,

Our current setup:

  • nRF52840
  • nRF SDK v15.00

In our current setup, the steps we take are as following:

Initialize nRF52840 -> BLE fast advertisement -> BLE slow advertisement -> Deep sleep

Once the timeout is completed for BLE advertising, we put nRF52840 to deep sleep.

We want to wake up our nRF system when we receive an external interrupt (High). 
To accomplish this, we set up a pin as shown below

    nrfx_gpiote_in_config_t pin_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
    pin_config.pull = NRF_GPIO_PIN_PULLDOWN;

    if (gpiote_drv_initialized == false)
    {
        err_code = nrfx_gpiote_init();
        check_error_code(__func__, err_code, 1);
        gpiote_drv_initialized = true;
    }

    if (irq_enabled == true)
    {
        err_code = nrfx_gpiote_in_init(MOTION_IRQ_PIN, &pin_config, gpio_irq_evt_handler);
        check_error_code(__func__, err_code, 2);
        nrfx_gpiote_in_event_enable(MOTION_IRQ_PIN, true);
    }

Once pins are set and the interrupt is triggered, interrupt handler function sets wom_interrupt_event = true

My main function while loop:

    while (1)
    {
        if (interrupt_evt != true)
        {
            err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
            check_error_code(__func__, err_code, 1);

            gpio_interrupt_config(false);
            interrupt_evt_processing = false;
        }

        check_advertising_state();

        while (wom_interrupt_evt != true)
        {
            __SEV();
            __WFE();
            // Enter System ON sleep mode
            __WFE();
        }

        interrupt_evt = false;
        wom_interrupt_evt = false;
    }

system_shutdown()

    err_code = sd_power_system_off();
    check_error_code(__func__, err_code, 1);

Though, everything works as intended in our case. The power consumption during deep sleep seems to be quite high.

Looking over into the forums, I saw a lot of suggestions regarding changing the pin_config with hi_accuracy disabled.
Some other forums suggested something to do with latches, which I could not completely understand, (link)

My questions:

  • Could you please let us know if there are any changes to be made to the pin configuration above which can help us save power. 
  • Could you also let me know if my shutdown configuration and appropriate.
  • Where/when should I call the system_shutdown() function if I want to enable the interrupt detection pin before going into deep sleep.

Please let me know in case you need any more info. Thanks in advance.

Regards,
Avi

Parents
  • Hi Avi

    I can't spot any immediate issues in your code. 

    When you say the current consumption is "quite high", are you able to quantify this?
    The exact current consumption can some times point to the cause of the issue. 

    How about System ON sleep current, is this as expected?

    How are you testing the current consumption?

    Are you testing this on custom hardware or on a DK?

    If it is custom hardware, are you sure it is the nRF device drawing excessive current and not some other part of the system?

    As for the LATCH register, this is not something you need to worry about when using the GPIOTE driver. It is handled automatically. 

    Not using an input in low accuracy mode should add around 20uA to the sleep current. 

    Best regards
    Torbjørn

  • Hello Torbjørn
    (@ovrebekk),

    Thank you for your prompt and detailed response. I have tried my best to answer all the questions. 
    Please have a look and let me know if I can add any more details to help you in any way possible.

    Method of measuring:
    I am quantifying the power draw measurements by measuring the voltage drop across every 24 hours using a fully charged battery at the start. And I also measure the number of days they are usable before complete depletion.

    Our hardware:
    We have a custom hardware. The only external component is an IMU and a battery on board and IMU is put to sleep/wake-on-motion before nRF52840 is put to deep sleep. 

    Power consumption tests:
    I have tried several configurations. There is one configuration which performs as per our expectations and calculations and lasts for 2 weeks as we expect, so we know it is completely possible. There is something we might be overlooking while configuring.

    Configuration which shows the desired behavior:
    Below is the part main() function for the configuration which gives us the desired results:
    (In the code below, only a single line system_shutdown() call is added when while (wom_interrupt_evt != true), rest is same as in the main question)
    By adding this call we are able to see the desired system power consumption as per the documentation, but we lose the wake-on-motion functionality.

        while (1)
        {
            if (interrupt_evt != true)
            {
                err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
                check_error_code(__func__, err_code, 1);
    
                gpio_interrupt_config(false);
                interrupt_evt_processing = false;
            }
    
            check_advertising_state();
    
            while (wom_interrupt_evt != true)
            {
                system_shutdown();
                __SEV();
                __WFE();
                // Enter System ON sleep mode
                __WFE();
            }
    
            interrupt_evt = false;
            wom_interrupt_evt = false;
        }


    Real question:
    Could you please tell us a way in which we can incorporate both wake-on-motion feature and the shutdown to save power.

    Thank you for clearing up the bit with LATCH, that we don't need to worry about it.

    We thank you immensely for you help and support.

    Regards,

    Avi

Reply
  • Hello Torbjørn
    (@ovrebekk),

    Thank you for your prompt and detailed response. I have tried my best to answer all the questions. 
    Please have a look and let me know if I can add any more details to help you in any way possible.

    Method of measuring:
    I am quantifying the power draw measurements by measuring the voltage drop across every 24 hours using a fully charged battery at the start. And I also measure the number of days they are usable before complete depletion.

    Our hardware:
    We have a custom hardware. The only external component is an IMU and a battery on board and IMU is put to sleep/wake-on-motion before nRF52840 is put to deep sleep. 

    Power consumption tests:
    I have tried several configurations. There is one configuration which performs as per our expectations and calculations and lasts for 2 weeks as we expect, so we know it is completely possible. There is something we might be overlooking while configuring.

    Configuration which shows the desired behavior:
    Below is the part main() function for the configuration which gives us the desired results:
    (In the code below, only a single line system_shutdown() call is added when while (wom_interrupt_evt != true), rest is same as in the main question)
    By adding this call we are able to see the desired system power consumption as per the documentation, but we lose the wake-on-motion functionality.

        while (1)
        {
            if (interrupt_evt != true)
            {
                err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
                check_error_code(__func__, err_code, 1);
    
                gpio_interrupt_config(false);
                interrupt_evt_processing = false;
            }
    
            check_advertising_state();
    
            while (wom_interrupt_evt != true)
            {
                system_shutdown();
                __SEV();
                __WFE();
                // Enter System ON sleep mode
                __WFE();
            }
    
            interrupt_evt = false;
            wom_interrupt_evt = false;
        }


    Real question:
    Could you please tell us a way in which we can incorporate both wake-on-motion feature and the shutdown to save power.

    Thank you for clearing up the bit with LATCH, that we don't need to worry about it.

    We thank you immensely for you help and support.

    Regards,

    Avi

Children
  • Hi Avi

    Is there any way you can connect an amperemeter between the battery and the board supply, so you can monitor the current draw live without having to wait and see how long the battery will last?

    Then it should be quite easy to see how much difference there is in current consumption when enabling the motion interrupt. 

    Also, have you tried to measure the voltage of the motion pin to ensure it is low when the device is in sleep?

    What is the rated capacity of the battery you are using?

    Best regards
    Torbjørn

Related