Power consumption

Questions for programming 8051 microcontrollers in C or assembly using SDCC

Power consumption

Postby Vittaly » Sun Feb 08, 2015 11:11 am

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":

Code: Select all
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(); // 1mkA
 
}

}


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.
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Re: Power consumption

Postby brennen » Mon Feb 09, 2015 1:20 pm

Just to be sure, are you measuring the current consumption of the microcontroller *only*, or are there other parts that could be consuming current on your board?
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Power consumption

Postby Vittaly » Mon Feb 09, 2015 2:48 pm

brennen wrote:Just to be sure, are you measuring the current consumption of the microcontroller *only*, or are there other parts that could be consuming current on your board?

Yes of course. In this sample I only connect LED to P0_0. But i've tried even without LED, so only power supply was connected.
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Re: Power consumption

Postby brennen » Mon Feb 09, 2015 3:17 pm

The only other thing I can think of would be if the voltage regulator is pulling some current. If you're using one of our boards, it's just a linear regulator, so it's gonna use some current pretty much all the time.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Power consumption

Postby Vittaly » Mon Feb 09, 2015 4:06 pm

brennen wrote:The only other thing I can think of would be if the voltage regulator is pulling some current. If you're using one of our boards, it's just a linear regulator, so it's gonna use some current pretty much all the time.


I have tried with two boards, that I bought on ebay: Image and Image. I'm connecting 3,2 V from two AA batteries directly. I doubt that there is a regulator on those boards :)
Dear brennen, do toy have some sample code with memory retention mode, which have really provides several uA power consumption?
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Re: Power consumption

Postby brennen » Tue Feb 10, 2015 2:14 pm

I can't honestly say I've ever done current consumption tests in any of the shutdown modes. One other problem is that measurements of current that small can be fairly prone to error. There could also be other stray current paths on the board that could be pulling a very small amount of current, but it becomes quite a bit once you're in a low power mode.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Power consumption

Postby mbee » Wed Feb 11, 2015 4:33 pm

Hi,

My first post here. Thanks Brennen for your awesome work with the SDK!
Im using a custom carrier for the eBay board for a sensor network.

Im using the second board in your picture and with this function I get down to around 1uA
Code: Select all
void powersave()
{
        delay_ms(10);
        CLKLFCTRL = 1;
        OPMCON = 2;

P0CON = 0x70; // Disable digital input buffer, pin used for 32kHz.
P0CON = 0x71; // Disable digital input buffer, pin used for 32kHz.
P0DIR = 0x03; // Two pins used for 32 kHz XO.
P1DIR = 0x00;
P2DIR = 0x00;
P3DIR = 0x00;


        watchdog_start_and_set_timeout_in_ms(10000);
//      pwr_clk_mgmt_enter_pwr_mode_deep_sleep(); // only for interrupt wake 0.5uA
        pwr_clk_mgmt_enter_pwr_mode_memory_ret_tmr_off(); // measure 1.05uA according to datasheet it should be 1.0uA
//      pwr_clk_mgmt_enter_pwr_mode_register_ret(); // measured 2.8uA according to datasheet it should be 3.0uA
//      pwr_clk_mgmt_enter_pwr_mode_memory_ret_tmr_on(); // 1.05uA according to datasheet it should be 1.6uA


}


I measured with a fluke 289
mbee
 
Posts: 3
Joined: Wed Feb 11, 2015 9:32 am

Re: Power consumption

Postby Vittaly » Sat Feb 14, 2015 9:28 am

mbee wrote:Hi,

My first post here. Thanks Brennen for your awesome work with the SDK!
Im using a custom carrier for the eBay board for a sensor network.

Im using the second board in your picture and with this function I get down to around 1uA
Code: Select all
void powersave()
{
        delay_ms(10);
        CLKLFCTRL = 1;
        OPMCON = 2;

P0CON = 0x70; // Disable digital input buffer, pin used for 32kHz.
P0CON = 0x71; // Disable digital input buffer, pin used for 32kHz.
P0DIR = 0x03; // Two pins used for 32 kHz XO.
P1DIR = 0x00;
P2DIR = 0x00;
P3DIR = 0x00;


        watchdog_start_and_set_timeout_in_ms(10000);
//      pwr_clk_mgmt_enter_pwr_mode_deep_sleep(); // only for interrupt wake 0.5uA
        pwr_clk_mgmt_enter_pwr_mode_memory_ret_tmr_off(); // measure 1.05uA according to datasheet it should be 1.0uA
//      pwr_clk_mgmt_enter_pwr_mode_register_ret(); // measured 2.8uA according to datasheet it should be 3.0uA
//      pwr_clk_mgmt_enter_pwr_mode_memory_ret_tmr_on(); // 1.05uA according to datasheet it should be 1.6uA


}


I measured with a fluke 289


Hi mbee!
Thank a lot for your code! Do you use external crystal 32К? Without it and with your function i have 8,3 mA :).
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Re: Power consumption

Postby mbee » Mon Feb 16, 2015 9:45 am

Hi Vittaly,

No im using the boards as-is so no external xtal. 8.3mA seems high. You should be able to get down to uA as I did.
Have you removed all debug I/O including serial? Just power the board separately and measure current.
mbee
 
Posts: 3
Joined: Wed Feb 11, 2015 9:32 am

Re: Power consumption

Postby Vittaly » Mon Feb 16, 2015 11:46 am

Hi mbee!
Regarding 8,3 mA - it was my fault: in another part of my code I used P0.0 for LED (for debugging), so now i have fixed it :)
And now I still have 30 uA even in deep sleep mode. On both boards. I have disconnected any external peripherals, so only batteary is connected. I'm afraid that i have some problems with my SDK: i have download it not from original sours, but from one of guys, who made some "improvements" in it :). I don't believe that all my boards that I bought in different places, are defective! Anyway, thank a lot for your help and your code! I'll try again.
PS. By the way, meanwhile I have assembled scheme with DS18B20 with 30uA power consumption in memory retention timers on mode. It send temperature once per minute. It supplied by 2xAA batteries. During one week voltage drops from 3,14V to 3,12V.
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Next

Return to 8051 Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron