EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

Cortex M3: CPU Context to Retention RAM

Started by Unknown December 14, 2015
Hi,
I am looking for some pointers, links or apps notes.
Consider a Cortex M3 based system which has a deep sleep mode whereby CPU core is powered down, but the system RAM retains state (retention RAM). Prior to entering deep sleep, I would like to save "CPU Context" to give me the fastest startup response after a wake event. (I think that on some older ARM CPUs, this was called "dormant" mode)
The simplest would simply to push all CPU core registers onto the stack prior to sleep, and pop off after sleep, but I am wondering if someone has actually come up with a well thought-out/analyzed alternative.
Thanks for any feedback.
Steven


Op Mon, 14 Dec 2015 07:54:18 +0100 schreef <moogyd@yahoo.co.uk>:
> Hi, > I am looking for some pointers, links or apps notes. > Consider a Cortex M3 based system which has a deep sleep mode whereby > CPU core is powered down, but the system RAM retains state (retention > RAM). Prior to entering deep sleep, I would like to save "CPU Context" > to give me the fastest startup response after a wake event. (I think > that on some older ARM CPUs, this was called "dormant" mode) > The simplest would simply to push all CPU core registers onto the stack > prior to sleep, and pop off after sleep, but I am wondering if someone > has actually come up with a well thought-out/analyzed alternative. > Thanks for any feedback. > Steven
If you make sure that your system is in an "idle" state when going into sleep, there should be no need to save/restore anything. -- (Remove the obvious prefix to reply privately.) Gemaakt met Opera's e-mailprogramma: http://www.opera.com/mail/
On 12/14/2015 6:24 AM, Boudewijn Dijkstra wrote:
> Op Mon, 14 Dec 2015 07:54:18 +0100 schreef <moogyd@yahoo.co.uk>: >> Hi, >> I am looking for some pointers, links or apps notes. >> Consider a Cortex M3 based system which has a deep sleep mode whereby >> CPU core is powered down, but the system RAM retains state (retention >> RAM). Prior to entering deep sleep, I would like to save "CPU Context" >> to give me the fastest startup response after a wake event. (I think >> that on some older ARM CPUs, this was called "dormant" mode) >> The simplest would simply to push all CPU core registers onto the >> stack prior to sleep, and pop off after sleep, but I am wondering if >> someone has actually come up with a well thought-out/analyzed >> alternative. >> Thanks for any feedback. >> Steven > > If you make sure that your system is in an "idle" state when going into > sleep, there should be no need to save/restore anything.
That simply means all relevant context is already saved. -- Rick
On Sun, 13 Dec 2015 22:54:18 -0800, moogyd wrote:

> Hi, > I am looking for some pointers, links or apps notes. > Consider a Cortex M3 based system which has a deep sleep mode whereby > CPU core is powered down, but the system RAM retains state (retention > RAM). Prior to entering deep sleep, I would like to save "CPU Context" > to give me the fastest startup response after a wake event. (I think > that on some older ARM CPUs, this was called "dormant" mode) > The simplest would simply to push all CPU core registers onto the stack > prior to sleep, and pop off after sleep, but I am wondering if someone > has actually come up with a well thought-out/analyzed alternative. > Thanks for any feedback. > Steven
I think you'd do much better to have one really well-defined stopping point, and a fixed set of stuff to load into the CPU registers. Even then I'd be worried about missing some CPU state or setting up a peripheral wrong. It's certainly far more reliable, if far slower, to treat some section of the processor RAM in this case as something akin to a really small hard drive, bring the thing up normally, and then read whatever is in your "important" part of RAM to proceed. -- www.wescottdesign.com
On Mon, 14 Dec 2015 12:24:49 +0100, Boudewijn Dijkstra wrote:

> Op Mon, 14 Dec 2015 07:54:18 +0100 schreef <moogyd@yahoo.co.uk>: >> Hi, >> I am looking for some pointers, links or apps notes. >> Consider a Cortex M3 based system which has a deep sleep mode whereby >> CPU core is powered down, but the system RAM retains state (retention >> RAM). Prior to entering deep sleep, I would like to save "CPU Context" >> to give me the fastest startup response after a wake event. (I think >> that on some older ARM CPUs, this was called "dormant" mode) >> The simplest would simply to push all CPU core registers onto the stack >> prior to sleep, and pop off after sleep, but I am wondering if someone >> has actually come up with a well thought-out/analyzed alternative. >> Thanks for any feedback. >> Steven > > If you make sure that your system is in an "idle" state when going into > sleep, there should be no need to save/restore anything.
But current consumption in idle is higher than in deep sleep. I'd have to look at data sheets to be sure -- but it is. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 12/14/2015 2:05 PM, Tim Wescott wrote:
> On Mon, 14 Dec 2015 12:24:49 +0100, Boudewijn Dijkstra wrote: > >> Op Mon, 14 Dec 2015 07:54:18 +0100 schreef <moogyd@yahoo.co.uk>: >>> Hi, >>> I am looking for some pointers, links or apps notes. >>> Consider a Cortex M3 based system which has a deep sleep mode whereby >>> CPU core is powered down, but the system RAM retains state (retention >>> RAM). Prior to entering deep sleep, I would like to save "CPU Context" >>> to give me the fastest startup response after a wake event. (I think >>> that on some older ARM CPUs, this was called "dormant" mode) >>> The simplest would simply to push all CPU core registers onto the stack >>> prior to sleep, and pop off after sleep, but I am wondering if someone >>> has actually come up with a well thought-out/analyzed alternative. >>> Thanks for any feedback. >>> Steven >> >> If you make sure that your system is in an "idle" state when going into >> sleep, there should be no need to save/restore anything. > > But current consumption in idle is higher than in deep sleep. I'd have > to look at data sheets to be sure -- but it is.
I believe you are saying in deep sleep the RAM content is retained. If that is so, isn't the internal state of the CPU also saved? -- Rick
Den mandag den 14. december 2015 kl. 20.25.36 UTC+1 skrev rickman:
> On 12/14/2015 2:05 PM, Tim Wescott wrote: > > On Mon, 14 Dec 2015 12:24:49 +0100, Boudewijn Dijkstra wrote: > > > >> Op Mon, 14 Dec 2015 07:54:18 +0100 schreef <moogyd@yahoo.co.uk>: > >>> Hi, > >>> I am looking for some pointers, links or apps notes. > >>> Consider a Cortex M3 based system which has a deep sleep mode whereby > >>> CPU core is powered down, but the system RAM retains state (retention > >>> RAM). Prior to entering deep sleep, I would like to save "CPU Context" > >>> to give me the fastest startup response after a wake event. (I think > >>> that on some older ARM CPUs, this was called "dormant" mode) > >>> The simplest would simply to push all CPU core registers onto the stack > >>> prior to sleep, and pop off after sleep, but I am wondering if someone > >>> has actually come up with a well thought-out/analyzed alternative. > >>> Thanks for any feedback. > >>> Steven > >> > >> If you make sure that your system is in an "idle" state when going into > >> sleep, there should be no need to save/restore anything. > > > > But current consumption in idle is higher than in deep sleep. I'd have > > to look at data sheets to be sure -- but it is.
I assume he means if you are idling in main there is nothing to restore but if everything but the RAM content has been reset there could be lots of stuff
> > I believe you are saying in deep sleep the RAM content is retained. If > that is so, isn't the internal state of the CPU also saved?
it depends, they may turn off the power to everything but the RAM -Lasse
The 2026 Embedded Online Conference