Feb 05, 2019
04:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 05, 2019
04:39 PM
When using an external clock and entering deep sleep my current draw is almost twice as much as when using the internal clock. ~500uA to ~1.3mA.
I am using the mostly the code from https://www.infineonforums.com/threads/6031-XMC1302-Low-Power-Modes
This code seems to work alright when running only the internal clock.
The reference manual states that DCO1 is shut down when device enter Deep sleep mode. Hence, before entering Deep sleep mode, it is recommended to disable the automatic DCO1 calibration and shut down the XTAL function.
I believe I am shutting down the automatic DCO1 calibration but I can not seem to turn the XTAL function off. Is there an API command to turn off the external clock?
I am using the mostly the code from https://www.infineonforums.com/threads/6031-XMC1302-Low-Power-Modes
This code seems to work alright when running only the internal clock.
The reference manual states that DCO1 is shut down when device enter Deep sleep mode. Hence, before entering Deep sleep mode, it is recommended to disable the automatic DCO1 calibration and shut down the XTAL function.
I believe I am shutting down the automatic DCO1 calibration but I can not seem to turn the XTAL function off. Is there an API command to turn off the external clock?
// The clock of the peripherals that are not needed during sleep state can be gated before entering sleep state
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MCAN);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU41);
// Enable FLASH power down during SLEEP and DEEPSLEEP mode
XMC_SCU_CLOCK_EnableFlashPowerDown();
//Disable DCO1 ref to external clock
XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration();
// Make sure that SLEEPDEEP bit is set
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// Return to SLEEP mode after handling the wakeup event
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
// in deep-sleep state, the PCLK and MCLK will
// be switched to a slow standby clock and DCO1 will be put into power-down mode
// It is recommended to slow down the PCLK and MCLK before entering deep sleep
// mode to prevent a sudden load change that could cause a brownout reset.
XMC_SCU_CLOCK_SetFastPeripheralClockSource(XMC_SCU_CLOCK_PCLKSRC_MCLK);
XMC_SCU_CLOCK_SetMCLKFrequency(125);
// Put system in DEEPSLEEP state
__WFI();
- Tags:
- IFX
2 Replies
Feb 06, 2019
01:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 06, 2019
01:00 AM
Hi,
Try adding after you disable the DCO1 calibration
Regards,
Jesus
Try adding after you disable the DCO1 calibration
SCU_ANALOG->ANAOSCHPCTRL = (SCU_ANALOG->ANAOSCHPCTRL & ~SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk) | XMC_SCU_CLOCK_OSCHP_MODE_DISABLED;
Regards,
Jesus
Feb 06, 2019
09:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 06, 2019
09:01 AM
Thanks
Added this to my sleep code after DCO1 calibration disable and getting the power I expected in deep sleep now.
Added this to my sleep code after DCO1 calibration disable and getting the power I expected in deep sleep now.
//disable bit protection
SCU_GENERAL->PASSWD = 0x000000C0UL;
//Oscillator power down mode with shaper disabled
SCU_ANALOG->ANAOSCHPCTRL = (SCU_ANALOG->ANAOSCHPCTRL & ~SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk) | XMC_SCU_CLOCK_OSCHP_MODE_DISABLED;
//enable bit protection
SCU_GENERAL->PASSWD = 0x000000C3UL;