Hi !
It is not so clear why few lines are really need before entering to PowerDown mode.
For what reason SystemClock set to 32768 Hz before entering to PowerDown mode ?
It should go to it directly from any clock.
Or in this case it more relaible way ? Or some errata ?
Regards,
Eugene
void DEMO_PreLowPower(void)
{
/*!< Configure RTC OSC */
POWER_EnablePD(kPDRUNCFG_PD_XTAL32K); /*!< Powered down the XTAL 32 kHz RTC oscillator */
POWER_DisablePD(kPDRUNCFG_PD_FRO32K); /*!< Powered the FRO 32 kHz RTC oscillator */
CLOCK_AttachClk(kFRO32K_to_OSC32K); /*!< Switch OSC32K to FRO32K */
CLOCK_SetFLASHAccessCyclesForFreq(32768U); /*!< Set FLASH wait states for core */
/*!< Set up dividers */
CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */
/*!< Set up clock selectors - Attach clocks to the peripheries */
CLOCK_AttachClk(kOSC32K_to_MAIN_CLK); /*!< Switch MAIN_CLK to OSC32K */
/*< Set SystemCoreClock variable. */
SystemCoreClock = 32768U;
}
DEMO_PreLowPower();
POWER_EnterPowerDown(APP_EXCLUDE_FROM_POWERDOWN, 0x7FFF,
WAKEUP_GPIO_GLOBALINT0 | WAKEUP_GPIO_GLOBALINT1, 1);
Hello Eugene,
This is because power-down mode affects the entire system, the clock to all CPUs and peripheral is shut down. That is why system clock is switch.
I recommend you to check table 283 of UM. This table shows the peripheral that are ON/OFF depending on the power mode.
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi felipegsoto !
Yes I have used PowerDown mode and examinate wakeup sources and leave FRO32 and/or XTAL32 osicllators alive while PowerDown.
It work fine and MCU returns back with FRO12M clock as mentioned in UM.
But I force MCU to Powerdown from any Clock directly without any reduction of clock to 32kHz.
It is not mentioned in UM anywhere why Main clock should be switched to 32kHz before calling PowerDown API.
CLOCK_AttachClk(kOSC32K_to_MAIN_CLK); /*!< Switch MAIN_CLK to OSC32K */
What I should do that configuration ? Is this something in errata or what ?
Regards,
Eugene
Hi Eugene,
There is no errata about that, you just need your MCU to work in one of the clocks that are enabled when going to Power Down mode.
Best regards,
Felipe