How to enter and exit low power modes...

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

phanids
Posts: 5
Joined: Tue May 18, 2010 4:26 pm

How to enter and exit low power modes...

Wed Oct 01, 2014 11:47 am

I am using ATSAM4S8B. The main code consists of while (1) loop and an interrupt every 1 mili-sec. With all the code/ logic completed - board is drawing around ~30mA. In some conditions (generally power down - which any way I am detecting) - I should go to very low power mode backup/ wait / sleep (Sample code I took from example code). With respect to this.

Typical_Bakcup_mode
{
/* Enable the PIO for wake-up */
example_set_wakeup_from_backup_mode();

/* Switch MCK to slow clock */
pmc_switch_mck_to_sclk(PMC_MCKR_PRES_CLK_1);

/* Disable unused clock to save power */
pmc_osc_disable_xtal(0);
example_disable_pll();

//Disalble all the peripherals....
pmc_disable_periph_clk(ID_UART1);
uart_disable(UART1);

pmc_disable_periph_clk(ID_TC0);
tc_stop(TC0, 0);

pmc_disable_periph_clk(ID_ADC);
adc_disable_all_channel(ADC);

/* Enter into backup mode */
pmc_enable_backupmode(); //This function is below...
}

void pmc_enable_backupmode(void)
{
#if (SAM4C || SAM4CM || SAM4CP)
uint32_t tmp = SUPC->SUPC_MR & ~(SUPC_MR_BUPPOREN | SUPC_MR_KEY_Msk);
SUPC->SUPC_MR = tmp | SUPC_MR_KEY_PASSWD;
while (SUPC->SUPC_SR & SUPC_SR_BUPPORS);
#endif
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
#if (SAM4S || SAM4E || SAM4N || SAM4C || SAM4CM || SAM4CP)
SUPC->SUPC_CR = SUPC_CR_KEY_PASSWD | SUPC_CR_VROFF_STOP_VREG;
__WFE();
__WFI();
#else
__WFE();
#endif
}

1. Can I enter into this mode from interrupt? Seems I have read, in interrupt context Corext M4 core can not execute WFE/ WFI instructions (these are mainly controlled by hw)

2. Tried also entering into this Low power mode in main loop - still I do not see any change in current usage (seems the low power mode is not entered).

3. Is there any ATMEL document which explains on how to enter low power states (I am using some of the peripheals - think I have disabled them all - but still some of the peripheral being active - can be problem - trying to debug this now).

4. Any one has entered low powered modes on SAM4S8B devices (or variant) and typically what is the current consumed in these low power modes?

With best regards,
P.
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: How to enter and exit low power modes...

Wed Oct 01, 2014 2:20 pm

Designing for low power also involves external HW. Before placing the uP into low power state, set the IO for minimum current draw from the external circuitry.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests