cancel
Showing results for 
Search instead for 
Did you mean: 

Power consumption without low power ...

root
Associate II
Posted on October 17, 2012 at 12:35

Hello,

I'm using USB in my application so I cannot use any low power mode, not even __WFI(). I'm trying to understand what drives the power consumption of theMCU when using a while(1); loop in the main ... and can't find any logic conclusion. For example, in my systick handler, I have this :

void SysTick_Handler(void) 
{ 
oal_task_poll(); 
cdc_echo_task(); 
}

And I get 46mA all the time. If I add the following code :

void SysTick_Handler(void) 
{ 
oal_task_poll(); 
cdc_echo_task(); 
static int minVal = 120000; 
static int i = 0; 
if(SysTick->VAL < 
minVal
) 
minVal
= 
SysTick
->VAL; 
if(++i == 1000) 
{ 
i = 0; 
//printf(''Val = %d\n'', minVal); 
minVal = 120000; 
} 
}

Then consumption goes down to 23mA !!!!! Sometimes changing from while(1); to while(1) __nop(); doubles up the power consumption, but not in all cases. Arethere any rules that govern this ? Thomas.
15 REPLIES 15
charlieincanada69
Associate II
Posted on October 18, 2012 at 21:39

Thomas,

Not sure if this is much help to you, but...

I am running uCos-II on an SMT32F103xE which uses the USB port. I use

__WFI()

in the hook for the idle task (which it spends most it's time in).

The USB functionality operates normally, including with the WFI call when I'm idle. I have the USB connected to a Windows 7 64 bit box, in case that makes a difference.

Charlie

Posted on October 18, 2012 at 22:08

The FS VCP example (STM32_USB-Host-Device_Lib_V2.1.0) ported to my STM32F205 board, also continues to function with WFI in the foreground loop.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
root
Associate II
Posted on October 23, 2012 at 15:31

Hello,

I prepared my main like this :

// __nop(); 
// __nop(); 
// __nop(); 
// __nop(); 
while(1);

And playing with the number of nops, I can get significant power consumption reduction. You just have to find the sweet spot once the rest is ok for release. Thomas.
awais_masood
Associate
Posted on December 07, 2012 at 13:26

Hi,

Were you able to find a fix for your problem?

I am facing a similar problem with USB OTG HS using embedded Full speed PHY on a custom board with an F207 chip.

Using WFI results in the control transfers going haywire. I have seen the controller sending some 1000 bytes out on the bus where it was supposed to send an eight byte setup packet. It all goes away if I remove WFI from my system.

Regards,

Awais

Nickname12657_O
Associate III
Posted on December 15, 2012 at 18:43

Dear all,

Thank you for posting this interesting issue, Here I give the details of the behavior and THE solution :

This unwanted behavior is caused by bit ''OTGHSULPILPEN''  that is  set by default in register AHB1LPENR  ( See below) , reset state is [1].

When working with our High Speed peripheral in full speed mode and you want to enter SLEEP using WFI cortex-M low power mode,  the firmware side  should configure these bits in this way :

1) Clear bit 

OTGHSULPILPEN

in register  AHB1LPENR

2) Set    bit  OTGHSLPEN       in register  AHB1LPENR  ( already set after reset)

0690X00000604uSQAQ.png

Hope it helps you.  

O

ur Firmw

are library

and USB examples will implement this change in

future.

Cheers,

STOne-32  { your STM32 Moderator }

Posted on December 15, 2012 at 20:57

Ok, well that's interesting. None of my boards have HS/ULPI, which explains my lack of issues in this regard.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..