power consumption problem

Hi,

I'm using nrf51822 / sd130 / sdk 12.1. I am doing minimizing current consumption. My main function is like below. I checked no wakeup in sleep mode. But, current consumption changes variously. It is wide from ~30uA to 1.5mA. What should I do additionally? I'm trying various condition.

thanks.


while (1)
{
        // fucntion execute


	NRF_CLOCK->TASKS_HFCLKSTART = 0;       // for test
	NRF_CLOCK->TASKS_HFCLKSTOP = 1;        // for test

	NRF_POWER->TASKS_LOWPWR = 1;           // for test
//	NRF_POWER->SYSTEMOFF = 1;              // for test

	// Make sure any pending events are cleared
	__SEV();
	__WFE();
	// Enter System ON sleep mode
	__WFE();

         // watchdog
	nrf_drv_wdt_channel_feed(m_channel_id);	// wdt feed

	NRF_CLOCK->TASKS_HFCLKSTOP = 0;        // for test
	NRF_CLOCK->TASKS_HFCLKSTART = 1;       // for test
   }

watchdog setting

// <1=> Run in SLEEP, Pause in HALT 
// <8=> Pause in SLEEP, Run in HALT 
// <9=> Run in SLEEP and HALT 
// <0=> Pause in SLEEP and HALT 

    #ifndef WDT_CONFIG_BEHAVIOUR
    #define WDT_CONFIG_BEHAVIOUR 8					// 8, mtkim modified, 1 : original
    #endif
  • What else are you doing in main() function? I tested the code you have in the while-loop with the wdt example in the SDK, and measured average 3 µA power consumption.

  • My confiturations are like below

    • 1 twi, 2 pwm, 12 lower power event input pins, 1 adc
    • others : normal GPIO in/output

    I am doing some actions before sleep.

    • 1 twi, 2 pwm, 1 adc -> disable using library function
    • 12 lower power event input pins -> active for wakeup
    • others : normal GPIO in/output -> no action

    Is there any documents related with power consumption?

    Thanks.

  • We have a current consumption guide for the nRF51 here you can take a look at. You are completely turning off the TWI, PWM and ADC before going to sleep ? Are you using BLE ? How long are you sleeping before you wake-up again?

  • I added below code right before sleep. I saw lower current consumption than before. Is below code necessary? I'll read more document you mentioned.

    Thanks.

    		NRF_TWI0->ENABLE = 0;
    		NRF_TWI0->POWER = 0;
    

    // NRF_RADIO->ENABLE = 0; /*!< Peripheral power control. / NRF_RADIO->POWER = 0; /!< Peripheral power control. / NRF_UART0->ENABLE = 0; /!< Peripheral power control. / NRF_UART0->POWER = 0; /!< Peripheral power control. / NRF_SPI0->ENABLE = 0; /!< Peripheral power control. / NRF_SPI0->POWER = 0; /!< Peripheral power control. / NRF_SPIS1->ENABLE = 0; /!< Peripheral power control. / NRF_SPIS1->POWER = 0; /!< Peripheral power control. / // NRF_GPIOTE->ENABLE = 0; /!< Peripheral power control. / NRF_GPIOTE->POWER = 0; /!< Peripheral power control. / NRF_ADC->ENABLE = 0; /!< Peripheral power control. / NRF_ADC->POWER = 0; /!< Peripheral power control. / // NRF_TIMER0->ENABLE = 0; /!< Peripheral power control. / NRF_TIMER0->POWER = 0; /!< Peripheral power control. / // NRF_TIMER1->ENABLE = 0; /!< Peripheral power control. / NRF_TIMER1->POWER = 0; /!< Peripheral power control. / // NRF_TIMER2->ENABLE = 0; /!< Peripheral power control. / NRF_TIMER2->POWER = 0; /!< Peripheral power control. / // NRF_RTC0->ENABLE = 0; /!< Peripheral power control. / NRF_RTC0->POWER = 0; /!< Peripheral power control. / // NRF_RTC1->ENABLE = 0; /!< Peripheral power control. / NRF_RTC1->POWER = 0; /!< Peripheral power control. / // NRF_TEMP->ENABLE = 0; /!< Peripheral power control. / NRF_TEMP->POWER = 0; /!< Peripheral power control. / // NRF_RNG->ENABLE = 0; /!< Peripheral power control. / NRF_RNG->POWER = 0; /!< Peripheral power control. / // NRF_ECB->ENABLE = 0; /!< Peripheral power control. / NRF_ECB->POWER = 0; /!< Peripheral power control. / NRF_AAR->ENABLE = 0; /!< Peripheral power control. / NRF_AAR->POWER = 0; /!< Peripheral power control. / NRF_CCM->ENABLE = 0; /!< Peripheral power control. / NRF_CCM->POWER = 0; /!< Peripheral power control. / NRF_QDEC->ENABLE = 0; /!< Peripheral power control. / NRF_QDEC->POWER = 0; /!< Peripheral power control. / NRF_LPCOMP->ENABLE = 0; /!< Peripheral power control. / NRF_LPCOMP->POWER = 0; /!< Peripheral power control. */

  • I assume that you are using the drivers. So you should use the relevant driver functions to uninitialize and disable the peripherals you want to disable. E.g. first nrf_drv_twi_uninit() and thennrf_drv_twi_disable() to disable the TWI.