cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0xx Hello. Anybody knows the real startup time of this mcu? It is configured to run on HSI RC +PLL to produce 32MHz clock. But the startup time (at power up) is near 20ms...

Calypso 2021
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions

Just for those who'd wonder, __attribute__((zero_init)) is Keil-specific (i.e. won't work in gcc).

JW

View solution in original post

7 REPLIES 7

What does the datasheet say on reset time ("temporization")?

What do you mean by "startup time"? Does it include the startup code, i.e. setting the initialized (.data) variables and clearing the uninitialized (.bss) variables? Or does it also include the RCC setup?

If so, those are under your control, so rewrite them as you need.

JW

Calypso 2021
Associate II

Looks like a HAL problem. Without it the MCU starts accurately after temporization time.

Then don't use Cube/HAL.

JW

Calypso 2021
Associate II

Well. I made two versions: with HAL and without.

The version without HAL starts 5ms faster.

But... People!

Really strange things I discovered.

The startup time magically depends on the program size.

How I measured it.

I have two channel oscilloscope connected to the mcu vcc and some pin on it.

After I made mcu configured (clocks and so on) I toggle mcu pin and measure time passed.

The same source, all the same.

Experiment 1.

Compile, I get code size (6700 bytes).

The time from start till pin toggle is 15ms.

Experiment 2.

I put while(1); after pin toggle. Then compile, I get smaller code size of course (1400 bytes).

The time from start till pin toggle is 5ms.

Experiment 3.

Absolutely empty project, containing gpio configuration gives near 3ms.

How it is possible...

Startup code initializing variables, see my first post.

JW

Calypso 2021
Associate II

Yes.

Already solved.

I used wrong attribute __attribute__( ( section( "NoInit")) ) ;

But now is __attribute__( ( section( "NoInit"),zero_init) ) ;

This prevents my huge arrays from initializing.

So my resume is like this: if you need fast start up then better do not use HAL and check that your RAM arrays are not initialized.

Thanks alot.

Just for those who'd wonder, __attribute__((zero_init)) is Keil-specific (i.e. won't work in gcc).

JW