Real Low power

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Real Low power

11,564 Views
stevasway
Contributor III
Hi all,
I'm trying to develop an application using SMAC and low power features of MC13192 and
HCS08, but I have some problems, because my code hangs up.
I'm using RTI (1 sec) + Hibernate + STOP3 (_asm stop), and low power while for HCS08 _asm wait.

Does anyone have some suggestion, or example source code?

Does anyone have SMAC porting of PWRLIB for 802.15.4?, something else?

Thanks
Stevasway
Labels (1)
0 Kudos
Reply
25 Replies

4,511 Views
stevasway
Contributor III
Hi all,
I'm glad to know that Low Power discussion is hot.

I have two questions regarding low power:

1 - Use of a watchdog in a low power code : is possible?
2 - SMAC & PWRLIB : does anyone knows anything?

Stevasway
0 Kudos
Reply

4,511 Views
ok2ucx
Contributor IV
Hi,
 
>1 - Use of a watchdog in a low power code : is possible?
 
In the S08GB family, the watchdog (COP) is driven out of BUCLK signal, thus in sleep mode, there's no clock available and no watchdog.
 
In contrary, S08QG family has an option of COP being driven out of internal ~1kHz oscillator (see chapter 5.4 of S08QG8 datasheet).

>2 - SMAC & PWRLIB : does anyone knows anything?
 
What do you need to know? SMAC are just simple drivers to handle MC1319x, MC1320x and MC1321x chip. Regarding the power saving features there are few functions to handle these. E.g. MLMEDozeRequest(), etc., all fully described in the reference manual.
 
Regards, Pavel
 
0 Kudos
Reply

4,511 Views
stevasway
Contributor III
Hi Pavel,

1>
So if I go into STOP3 (SelfMcuClock) the watchdog is enabled or not? When I return from a STOP3 the watchdog is in the same previous state?

Using kbu previous example code:
while (1)
{
UseMcuClock(); // MCU internal clock selected since we'll lose our external clock

//----> now the watchdog test is not running, so I must not reset the watchdog

PWRLib_ClockSetup(SelfClk_2MHz);
SPMSC1 = cSPMSC1Init_LVD_Disable; // disable LVD
MC13192ContReset(); // Place the MC13192 into Reset mode
PWR_HandleDeepSleep(STOP3_MODE, 5);

RadioInit();
AppInit();

// Restart to external clock appx. 10.8mS
MC13192Restart(); // Bring the MC13192 into the desired Idle condition.
MC13192Init();
MLMESetChannelRequest(2);
MLMESetMC13192ClockRate(0); // Set initial Clk speed
UseExternalClock();
__RESET_WATCHDOG(); //Now the watchdog test is running
}

If I use :
LOW_POWER_WHILE() _asm wait?

2>
With 802.15.4 stack (BeeKit) is possible to include PWRLIB functions. They are very useful configurable libs, I thought that there was something of similar for SMAC stack, because I heard someone has already written something.
0 Kudos
Reply

4,511 Views
kbu
Contributor I
hi stevasway,

I'm not 100% sure but I think you can't use COP while in the stop modes. I couldn't find anything explicit in the datasheets but the sample code in AN2493 they switch off COP before going into sleep.

BTW are you able to go into stop3 right now with the code you have? what current consumption are you seeing?
0 Kudos
Reply

4,511 Views
stevasway
Contributor III
hi kbu,
I successfully use COP in STOP3, because it is driven out of BUCLK signal (disabled when you use RTI), the problem for me is the COP in LOW_POWER wait; in this case the COP is running and you have to clear it.

The reason of use of COP is due to the fact that (I don't know why but) my application sometimes hangs up.

In this moment I can't measure the current consumption of my board because I have a MAX232 that drains current. When I build a board with only MCU & MC13192 I can check the real consumptions, I'll inform you.

Bye
Stevasway
0 Kudos
Reply

4,511 Views
kbu
Contributor I
I have yet another twist to the problem of high current use:
if I heat up the micro (hold it for a while between my fingers) I see the current consumption drops to around 500uA, but as it gets back up to ambient temp it goes up again to ~1mA.

tried it on two different boards (so I don't think its a short or loose connection)..

Any ideas?

P.S. Alban: so stop3 should use ~10uA with RTI, which is good enough for me.. but yes I certainly see a lot higher few mA's in wait mode.

Message Edited by kbu on 2006-11-0609:59 AM

0 Kudos
Reply

4,511 Views
ok2ucx
Contributor IV
Just wondering if one obvious thing has not been overlooked - are all unused GPIO pins at least pulled-up or set as outputs? Input-only pins can draw excessive current which might be also the temperature dependent.
 
For real low-power, MCU needs to go to sleep3 mode, ie. STOP mode enabled (SOPT), and properly configured (SPMSC2). Then the stop mode is invoked using asm STOP instruction. The MCU will consume ~1uA (LVD disabled, RTI optional). The STOP mode is exited usually by IRQ or KBI interrupt, or RTI if enabled. All oscillators are typically off, so there is no clock activity on the chip (except RTI - ~1kHz RC oscillator).
 
For low power of radio, the RF chip needs to go to Doze mode (MLMEDozeRequest(time)), which (at the end of time internal) will wake MCU back from the STOP mode by IRQ. The RF will consume ~35uA typ.
Alternatively the RF chip can go to hibernate mode, with no clock activity and the consumption will be around 2-3uA - but then any asynchronous event needs to wake either RF chip or MCU (= no timing possible).
 
Again all DC load excluded, all GPIO pins (including these of RF chip) needs to be in defined state (pull up or output).
 
 
Similar configuration has been implemented on ZSTAR demo (RD3152MMA7260Q) where MCU is MC9S08QG8 with internal clock only, MC13191 with 16MHz crystal. The board transmits ~30 messages per second, there are several receive windows in between, LED activity, sensor measurements, the MCU in full run mode (BUS clock of 16MHz for some time), Doze mode + SLEEP3 for the remaining period of time, all this consumes 1mA average current.
 
If the board is in 'saving mode', MC13191 is in Doze mode for 200ms, MCU in SLEEP3, Sensor in sleep, little activity every 200ms to check the buttons. If I remeber well, the average current is ~50uA but I can check later on when back in the office (next week).
 
Hope that helps. Regards, Pavel, Freescale Roznov p.R., CZ
 
0 Kudos
Reply

4,511 Views
kbu
Contributor I
Okay so I was able to run the assembly code in AN2493 on my MC13213 board. The good news is that if I run that piece of code I see the current consumption levels drop to the uV's range.
The bad news is that I still havn't been able to replicate that in my code.
So I made a new project without any SMAC libraries and wrote a simple C program to do exactly the same thing the assembly program does. But I don't see the current levels drop to the lowest possible setting.
The only difference between the AN2493 sample code is that its written with the GB60 includes, whearas because I'm using the MC13213 I'm including the GT60 header. (the one difference I can see is that GB60 explicitly disables PortF, but the GT60 doesn't have the portF so I don't disable that in my code)

Can someone PLEASE check through this code and let me know what could be going on?


#include

void main(void)
{

SOPT = 0b01100011; //disable COP and allow stop mode
SPMSC1 = 0b00010100; //disable LVD
SPMSC2 = 0b00000000;
ICGC1 = 0b00111100;
ICGC2 = 0x00100001;
SRTISC = 0x17; // 1ms RTI
//IRQSC |= 0b00010000;
IRQSC_IRQIE = 1; /enable IRQ

// data direction on all ports to output
PTADD = 0xff;
PTBDD = 0xff;
PTCDD = 0xff;
PTDDD = 0xff;
PTEDD = 0xff;
PTGDD = 0xff;

// all ports as low
PTAD = 0x80; //I have a LED on one pin (same thing on the assembly code too)
PTBD = 0x00;
PTCD = 0x00;
PTDD = 0x00;
PTED = 0x00;
PTGD = 0x00;

for(;:smileywink:
{
asm STOP;
}

}

interrupt void PWRLib_RTIClock_ISR(void)
{
SRTISC |= 0b01000000; // ack the RTI
PTAD_PTAD7 ^= 1; // toggle LED
}



Attached is a graph of the current levels, on the same board.
0 Kudos
Reply

4,511 Views
Ware
Contributor III
kbu,
 
One small change:
ICGC2 = 0x00100001;
should be:
ICGC2 = 0b00100001;
 
(small typo, "x" instead of "b").
The original line writes 0x01 to ICGC2 since the upper 3 bytes of the HEX constant are thrown away...  it would make your FLL divisor 1/2 of what you would expect (4 instead of 8) so your clock would be twice as fast, which may account for higher current.
 
 - Ware
 
0 Kudos
Reply

4,511 Views
peg
Senior Contributor IV
Hi kbu,


kbu wrote:
The only difference between the AN2493 sample code is that its written with the GB60 includes, whearas because I'm using the MC13213 I'm including the GT60 header. (the one difference I can see is that GB60 explicitly disables PortF, but the GT60 doesn't have the portF so I don't disable that in my code)



This is where you may be going wrong..... A GT is a GB with less pins, the chip is the same, just less connections actually bonded out to pins.
You still have to deal with the unavailable I/O!
Now I don't know what is actually inside these Zigbee devices but this could be worth a go.
 
Regards
David
 
0 Kudos
Reply

4,511 Views
kbu
Contributor I
I've been able to get my circuit working fine with:

RTI(1sec) + MC13192Reset + STOP3 + MC13192 restart

except ofcourse the fact that while in STOP3 it still consumes 1mA of power!!!
0 Kudos
Reply

4,511 Views
ok2ucx
Contributor IV
Hi,
 
there's not enough details provided, but some further 'current-eaters' to look at:
 
BDM port enable/disabled? (SOPT1 > BKGDPE)
LVD circuit enabled/disabled? (SPMSC1)
STOP mode really enabled? (SOPT1 > STOPE)
 
In STOP3 you should be getting <1uA (typ. at 25 deg. C) by MCU, <3uA in Hibernate for MC1319x.
Not more.
 
Regards, Pavel ok2ucx
 
0 Kudos
Reply

4,511 Views
kbu
Contributor I
BTW Pavel,
when you say we should be able to see 1.1uA in stop3, do you have your circuit configured with an external 32K xtal, or using the internal FLL?
0 Kudos
Reply

4,511 Views
Alban
Senior Contributor II
Hi,

1.1uA is far too low to be using a FLL.
Isn't STOP3 = full stop ? In this case, even the 32kHz XTAL is off.

Cheers,
Alban.
0 Kudos
Reply

4,511 Views
kbu
Contributor I
Then any other idea why I might be getting this high consumption?

I'm definately in Stop3, all the things the app note asks I have turned off. The only thing I can't be sure of is if the Radio is still drawing more current.

one thing I'm a little confused about is how the RTI gets its clock source when its sleeping? the datasheet seems to suggest that the RTI has its own internal source (is this different than the low precision ICG??) if so when the stop code is actually called does the ICG and FLL completely stop working??

if its infact using the ICG's low precision clock, whats the lowest frequency I should be running at? Just before going into stop I manually set the system frequency down to ~50kHz.

Has anyone actually gotten the MC1321x with a 16Mhz crystal connected to the RF and no other external crystal, to go into this deep sleep mode and seen it draw less than 1 uA (heck I'll take 10uA if possible)
0 Kudos
Reply

4,511 Views
Alban
Senior Contributor II
Hello Kbu,
 
Yes, RTI has 1kHz clock source (see Chapter 5.7 of datsheet S08GT60). Having a small dedicated RC oscillator helps achieveing very low consumption whilst still having a regular interrupt.
 
I wrongly assumed STOP3 was the deepest sleep as you wanted to achieve low power. But:

Stop modes: see Chapter 3.2 of datasheet S08GT60
– System clocks stopped; voltage regulator in standby
– Stop1 — Full power down of internal circuits for maximum power savings
– Stop2 — Partial power down of internal circuits, RAM contents retained
– Stop3 — All internal circuits powered for fast recovery

As with STOP3 everything stays powered-up, no wonder you get a high IDD.
Think about using STOP1 to get to very low consumption. It's a bit more work, but STOP3 is not really a STOP mode, but rather a WAIT...

Alban.

0 Kudos
Reply

4,511 Views
stevasway
Contributor III
Hi ok2ucx,

BDM port enable/disabled? (SOPT1 > BKGDPE)

SOPT_BKGDPE = 0;

LVD circuit enabled/disabled? (SPMSC1)
STOP mode really enabled? (SOPT1 > STOPE)

SPMSC1 = 0; //Disable all LVD functions
SPMSC2 = SPMSC2 & ~0x03; // Enable deep sleep mode stop3 (PDC & PPDC =0)
SOPT_STOPE = 1; //Enable STOP mode(s)

is it all? IRQ PIN? SPI MISO ?

Thanks a lot!
Stevasway
0 Kudos
Reply

4,511 Views
ok2ucx
Contributor IV
just quick guess:

System Options Register 1 (SOPT1)

This high page register is a write-once register so only the first write after reset is honored.

of course any DC load or any other peripheral enabled in STOP mode might add some more current on top of mentioned ones.

Regards, Pavel

 

 

0 Kudos
Reply

4,511 Views
stevasway
Contributor III
Hi Pavel,
thank you for the annotation about SOPT write-once register.

One more question about low power: is it possible to use the watchdog or there no
way to use it?

Thank You
Stevasway
0 Kudos
Reply

4,509 Views
stevasway
Contributor III
Uh, sorry
another question : I select a f_busclk = 1MHz with external 16MHz MC13192.

Which is, in your opinion, the better choice for ultra low power?

I saw in BeeKit PWRLib: 62.5KHz for the Radio and 16MHz for the MCU.

Thanks again
Stevasway
0 Kudos
Reply