Hi,
The following code places the device in the lowest power mode (~250uA according to data sheet)
The following code places the device in the lowest power mode (~250uA according to data sheet)
Code:
// 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);
// Enable FLASH power down during SLEEP and DEEPSLEEP mode
XMC_SCU_CLOCK_EnableFlashPowerDown();
// 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);
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
// Put system in DEEPSLEEP state
__WFI();
}