Hi all! Several weeks I've tryed to implement code for my wireless temperature sensor based on nrf24le1 and ds18b20. In datasheet said that in memory retention mode the power consumption is around several uA. All of what I have achieved is 29-30 uA consumption. There is a sample code I tryed (without any including): blink after 6 seconds of "memory retention timers on":
void main()
{
__xdata __at(0x0100) unsigned int count; //counter for loop
pwr_clk_mgmt_cclk_configure(PWR_CLK_MGMT_CCLK_CONFIG_OPTION_START_ONLY_XOSC16M | PWR_CLK_MGMT_CCLK_CONFIG_OPTION_XOSC16M_IN_REGISTER_RET_OFF);
pwr_clk_mgmt_clklf_configure(PWR_CLK_MGMT_CLKLF_CONFIG_OPTION_CLK_SRC_RCOSC32K);
pwr_clk_mgmt_wait_until_clklf_is_ready();
gpio_pin_configure(GPIO_PIN_ID_P0_0,GPIO_PIN_CONFIG_OPTION_DIR_OUTPUT);
rtc2_configure(RTC2_CONFIG_OPTION_COMPARE_MODE_0_RESET_AT_IRQ ,65535); //65535=2 sec, 32767=1 sec
rtc2_run();
pwr_clk_mgmt_wakeup_configure(PWR_CLK_MGMT_WAKEUP_CONFIG_OPTION_WAKEUP_ON_RTC2_TICK_ALWAYS,0);
sti();
//main program loop
while(1)
{
count++;
if (count>2){
gpio_pin_val_set(GPIO_PIN_ID_P0_0);
delay_ms(500);
gpio_pin_val_clear(GPIO_PIN_ID_P0_0);
count=0;
}
// adc_power_down();
// rf_power_down();
P0DIR=0xFF;
P1DIR=0xFF;
P2DIR=0xFF;
P3DIR=0xFF;
P0CON=0x70;
P1CON=0x70;
P2CON=0x70;
P3CON=0x70;
pwr_clk_mgmt_enter_pwr_mode_memory_ret_tmr_on(); // 1uA
}
}
It's works, but power consumption is 29-30 uA in memory ret. mode. Is there any mistake? Does anybody achieved consumption of 1-2 uA, as said in datasheet? My goal is to implement sensor which will work on two AA elements during at least one year.