RC osc. freq. vs. OSCCAL

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

I figured out why my scheme for calibrating the RC oscillator on an Atmega 329 was sometimes failing. I had made the assumption that increasing OSCCAL would increase the oscillator frequence. It seems that is not always the case. I found when going from OSCCAL = 103 to OSCCAL = 104, the frequency dropped slightly.

Examining the datasheet closely I see Atmel observes the same thing.

Attachment(s): 

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

You might want to read AVR053 for more documentation on this: http://www.atmel.com/dyn/resourc... . Here's an excerpt:

Quote:
An increasing value in OSCCAL will result in a “pseudo-monotone”
increase in frequency. The reason for calling it pseudo-monotone is that for some
unity increases of the OSCCAL value the frequency will not increase or will decrease
slightly. However, the next unity increase will always increase the frequency again. In
other words, incrementing the OSCCAL register by one may not increase the
frequency, but increasing the OSCCAL value by two will always increase the frequency.

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

The value will drop for each eight value.
This is the same for all parts since mega48.