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

NRF52832 Adafruit high power consumption

Hi,

I would like to make a system that goes to sleep for a while and wakes up for a short time thanks to the rtc.

According to the documentation, the power consumption of the nrf52832 should go down to a few uA, but I get an average power consumption of 587 uA.

I tested many example codes and did a lot of research but the power consumption remains the same, impossible to go down to less.

I tried to remove the debug but the power consumption did not change.

Is there someone who has a lower consumption and who could give me a piece of code to test, the ideal would be a few uA.

My code :

#include <stdbool.h>
#include <stdint.h>
#include "boards.h"
#include "app_timer.h"
#include "app_error.h"
#include "nrf_drv_clock.h"
#include "nrf_pwr_mgmt.h"
#include "time.h"

// Change the following defines to change the RTC timer used or the interrupt priority
#define CAL_RTC                 NRF_RTC0
#define CAL_RTC_IRQn            RTC0_IRQn
#define CAL_RTC_IRQHandler      RTC0_IRQHandler
#define CAL_RTC_IRQ_Priority    50

static struct tm time_struct, m_tm_return_time; 
static time_t m_time, m_last_calibrate_time = 0;
static float m_calibrate_factor = 0.0f;
static uint32_t m_rtc_increment = 5;
static void (*cal_event_callback)(void) = 0;

void CAL_RTC_IRQHandler(void)
{
    if(CAL_RTC->EVENTS_COMPARE[0])
    {
        CAL_RTC->EVENTS_COMPARE[0] = 0;
        
        CAL_RTC->TASKS_CLEAR = 1;

        //  TODO
    }
}

void nrf_cal_init(void)
{
     // Select the 32 kHz crystal and start the 32 kHz clock
    NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos;
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
    
    // Configure the RTC for 1 minute wakeup (default)
    CAL_RTC->PRESCALER = 0xFFF;
    CAL_RTC->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
    CAL_RTC->INTENSET = RTC_INTENSET_COMPARE0_Msk;
    CAL_RTC->CC[0] = m_rtc_increment * 8;
    CAL_RTC->TASKS_START = 1;
    NVIC_SetPriority(CAL_RTC_IRQn, CAL_RTC_IRQ_Priority);
    NVIC_EnableIRQ(CAL_RTC_IRQn);  
}

/**@brief Function for initializing low-frequency clock. */
static void lfclk_config(void)
{
    ret_code_t err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);

    nrf_drv_clock_lfclk_request(NULL);
}


/**
 * @brief Function for application main entry.
 */
int main(void)
{

    lfclk_config();

    uint32_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    ret_code_t ret_code = nrf_pwr_mgmt_init();
    APP_ERROR_CHECK(ret_code);

    nrf_cal_init();

    while (true)
    {
        nrf_pwr_mgmt_run();
    }
}

Thank you for your help,

Parents
  • Hello Antoine,

    Confirming your findings of 114uA when the device is doing nothing.

    I was able to lower the current to 96uA by ground the EN pin for the regulator. From the datasheet, this can consume around 55uA quiescent current.

    Given there is only a few other components on the board, the current would either be coming from the USB/TTL bridge, the Lipo charger, or something related to the voltage divide battery monitoring on A7.

Reply
  • Hello Antoine,

    Confirming your findings of 114uA when the device is doing nothing.

    I was able to lower the current to 96uA by ground the EN pin for the regulator. From the datasheet, this can consume around 55uA quiescent current.

    Given there is only a few other components on the board, the current would either be coming from the USB/TTL bridge, the Lipo charger, or something related to the voltage divide battery monitoring on A7.

Children
No Data
Related