Hi.
How can I reduce Kinetis K70 MCU frequency before going to STOP mode and increase after wakeup?
Thanks.
Evgeni
I am using the next configuration in System_Init() (attached 2 files):
// Initialize PLL0
// PLL0 will be the source for MCG CLKOUT so the core, system, FlexBus, and flash clocks are derived from it
mcg_clk_hz = pll_initialization(OSCINIT, // Initialize the oscillator circuit
OSC_0, // Use CLKIN0 as the input clock
CLK0_FREQ_HZ, // CLKIN0 frequency
LOW_POWER, // Set the oscillator for low power mode
CLK0_TYPE, // Crystal or canned oscillator clock input
PLL_0, // PLL to initialize, in this case PLL0
PLL0_PRDIV, // PLL predivider value
PLL0_VDIV, // PLL multiplier
MCGOUT); // Use the output from this PLL as the MCGOUT
// Check the value returned from pll_initialization() to make sure there wasn't an error
if (mcg_clk_hz < 0x100)
while(1);
// Initialize PLL1
// PLL1 will be the source for the DDR controller, but NOT the MCGOUT
pll_1_clk_khz = (pll_initialization(NO_OSCINIT, // Don't init the osc circuit, already done
OSC_0, // Use CLKIN0 as the input clock
CLK0_FREQ_HZ, // CLKIN0 frequency
LOW_POWER, // Set the oscillator for low power mode
CLK0_TYPE, // Crystal or canned oscillator clock input
PLL_1, // PLL to initialize, in this case PLL1
PLL1_PRDIV, // PLL predivider value
PLL1_VDIV, // PLL multiplier
PLL_ONLY) / 1000); // Don't use the output from this PLL as the MCGOUT
My system all time stay in STOP mode and wake up on RTC alarm. Therefore I want to reduce MCU frequency to minimal power consumption before STOP mode and on RTC Wake up restore to working frequency.
Thanks.
Evgeni
Hi Evgeni,
your question is fairly vague. How you can alter your clock frequency depends on your clock configuration. If you are using the FLL or PLL you can always lower the multiplication factor it's scaling the respective reference clock by in the MCG module. You can also increase the pertinent clock divider in the SIM module to lower the frequency. Or if you want to raise the frequency, just do the opposite of the prior suggestions. :smileyhappy:
It's totally up to you how and where in your program you decide to change your clock configuration.