what exactly needs to be reset after power-down ends?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I can't find it now, but I recall reading somewhere that USART needed to be re-initialized.

 

Is there a general list somewhere of all subsystems that need attention after power-down?

Note that I'm not including subsystems that are explicitly put to sleep here (though

normally many of them would be shut down).

 

The datasheet for atmega328P also says regarding explicitly shutdown systems:

 

Resources used by the peripheral when stopping the clock will remain occupied, hence the
peripheral should in most cases be disabled before stopping the clock.

 

Is there any general description of what it takes to do this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assume your "power-down" is the turn-off of various peripherals in pico-power operation. 

 

Those power-down bits remove the power from those peripherals, so you cannot count on any of the registers retaining their previous value. Thus, for every peripheral that was shut off, then turned back on, every control, status, or compare register needs to be re-initialized.

 

But, if you are only stopping the clock as part of one of the  sleep modes, then they all retain their values. I have UARTs that go to sleep, then wake up just fine. Ditto timers and other stuff. Normally sleep is not considered "power down".

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. Sep 2, 2016 - 03:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When in doubt....re-init all the peripherals you are using.  Or re-init the whole thing to make sure everything comes back the way it's supposed to.

 

NE Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Those power-down bits remove the power from those peripherals,

Eh? As far as I know, when an AVR sleeps all that happens are that the CLOCKS not the power are removed from certain subsystems. Given that an AVR is static CMOS why would any of the SFRs change contents? You aren't suggesting all the IOs revert to non-pulled up inputs because DDR/PORT revert to 0 are you? So why would there be any more likelihood that UCSRA/B/C change their values?

 

I've never heard of this need to re-init peripherals just because the CPU has been asleep?!?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
So why would there be any more likelihood that UCSRA/B/C change their values?

When you use the PRR to shut down the peripherals, one may well need to disable them.  [ADC for sure; I'd have to look at the particular model datasheet for USART.]

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was unclear to me whether he was talking about sleep or about the PowerReductionRegister that controls the power to individual peripheral blocks. I TRIED to describe both and distinguish between them. Shutting something off via PRR DOES require re-initialializing when it is turned back on.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Shutting something off via PRR DOES require re-initialializing when it is turned back on.

Again, not necessarily... e.g.

The
current state of the peripheral is frozen and the I/O registers can not be read or written.
Resources used by the peripheral when stopping the clock will remain occupied, hence the
peripheral should in most cases be disabled before stopping the clock. Waking up a module,
which is done by clearing the bit in PRR, puts the module in the same state as before shutdown.
 

 

However, there are follow-on notes in the PRR section.  If one really wants to minimize power consumption in e.g. power-down sleep then for example the ADC must be disabled first.  If you don't want to save

...then AFAIK you don't need to disable/re-init.  But why use e.g. Power-Down sleep to get to a few uA draw and then not save the many uA from the table above?

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
But why use e.g. Power-Down sleep to get to a few uA draw and then not save the many uA from the table above?

Although use of sleep modes is by and large in the intent to save energy, that is not the only reason to use them. They also provides a way to get very consistent response time to some event (as the system always is in the same "initial" state), that even a polling loop could not provide.

 

EDIT: Removed unnecessary sentence.

EDIT2: Added "polling" detail.

ɴᴇᴛɪᴢᴇᴎ

Last Edited: Sat. Sep 3, 2016 - 11:15 AM