XMC1302 Low Power Modes

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User14874
Level 1
Level 1
Hi,
I build an QR Flyback with an XMC1302 but I need reduce the power consumption as far as possible during startup.
The Aux Cap is charged by a current source (~15mA), but im not able to get lower then ~4mA.

What i woud like to do is:
1. Startup:
scale down clock to 100kHz <-> 1MHz
setup timer to generate an wakeup isr after 5 <-> 25 ms
go to deep sleep

2. Sleep Loop
start ADC, check Aux Voltage
Vaux > Setvalue ? Running : Sleep Loop

3. Running
scale up clock to 32MHz / 64MHz
Init peripheral
start Flyback (softstart)

Running mode is working just fine, control loop, light load / full load jumps, vally skipping, etc.

To check the power consumption i use this test code

int main(void){
uint32_t TimerId_SysTick_1s;
uint32_t TimerId_SysTick_10ms;
uint32_t timer_status;
DAVE_STATUS_t status;

//pre Init IO for Debugging
DIGITAL_IO_Init(&POWERLINE_MODUL_EN_pin);
DIGITAL_IO_SetOutputHigh(&POWERLINE_MODUL_EN_pin);

//init cpu Clock
CLOCK_XMC1_Init(&CLOCK_XMC1_0);

//gate every peripheral by API
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_VADC);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU80);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU40);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC0);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_BCCU0);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF0);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT);
XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_RTC);

//gate every peripheral by Reg
SCU_CLK->CGATSET0 = 0x07FFUL; // Gate Off all peripherals
WR_REG(SCU_CLK->CLKCR, SCU_CLK_CLKCR_CNTADJ_Msk, SCU_CLK_CLKCR_CNTADJ_Pos,(0x3FFU));


COMPARATOR->ANACMP0 |= COMPARATOR_ANACMP0_CMP_LPWR_Msk; // Put Comparator into low power mode
COMPARATOR->ANACMP0 &= ~(COMPARATOR_ANACMP0_CMP_EN_Msk); // Disable ACMP0
COMPARATOR->ANACMP1 &= ~(COMPARATOR_ANACMP1_CMP_EN_Msk); // Disable ACMP1
COMPARATOR->ANACMP2 &= ~(COMPARATOR_ANACMP2_CMP_EN_Msk); // Disable ACMP2

//reduce peripheral Clock
XMC_SCU_CLOCK_SetFastPeripheralClockSource(XMC_SCU_CLOCK_PCLKSRC_MCLK);

//scale down cpu clock
CLOCK_XMC1_SetMCLKFrequency(125);

SCU_CLK->PWRSVCR |= SCU_CLK_PWRSVCR_FPD_Msk; // make sure flash powers down during deep sleep
PPB->SCR |= PPB_SCR_SLEEPDEEP_Msk; // Setup for Deep Sleep instead of normal sleep

__disable_irq(); //disable all interrupts

//debugging
DIGITAL_IO_SetOutputLow(&POWERLINE_MODUL_EN_pin);

while(1){
if(sleep_en){
__WFI();
}
DIGITAL_IO_ToggleOutput(&POWERLINE_MODUL_EN_pin);
}


//======================================================================
//============= Running Mode
//======================================================================

status = DAVE_Init(); /* Initialization of DAVE APPs */

if(status != DAVE_STATUS_SUCCESS){
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U){}
}

NetzPLL_Init(); //init Mains PLL
NetzMonitor_Init(); //init Mains Monitor
Fly_Control(1); //init Flyback



3198.attach

How can i further reduce the current consumtion? Or where is my misstake?

Thanks a lot for your support!

Best Regards,
Sascha
0 Likes
3 Replies
User14874
Level 1
Level 1
Good Morning,
to make the question more simpel.
What do i have to do to put the uC into the deepest sleep mode?
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

The following code places the device in the lowest power mode (~250uA according to data sheet)
  // 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();
}
User14874
Level 1
Level 1
Hi, and thanks for your help.
I found the main issu ... they placed the alternativ LDO and not the low power LDO.

What woud be the best wakeup source to generate a 10ms wackup tick?
- RTC (min sleep time 1s or am i wrong?)
- CCU4 Slice
- CCU8 Slice (needs more power then CCU4)
- PIN IRQ on the aux voltage feed back pin?
- System Timer (no running in deepsleep mode?)
0 Likes