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

How optimize high current consumption in sleep mode using nRF52840?

Hello to all,

We have developed our application & the following platform we are using:

  • SDK 15.0, Segger IDE on windows PC
  • Softdevice version is 6.0.0
  • Hardware version nRF52840 SoC.
  • Our product is battery operated, so high power consumption is serious an issue for us.

In our application we have used ble_app_uart example with SAADC because our sensor is analog. We also made custom PCB using nRF52840 and it working well not an issue. But our problem is very too much high current consumption is sleep mode means system OFF mode.

Here is below measured analysis with the help of Nordic Power Profile kit:

  1. The average current consumption while advertising is 962uA - 1.62mA I think this is OK.
  2. The average current consumption when sensor device enter into sleep mode is 562uA (Which is very high)

We have disabled all used peripheral before enter device into sleep mode as like below:

void sleep_mode_enter() {
  uint32_t err_code;
  NRF_LOG_INFO("Sleep mode Enter");
  flash_data_sending = false;
  start_measurement = false;
  nrf_gpio_pin_clear(SENSOR_PIN);  // OFF Sensor
  nrf_gpio_pin_set(GREEN_LED_PIN); // OFF Green LED
  nrf_gpio_pin_set(BLUE_LED_PIN);  // OFF BLUE LED
  stop_adc();
  err_code = app_uart_close();
  APP_ERROR_CHECK(err_code);
  NRF_LOG_INFO("UART close: %d", err_code);
}

void stop_adc() {
  nrf_drv_timer_disable(&m_timer);
  nrf_drv_timer_uninit(&m_timer);
  nrf_drv_ppi_channel_disable(m_ppi_channel);
  nrf_drv_ppi_uninit();
  NRF_SAADC->TASKS_STOP = 1;
  nrf_drv_saadc_uninit();
}

We have tested our hardware and sure this not hardware problem because when our device enter into deep sleep mode system OFF that time the current consumption near about 0.7uA to 1uA. Even when our designed firmware upload into nRF52840 DK and measured consumption using PPK that time got same results.

Questions:

  1. Why this too much very high power consumption getting in sleep mode?
  2. Is any wrong in our sleep mode enter function and disabled module functions?

Will you please suggest any solution, We should need to optimize this consumption to increase battery life because our sensor devices is battery operated.

Looking forward your response..!!

Thanks in advanced..!! 

  • Hello,

    I have tried NRF_UARTE0->ENABLE=1. but this not work for enable UART. 

    Regarding the switch i am using simple tactile type switch.

    "When use above snippet for disabled and enabled UART in this case switch is working but not enable UART functionality when enabled UART."

    I am saying that when i used NRF_UARTE0->ENABLE = 0; the UART is disabled and goes into sleep mode but when sensor device wake up and used NRF_UARTE0->ENABLE = 1; for enabled UART not working UART functionality.  

    Thanks....!!!

  • Hi Vishal

    Thanks for clarifying your design! What exactly is the functionality of this switch? 

    Can you confirm that UART works before you are disabling it using NRF_UARTE0->ENABLE = 0;? And also confirm that your application actually awakes when you are enabling UART again. If it is still asleep it won't matter if the UART is disabled or not, as the chip won't do anything with it until it awakes.

    Also could you send me a snippet of your code where you show the full sleep and wake up function? It seems like something is not correctly configured here.

    Best regards,

    Simon

  • Hi,

    The functionality of switch is when sensor device in sleep mode/ monitoring mode to enter device into configuration mode user should need to pressed switch twice. If device in deep sleep mode user should need to pressed switch single time.

    In our system the application of UART is external WiFi module is interfaced with Nordic nRF52840.

    When device configured and put into monitoring/sleep mode, it will wake up as predefined time and enabled UART, Enabled SAADC, and started taking sensor data after done device will send data to server using WIFI. But WiFi module is not responding due to problem while enabling UART. 

    Here is below program snippet that we are using:

    void stop_adc() {
      nrf_drv_timer_disable(&m_timer);
      nrf_drv_timer_uninit(&m_timer);
      nrf_drv_ppi_channel_disable(m_ppi_channel);
      nrf_drv_ppi_uninit();
      NRF_SAADC->TASKS_STOP = 1;
      nrf_drv_saadc_uninit();
    }
    
    /**
     * This function is used for disabled UART peripherals in sleep mode.
     */
    void disabled_uart(void) {
    //  uint32_t err_code = app_uart_close();
    //  APP_ERROR_CHECK(err_code);
      NRF_UARTE0->TASKS_STOPTX = 1;
      NRF_UARTE0->TASKS_STOPRX = 1;
      NRF_UARTE0->ENABLE = 0;
      /* Workaround by disabling the UART peripherals due to Nordic SDK15.0 issue */
      *(volatile uint32_t *)0x40002FFC = 0; /* Power down UARTE0 */
      *(volatile uint32_t *)0x40002FFC;     
      *(volatile uint32_t *)0x40002FFC = 1; /* Power on UARTE0 so it is ready for next time */
    }
    
    /**@brief Function for putting the chip into sleep mode.
     *
     * @note This function will not return.
     */
    void sleep_mode_enter() {
      uint32_t err_code;
      NRF_LOG_INFO("Sleep mode Enter");
      flash_data_sending = false;
      start_measurement = false;
      nrf_gpio_pin_clear(WIFI_PIN); /* OFF WiFi module */
      nrf_gpio_pin_clear(SENSOR_PIN);  /* OFF Sensor */
      nrf_gpio_pin_set(GREEN_LED_PIN); /* OFF Green LED */
      nrf_gpio_pin_set(BLUE_LED_PIN);  /* OFF BLUE LED */
      stop_adc();
      disabled_uart();
    }
    
    
    

    For enabling UART using below:

    NRF_UARTE0->TASKS_STARTTX = 1;
    NRF_UARTE0->TASKS_STARTRX = 1;
    NRF_UARTE0->ENABLE = 1;

    Still we are facing this issue, and getting strange for fixing this issue?

    Thanks you for helping..!!!

  • Hi

    How are you going into system OFF mode though? You are just disabling your peripherals here. This is how your sleep_mode_enter() function should look

    /**@brief Function for putting the chip into sleep mode.
     *
     * @note This function will not return.
     */
    static void sleep_mode_enter(void)
    {
        ret_code_t err_code;;
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
    
        // Prepare wakeup buttons.
        err_code = bsp_btn_ble_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }

    I don't think you need to disable the UART here, as the chip doesn't retain any functions except RTC0 when sleeping in system OFF mode. Please refer to our example projects (ble_app_gls for example) for insight into these functions.

    Best regards,

    Simon

  • Hi,

    No, I do not want to put device in system OFF because in this mode RTC not working for wake sensor device.

    As mentioned Here I have also tried to set ENABLE register to 8 but still getting same problem. Will you please tell me is this issue SDK 15.0? How do I check in my application which UART using UART0 OR UARTE0?

    Thanks for supporting.......

Related