cancel
Showing results for 
Search instead for 
Did you mean: 

What happens when I turn off a peripheral clock ?

Kraal
Senior III
Posted on February 28, 2018 at 09:08

Hi, I'm designing a low power application using a L452RE. In order to keep the power consumption to the minimum I turn ON and OFF the peripheral clocks only when I need to use the peripheral. My question is what happens to the peripheral registers when its clock is turned OFF ? Are they reset to their defaults values ? I would say no, but I want a confirmation here.

Second question is about the typical use of the RCC->AHBRSTR: when would someone reset a peripheral ?

Many thanks,

Kraal

#peripheral-clock #peripheral-reset
6 REPLIES 6
Posted on February 28, 2018 at 11:25

when would someone reset a peripheral ?

When you want it restored to its reset state!

eg, if you wanted to re-configure it, and be sure that you were starting from a known state ...

AvaTar
Lead
Posted on February 28, 2018 at 11:33

If the datasheet / ref.manual doesn't tell you, test it yourself.

I have no personal experience with the L4xx family, which, IMHO, seems not as mature as other families like the F0, F1, F3 and F4.

But even if they retain their states, I would not rely on it.

Kraal
Senior III
Posted on February 28, 2018 at 12:08

Thank you for the answers.

I will reset them every time then...

Posted on February 28, 2018 at 12:35

Also not used 

L4xx family as such but, generally, there are STM32 low-power modes which stop the CPU clock - and, thus, the peripheral clocks - and say that peripheral states are retained.

Perhaps you can find some examples and see what they do ...

Posted on February 28, 2018 at 12:36

Kraal wrote:

I will reset them every time then...

So you just answered your question of why anyone would want to reset a peripheral!

:)

Posted on February 28, 2018 at 14:57

Yes, these are fully-static designs, so I'd expect everything to be retained absent a clock.

Where one might get into trouble is with registers/counters which are invisible, where they restart is not going to be predictable/controllable. For instance prescale counters, baud rate dividers, input/output shift-registers, etc.

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