Optimizing power consumption with TIMER peripheral

Hi,

I am currently working on evaluation of the nRF52810 for a simple project which requires a very low power consumption. I searched and found an example which I modified to my needs. The function is very simple - start the chip, initialize TIMER1 and use PPI to create PWM waveform with frequency of 150 Hz. The idea was to use the core only for initialization and then basically stay in System ON mode indefinitely thus limiting the power consumption. I expected power consumption around some 50 to 100 uA. Instead I get some 375 uA once I start the timer. My question is essentially is this normal? If so is there a way how to reach the aforementioned power consumption of 50 to 100 uA with some optimization of my code? 

I am running the example on nRF52 DVK which is adjusted for current measurements. I am supplying power via P22 (around 2 V) and measuring using ampermeter on P21 . SB9 has been cut and SB22 has been shorted. I am not using any softdevice, the implementation is bare metal. The example used is based on SDK 17.0.2. 

I already tried running the code just with the while loop and afterwards I reach current around 1 uA which should be correct. Thus I think I dont have any other peripherals initialized so thats not where the power consumption comes from. 

Any suggestions would be greatly appreciated! 

Code here:

#include <stdbool.h>
#include <stdint.h>
#include "boards.h"

// Peripheral channel assignments
#define PWM0_TIMER_CC_NUM   0
#define TIMER_RELOAD        209  //cca 150 Hz switching frequency
#define TIMER_RELOAD_CC_NUM 0

#define PIN                 8

void timer_init()
{
    NRF_TIMER1->BITMODE                 = TIMER_BITMODE_BITMODE_08Bit << TIMER_BITMODE_BITMODE_Pos;
    NRF_TIMER1->PRESCALER               = 9; //31250Hz
    NRF_TIMER1->SHORTS                  = TIMER_SHORTS_COMPARE0_CLEAR_Msk << TIMER_RELOAD_CC_NUM;
    NRF_TIMER1->MODE                    = TIMER_MODE_MODE_Timer << TIMER_MODE_MODE_Pos;
    NRF_TIMER1->CC[TIMER_RELOAD_CC_NUM] = TIMER_RELOAD;
}

void timer_start()
{
    NRF_TIMER1->TASKS_START = 1;
}

void pwm0_init()
{  
    NRF_GPIOTE->CONFIG[0] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
                            GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos |
                            PIN << GPIOTE_CONFIG_PSEL_Pos |
                            GPIOTE_CONFIG_OUTINIT_High << GPIOTE_CONFIG_OUTINIT_Pos;

    NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TIMER1->EVENTS_COMPARE[TIMER_RELOAD_CC_NUM];
    NRF_PPI->CH[0].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
    
    NRF_PPI->CHENSET               = (1 << 0);
}

int main(void)
{

    timer_init();
    pwm0_init();
    timer_start();
    while(1)
    {
    __WFE();
    __SEV();
    __WFE();
    }
}

Parents Reply Children
No Data
Related