cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 low power clock settings

matas
Associate II
Posted on October 16, 2015 at 10:57

Hey, I need to decrese the STM32F401 consumpion to a minimum, the only problem is that I am using SDIO to interface a microSD card. Since the current consumption depends heavly on the clock is it possible to use HSE (8MHz) to the system while still driving the SDIO with PLL?

Foo Bar
12 REPLIES 12
Danish1
Lead II
Posted on October 16, 2015 at 12:49

Are you talking about minimising long-term battery drain, or instantaneous current consumption?

If you're after best battery life, often a good approach is to run the processor at a high speed but spend most of the time with the processor sleeping.

There are errata issues which require apb2_Hz * 8 >= pll48_Hz * 3

Hope this helps,

Danish

matas
Associate II
Posted on October 16, 2015 at 13:14

Yeah, I am after the long term battery life. And thanks I am aware that the APB2 clock has to be more than twice as bigger than the SDIO_Transfer. I already turn of the prefetch buffer, tried to optimize my code as much as possible, but still on a 230mAh battery the device would only last for about ~40days by waking up once a second. And I need it to work atleast for a year. Maybe you know something else that I could turn off to extend the battery life? Because I read the sheets, yet I couldn't find anything else.

Foo Bar
Posted on October 16, 2015 at 13:28

Tell us more on the application. I presume it is some sort of a datalogger storing acquired data onto the SD card, is it so? If yes, how much data and how often? Does the source of data present a significant power load? Does it require to be on for some time?

230mAh/1year=cca 25uA. The run-time consumption of mcu at full throttle is around 12mA (cca 10mA without peripherals, cca 20mA with all peripherals, so I assume only a small number of peripherals on), this gives you some 2ms of run time if you wake up once per second, and that does not include consumption of SD card nor other attached circuitry. HSI startup, processor wakeup and PLL lock is in hundreds of us, that does not leave you more than around 1ms best case.

There are times when you have to give up.

JW
stm322399
Senior
Posted on October 16, 2015 at 13:43

Let's do the math: 230mAh over 1 year is equivalent to drawing 26µA constantly on that period.

Hopefully the deepsleep mode will allow you to go lower. Let's say you can deep sleep at 6µA.

Your budget for wake up time is now equivalent to a constant drawing of 20µA. Let's assume that the CPU needs between 500x and 1000x that current supply, the working time is 1/1000 to 1/500 of the wake up period, which means (for your case) 1ms to 2ms working time every seconds.

Does it still match the needs of your application ? Turn off everything to reach a few µA deep-sleep, and cap your active consumption to your budget.

matas
Associate II
Posted on October 16, 2015 at 14:13

Yes it is a datalogger it uses an external I2C HDC1008 Humidity and temperature sensor to collect the measurements and then stores them on a microSD card. Since I use the Standby mode the only place I can save data is on the RTC backup register. Now it works like this (after flashing in the program):

1) It turn on and checks if it has the time set (in the RTC registers) 

2) if (yes to the above continue else inti_USART and wait for current time and stores in the RTC backup)

3) check if microSD card is present (one of the pins is grounded by the socket if the microSD card is inserted)

4) if (yes to the above continue else go to standby and start from the begining)

5) Turn on I2C set the sensor to measure Temp and Humidity, go to Stop mode (wait for the sensor to convert measurements (~6-7ms))

6) Wake up from stop mode get measurements, store them in the RTC register.

7) Go to standby mode.

Go to step 1)

The above repeats for 30 times after the RTC registers are full of measurements (30) then after the 6th step it goes here:

6.1) Init microSD card (I turn it on with a field transistor)

6.2) Get all info about the existing files and record it to the RTC registers, so it would only have to do it once. The info contains the name of the latest CSV file, how many lines are there in the file and etc)

6.2) opens the latest file moves cursor to line after the last recording.

6.3) Loads measurements from RTC to an array and counts back time to when they were taken.

6.4) Writes all data to microSD card and closes it (field transistor off).

6.5) Moves the RTC pointer back to the begining for measurement loading.

Go to step 1);

The steps 2),  4) and 6.2) are made only once to collect the data later on the device has it in the RTC registers.

As I mentioned I already have turn off the prefetch buffer and tried a few clock configurations but all in all I can't get it down lower than ~200-250uA. I am measuring the current connecting a small resistor in series and a lot of caps in parallel on the supply positive. It is an integrator and helps me to see the average power consumption.

Foo Bar
matas
Associate II
Posted on October 16, 2015 at 14:24

Ohh and if you know how this can be achieved, using different processor or something like that I would be grateful for that info :)

Foo Bar
Posted on October 16, 2015 at 14:38

What is the current current consumption with performing the measurement but without actual writing to the SD card?

JW
matas
Associate II
Posted on October 16, 2015 at 15:15

Without using the microSD card the consumption is between 100-200uA so Id say average ~150uA. and thanks for the threads I'll be sure to read them.

P.S. I miswrote the consumption with microSD card it is ~300uA.
Foo Bar