AnsweredAssumed Answered

STM32L clock change

Question asked by grossi.marco on Oct 5, 2015
Latest reply on Oct 5, 2015 by Clive One
I am trying to change the clock source in a NUCLEO (STM32L152RE) board to reduce the power consumption.I use EmBitz as IDE. The Default configured clock in system_stm32l1xx.c is HSI clock (16MHz) with PLLMul 6 and PLLDiv 3 thus giving a System clock of 32MHz. The IDD drawn in this case is 6.95mA.

However if a try to decrease the system clock frequency to 16MHz with
RCC_PLLConfig(RCC_PLLSource_HSI, RCC_PLLMul_3, RCC_PLLDiv_3);
the power consumprion remains the same.

If a use RCC_DeInit(); the current drawn drops to 1.65mA (that is consistent with the fact that the default MSI 2MHz is selected as system clock).

Howeverif I try to change the clock source to MSI 2MHz without RCC_deInit(); but using
RCC_MSIRangeConfig(RCC_MSIRange_6); //2MHz
RCC_MSICmd(ENABLE);
RCC_HSICmd(DISABLE);
the current drawn increases to 10mA

I need some help about code needed to change clock source and frequency once the microcontroller has started

Thanks

Outcomes