AT91R40008 power down for battery saving?

I'm working on the power down code for the Atmel AT91R4008 on the EB40A evaluation board. The following power down function seems to work.

Is this the correct way to put the processor to sleep? The part I wonder about is keeping the clock turned on for usart 0. Would that consume too much power for a battery operated device? I tried turning off all of the peripheral clocks, but then I don't get the serial interrupt that wakes the processor back up. If a peripheral clock must be enabled, would it be better to enable a different peripheral for longer battery life, like the PIO?

David

void power_down(void) { unsigned long ps_pcsr;

ps_pcsr = PS_PCSR; // save the state PS_PCDR = 0xfffffffb; // disable all peripheral clocks except us0 PS_CR = 1; // turn off the cpu

//------------------------------------------------------------------------ // everything is off except usart 0. If a serial interrupt happens it will // turn back on the cpu and the interrupt will run and then return to // here. //------------------------------------------------------------------------

PS_PCER = ps_pcsr; // restore the power saving registers

return; }

Reply to
David Lawson
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.