32 kHz oscillator accuracy problems

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

I'm using Attiny45s with Abracon ABS10-32.768KHZ-1-T crystals. It seems like some of them - and I've only just come to this conclusion, so I can't quantify it yet - run way, way fast. Like, ~200 ppm fast.

 

Now, according to the datasheet, there isn't really any trick to hooking these crystals up. The crystal is physically located right next to the chip, the traces are really short, and there's nothing on the other side of the board.

 

These crystals supposedly have a tolerance of 10 ppm. Is there something about them that disqualifies them for this application?

 

For unrelated reasons, I am considering the Citizen CM315D32768EZFT as a potential replacement. Is there anything I've missed about either or both of these that suggest one is going to be more accurate than the other?

 

Oh, the fuse settings: -U lfuse:w:0xe6:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m

 

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

Hmmm--this is the only AVR model that I've noticed that specifies unequal internal load capacitance.  Do you have load caps installed?  what values?

 

Now, I'm not a sparky.  there was a recent thread about all this with formulas and such.  Some of the migration app notes have a section on this, such as:

Short summary:  Lowish ESR needed.  The datasheet you linked to says

In my mind, that doesn't satisfy the recommendations given for the Mega88.  How that carries over to your AVR model, and the effect of the unbalanced internal Cl -- I have no idea.

 

Notably, no Abracon on that list?

 

Might be worth adding 6pF or 12pF to one/both legs?

 

 

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

Well, on http://www.atmel.com/images/doc8... in table 6-2, the Abracon ABS06 is mentioned, and it has an even higher ESR at 90 k-ohms.

 

I don't have any load caps installed, as for the low frequency oscillator, none is generally called for as far as I can tell.

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

Well, suit yourself, I guess.  I just pointed out what I noticed about the unbalanced Cl.  The doc you mentioned (which with all the detail was in the recent thread) also says

 

Since capacitive load will have a great effect on the oscillator, ...

...and goes on about 'scope probe loading, a simple  experiment might be to probe XTAL2 and see if the frequency changes?

 

 

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

Well, I spoke with the folks at Abracon and they also had an application note. Their note suggested (and their engineer concurred) that an additional 12 pF of load capacitance per lead was called for. They didn't say anything about the asymmetry of the built-in capacitance. As a test, I (just) managed to tack a couple of 12 pF caps in place and my initial test went from ~200 ppm fast to ~40 ppm slow. I've ordered some new boards, this time with proper footprints for load caps and will try again.

 

Meanwhile, I'm a little annoyed with the Atmel application note, with all of the pictures showing just a crystal with no additional external capacitance. There's no way that would ever be correct with a 12.5 pF crystal, which so far as I can tell is the normal value for a 32 kHz crystal. The same applies to an ATMega328p, with internal capacitance of 18 and 8 pF, which I believe was one of the pictured examples.

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

nsayer wrote:

It seems like some of them - and I've only just come to this conclusion, so I can't quantify it yet - run way, way fast. Like, ~200 ppm fast.

..

nsayer wrote:

.. I (just) managed to tack a couple of 12 pF caps in place and my initial test went from ~200 ppm fast to ~40 ppm slow.

An incorrect C-Load would not have just some running off-target, as the first post reported ?

Or did you mean they all ran ~200ppm too fast ?

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

Surely the AVR is going to provide an effective 4.36pF load (6pF in series with 16pF).    Add a typical 2.1pF for pcb trace capacitance and you end up with a total 6.5pF load capacitance.   i.e. it will run with a 6.5pF crystal.

You have selected a 12.5pF crystal.    So you need to add a single 6pF capacitor across the XTAL terminals.

Of course,  if you want to use an extra two capacitors in series,   the values will be substantially higher.     (if you want to maintain the unequal ratio)

 

From Atmel's point of view,   their built-in capacitors are a sensible compromise.    You can use the AVR with any of the common crystals.    But if you select a crystal that is tuned for a 'high' load capacitance,   you need to add an external capacitor to make up the load.

 

David.

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

Of if they all run 200 ppm (+-20 or so) then just compensate the error in your program.

If it needs to be good with a cheap crystal you need to temperature compensate

And you need to know how it change over time, I have worked a place where it would leave with a known error, so it would be correct when it was about 1 year old!

Last Edited: Tue. Jun 23, 2015 - 10:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Meanwhile, I'm a little annoyed with the Atmel application note, with all of the pictures showing just a crystal with no additional external capacitance. There's no way that would ever be correct with a 12.5 pF crystal, which so far as I can tell is the normal value for a 32 kHz crystal. The same applies to an ATMega328p, with internal capacitance of 18 and 8 pF, which I believe was one of the pictured examples.

Again, I'm not an expert in crystal circuits.

 

-- From earlier "...capacitive load will have a great effect on the oscillator...", then in your puzzling situation p0laying with the capacitance a bit is an easy sanity check, isn't it?

-- That app note goes into some detail on this stuff, right?  Including discussions of trim caps.

-- IME working on AVR8 apps with crystals [not the "watch" type], when everything is pretty much good with respect to layout and load caps, then varying the load caps somewhat from the "sweet spot" doesn't have much effect.  E.g. 'scope probing XTAL2 has little if any effect on AVR frequency.

-- IME when the setup isn't in the sweet spot, then indeed the 'scope probe on XTAL2 has the aforementioned "great effect" -- at least noticeable and measurable.

 

Now, on to watch crystals:  We have a number of production apps in the Mega48 family of AVR8 that use a watch crystal to run timer2 in async mode.  We picked a model that has the characteristics that are mentioned in some of the migration app notes; some apps have one of the listed models.  In no case do we add load caps.  We've never had a case hwere the 32kHz was off enough to be noticeable or requiring further action.

 

But that isn't your particular AVR model or family.  And I don't know if there is a difference when using a watch crystal for primary AVR clock vs. async timer.  If you use a crystal with lower ESR, does that help?

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

Oh, the fuse settings: -U lfuse:w:0xe6:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m

Can you tell just a bit more about the app?  Watch crystal as main clock, and CKDIV8 used so app starts up at 4kHz.  ISP must be an adventure at 1kHz?

 

IME I'm guessing you are attempting to run at low power, yet have an app that requires accurate timekeeping?  An alarm-type system?  Generally, power usage ends up to be a bit less when you "go fast then sleep till the next tick".  But maybe 4kHz gives you the balance you need?

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

nsayer wrote:
Meanwhile, I'm a little annoyed with the Atmel application note,
Which appnote?

 

AVR4100 is pretty clear about capacitive load.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

joeymorin wrote:

 

nsayer wrote:

Meanwhile, I'm a little annoyed with the Atmel application note,

Which appnote?

 

 

AVR4100 is pretty clear about capacitive load.

I peeked at it again, and to me also it appears to be a decent exposition.  For example, "4.2 Negative resistance test and safety factor" section gives a method to determine if ESR is reasonable.

 

 

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.