cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO clock gating on STM32

autokaupat
Associate
Posted on October 06, 2015 at 20:13

Hi!

I was wondering if clock from RCC to GPIO peripheral is needed other times than accessing GPIO registers. On STM32F051 datasheet it says for example that current draw when clocked is 9uA/MHz on GPIOA and 12uA/MHz on GPIOB. So it looks like you could save a few microamps by turning the clock off if you don't need to access GPIO registers too often.

For example, you only access GPIO registers during init, like:

turn_on_clock_to_GPIO();init_GPIO_MODER();

init_GPIO_OSPEEDR();

init_GPIO_AFR();

turn_off_clock_to_GPIO();

do_other_inits();

while(1)

{

  do_something();

}

I did a quick test on STM32F0Discovery and GPIO pins set as output seemed to retain their state and I was also able to output PWM from a timer to a GPIO pin set as alternater mode after turning clock to GPIO off after initialization.

Is there any pitfalls if you shut off the clock to GPIO when you are not accessing GPIO registers? Will other peripherals be able to use pins as inputs/outputs normally? Will the external interrupts work normally?
0 REPLIES 0