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..!! 

  • Hi Vishal

    Yes, of course, we had narrowed the issue down to the UART. Sorry about the oversight! 

    The UART might not be closing properly because the logging module is using it when you call app_uart_close();. Could you make sure the logging module is not using UART when you close it?

    If this doesn't help, I think the next step would be to upload your main.c and sdk_config.h file here, so I can have a look at what exactly is happening, as I'm having a hard time figuring it out without having a better overview. If you don't want to share these files with the community, please tell me before you upload, and I will set this case to private so that only Nordic engineers will be able to see this post.

    Best regards,

    Simon

  • Hi,

    I have disabled NRF log module in sdk_config.h as below:

    #define NRF_LOG_ENABLED 0

    #define NRF_LOG_BACKEND_RTT_ENABLED 0

    But nothing any affect on sleep mode consumption. Sorry Simonr I am not able to share our main.c file to here I can share sdk_config.h 

    Is any other solution?

    Thanks for helping...!!!!

  • Hi Vishal

    Sure, the config file might help, I'll at least be able to look through it and make sure you haven't missed anything. Would you like me to make the case private anyway? I see that in your original post you call "NRF_LOG_INFO("UART close: %d", err_code);" after you close the UART. Have you tried commenting out that, maybe that logger function uses the logging module and stops the UART from closing properly? Just a shot in the dark though.

    Also, could you check the return value of the app_uart_close() function? Does it return NRF_SUCCESS or something else? 

    Best regards,

    Simon

  • Hi,

    Also, could you check the return value of the app_uart_close() function?

    Yes I have already checked and value is 0 means NRF_SUCCESS.

    after you close the UART. Have you tried commenting out that,

    I was remove this but still nothing any change in power consumption.

    I have attached my project sdk_config.h file here.

    0181.sdk_config.h

    here is my below updated functions:

    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();
    }
    
    void stop_ble() {
      uint32_t err_code;
        err_code = sd_ble_gap_adv_stop(m_conn_handle); // stop BLE advertising
        APP_ERROR_CHECK(err_code);
    }
    
    /**@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;
      if ((strcmp((char *)s_info.config_flag, "true") == 0)) { /*Check if config mode enter and called sleep_mode_enter when server request status completed */
        nrf_gpio_pin_set(WIFI_PIN); /*ON WIFI module*/
      } else {
        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();
      err_code = app_uart_close();
      APP_ERROR_CHECK(err_code);
    }
    

    Let me know your suggestions?

    Thanks..

  • Hi Vishal

    Could you try setting the UARTE_ENABLED define in your sdk_config.h file to 0? I don't see why it should, but maybe it prevents the UART from closing properly. Overall, your config file looks good though. 

    Do you mind sharing how you initialize the UART as well?

    Best regards,

    Simon

Related