cancel
Showing results for 
Search instead for 
Did you mean: 

saving power underclocking with USB device mode connected

developer2
Senior
Posted on January 21, 2015 at 14:09

Hi all,

i'm using STM32F407/F417 with 12MHz crystal,

and i would like to save power as possible, because i need to run it on batteries,

i need to have USB connected,

i read in manual that i could underclock ...

please could somebody direct me how to do it and to not loose usb connection ? so exactly: at one moment i need full swing and other moment i need to save power and it's not required to have fast execution,

thanks for all replies ...

12 REPLIES 12
AvaTar
Lead
Posted on January 21, 2015 at 15:27

Why wanting to ''underclock'' with USB connected ?

Wouldn't it be more appropriate to draw power from the USB host in this case, instead from batteries ? With some hardware support, you could even recharge batteries while USB is connected.

My very superficial USB experience suggests you need a rather precise 48.0MHz clock for USB.

I would rather run on 12MHz while on batteries, and reconfigure to 48MHz (or more) when USB power is detected.

I implicitly assume your board runs on batteries most of the time, and connects to USB for data retrieval (and possible recharge).

developer2
Senior
Posted on January 21, 2015 at 15:40

i have to explain connections:

i have ODROID-XU with linux, i'm running this device from batteries,

i need to do ''the job'' with STM32F407 connected into ODROID-XU and after ''the job'' i need to save power as much as it is possible but it should be prepared to run ''the job'' anytime after first ''the job'', so there should be permanent usb connection due to drivers in linux, and i have batteries only to power the ODROID-XU and from it there is STM powered using USB cable,

but i measured current more than 100mA for STM32 :(

 

 

AvaTar
Lead
Posted on January 21, 2015 at 15:50

... but i measured current more than 100mA for STM32 :(

 

Don't know your ''job'', but when power consumption is of concern, wouldn't serve you a M0 with USB better ?

http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF259724?icmp=stm32f072-discovery_pron_pr_jan2014

developer2
Senior
Posted on January 21, 2015 at 16:01

during the ''job'' i need SPI @ 38MHz and STM32F407 is having 42MBit/s and STM32F072 has only 18MBit/s :(

and i think that STM32F072 will not be fast enough for processing received data if i use some parallel interface if it's possible,

i have tested that F407 is ok from processing speed point of view, but i'm looking for solution for saving power when the F407 is in idle ...

AvaTar
Lead
Posted on January 21, 2015 at 16:57

Aside from the Sleep/Stop/Standby mode, you can add two additional lines to control the power to the STM, i.e. turning power on/off from the ODROID unit.

This would allow for a proper ''removal'' of the USB device on the ODROID side before powering off.

developer2
Senior
Posted on January 21, 2015 at 17:11

it should be probably misunderstanding ... i don't want to disconnect STM32 from ODROID-XU because of the drivers and application, everything is stable when STM32 is connected on USB,

powering off the STM32 is not possible and also powering off ODROID is not possible,

Sleep/Stop/Standby can be used only if USB connection will stay alive - and conditionally only when idle when the job is not in progress, 

Posted on January 21, 2015 at 17:49

100 mA seems like a lot, how much can you actually attribute to the core, vs stuff you've got attached to it?

You can't change the PLL while it's clocking. You could use WFI loops, you can change APB/AHB clock dividers. You can turn off peripheral clocks and pins.

You can use an external clock up to 50 MHz, consider if running off the 16 MHz is an option, or a 8 / 25 MHz crystal, when not running at high speed. You'd need to maintain the PLL as the 48 MHz USB clock comes from there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
developer2
Senior
Posted on January 21, 2015 at 18:12

Hi Clive1,

is it possible and correctly functional this plan:

normally boot into HSE crystal 12MHz & PLL,

work on job,

when idle execute:

RCC_CFGR->SW = HSI,  ... so system clock now 16MHz from HSI and USB clock from PLL 48MHz from HSE,

wait for instructions from master through USB,

if the job is having to start then switch SW to PLL so system clock will be 168MHz,

?

is 16MHz fast enough to receive some bytes from USB ?

Posted on January 21, 2015 at 18:37

I would imagine 16 MHz would be sufficient, it's all going into DMA/FIFO type buffers. This is something you'd need to verify for yourself.

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