AnsweredAssumed Answered

FRDM K22 POWER management DEMO

Question asked by nesrine mhiri on Nov 9, 2017
Latest reply on Nov 16, 2017 by Mark Butcher

Hello,

I start from the power management demo unde the SDK library:

Freescale\KSDK_1.3.0\examples\frdmk22f\demo_apps\power_manager_hal_demo

I try to simplify this demo to have only the system in  run mode  at 20MHz then enter in VLLS2 mode and  wakeup using RTC  each 1second.

 

so I modify the configuration for enter RUN mode to have Core clock = 20MHz :

in board.c file :

 

!

/* Configuration for enter RUN mode. Core clock = 80MHz. */
const clock_manager_user_config_t g_defaultClockConfigRun =
{
.mcgConfig =
{
.mcg_mode = kMcgModePEE, // Work in PEE mode.
.irclkEnable = true, // MCGIRCLK enable.
.irclkEnableInStop = false, // MCGIRCLK disable in STOP mode.
.ircs = kMcgIrcSlow, // Select IRC32k.
.fcrdiv = 0U, // FCRDIV is 0.

.frdiv = 0U,//3U,
.drs = kMcgDcoRangeSelLow, // Low frequency range
.dmx32 = kMcgDmx32Default, // DCO has a default range of 25%
.oscsel = kMcgOscselOsc, // Select OSC

.pll0EnableInFllMode = false, // PLL0 disable
.pll0EnableInStop = false, // PLL0 disalbe in STOP mode
.prdiv0 = 0x3U,
.vdiv0 = 0x10U,
},
.simConfig =
{
.pllFllSel = kClockPllFllSelPll, // PLLFLLSEL select PLL.
.er32kSrc = kClockEr32kSrcRtc, // ERCLK32K selection, use RTC.
// .outdiv1 = 0U,
// .outdiv2 = 1U,
// .outdiv3 = 2U,
// .outdiv4 = 3U,
.outdiv1 = 4U,
.outdiv2 = 4U,
.outdiv3 = 4U,
.outdiv4 = 4U,
},
.oscerConfig =
{
.enable = true, // OSCERCLK enable.
.enableInStop = false, // OSCERCLK disable in STOP mode.
.erclkDiv = 0U, // OSCERCLK divider setting.
}
};

then I modify the define in the  board.h file 

#ifndef CLOCK_INIT_CONFIG
#define CLOCK_INIT_CONFIG CLOCK_RUN
#endif

#if (CLOCK_INIT_CONFIG == CLOCK_RUN)
#define CORE_CLOCK_FREQ 40000000U
#elif (CLOCK_INIT_CONFIG == CLOCK_HSRUN)
#define CORE_CLOCK_FREQ 120000000U
#else
#define CORE_CLOCK_FREQ 4000000U
#endif

 

and the main.c as attached.

but the issue it that I have the VLLS2 eash 2 second and note 1second and am note sure if I have the right senario with run at 20MHz then VLLS2 the wakeup each 1s

 

Could yoy please help me to implement this

Thank you

Attachments

Outcomes