6

When using an external xtal/osc with an AVR, you get several startup time options when setting the fuses, such as:

  • 6 CK/14 CK + 0 ms
  • 6 CK/14 CK + 4 ms
  • 6 CK/14 CK + 64 ms

Now... does anyone know if these startup times apply when resuming my AVR from sleep (SLEEP_MODE_PWR_DWN)? Or is it just when starting it for the first time. I want to use a 32.768 kHz watch crystal to keep accurate time, but it seems to me that if there are these startup time issues each and every time after going to sleep then that would make for very unreliable time-keeping.

Using an ATtiny85 if it makes any difference.

JimmyB
  • 3,823
  • 2
  • 18
  • 21
David Högberg
  • 1,835
  • 2
  • 21
  • 34
  • Apparently, the datasheet for the tiny85 is not as verbose as those for other models, where start-up times are explicitly stated (see [ATmega128](http://www.atmel.com/Images/doc2467.pdf) for instance). I would assume that the start-up procedures are the same for those parts. Plus, whenever the xtal oscillator is stopped it will have to go through the same initialization routine as when the device was powered off, so yes, the same start-up times should apply. – JimmyB Oct 31 '13 at 12:23
  • But then it's impossible to implement an RTC using an external 32.768 crystal? How can it keep accurate time if there are random startup delays when going to sleep. Or you'd have to run full-throttle all the time to avoid going to sleep. – David Högberg Oct 31 '13 at 12:28
  • How do you plan on keeping time when the crystal is stopped during power-down mode anyway? – JimmyB Oct 31 '13 at 12:29
  • Hm, I was planning to use one of the timer/counters. Maybe PWR_DWN is the wrong power saving mode in that case. – David Högberg Oct 31 '13 at 12:33
  • Yes, it is. You could either use Idle or ADC Noise Reduction mode, or look for another AVR with a "real time counter", a.k.a. a timer/counter "with asynchronous operation". I don't know if there are ATtinys with that but (all?) ATmegas have it. – JimmyB Oct 31 '13 at 12:35
  • You could use something more aggressive if you used an external 32.768kHz oscillator and used it to trigger an interrupt. – Ignacio Vazquez-Abrams Oct 31 '13 at 13:17
  • @Ignacio: I'm not sure what you mean by "use something more aggressive"? And I am using an external 32.768kHz crystal on the XTAL1 and XTAL2 pins. Would using it to trigger an interrupt mean wiring it differently? – David Högberg Oct 31 '13 at 13:34
  • 1
    Yes, you'd need to turn it into an oscillator by [using a 74LVC1GU04 and two 35pF capacitors](http://en.wikipedia.org/wiki/Pierce_oscillator), and then run the core off the internal RC oscillator. OTOH, this would free up 1 pin for other purposes. – Ignacio Vazquez-Abrams Oct 31 '13 at 13:40

1 Answers1

1

So it turns out that using an external 32.768 crystal reduces the power consumption of an ATtiny85 a LOT.

Running with an internal 1 MHz clock source and having the AVR sleep most of the time in power down mode - only waking up every 32 ms - it consumes around 62 microamps. However, using a 32.768 crystal as the external clock source, the power consumption is only around 22 microamps, even when running at "full throttle" so to speak (32768 ticks per second with no sleep mode).

So it turns out that running it at that low of a speed cuts down on power consumption so much that you don't actually need to sleep it.

David Högberg
  • 1,835
  • 2
  • 21
  • 34