Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Do I really need to use a crystal or can I continue with internal oscillator in AVR?

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
Hi,
I am confused to finalize a design using avr, still now I was using internal 8MHz. I am using UART at 57600. So will it affect the baudrate if I am using internal oscillator as it works in different temp conditions ? I didn't tested it any way...... My only concern is the baudrate should not change as the internal osc freq change due to temp change, and I cannot go for lower baudrates....
 

If you refer to this document:

http://www.atmel.com/Images/doc8384.pdf

There is a good description of the factory calibration process, and on page 4 there are plots of oscillator frequency versus temperature.

The curve is quite steep. If you know the working limits of your design then you can easily calculate the baud rate change from the graph, and take into account the +-1% initial accuracy.
 
Hi,
I kept the circuit in freezer for 30 minute and I was communicating with it via bluetooth serial, no error at 57600.
Later tried blowing hot air from soldering station while communicating with the ic and the IC become really hot , still no errors at 57600.

So I am concluding that I don't want any external crystal for my requirement.... Right?
 

This is a statistics related question, so no: you can't conclude that it's OK based on one single sample. Do the math :wink:

My personal experience is that for UARTS internal oscilators are fine. For other communication, such as USB or Ethernet, an external oscilator is mandatory.
 
Your testing on one unit is reasonable so far, but are you building more than one unit?

If so, you need to take into account the possible deviation of each AVRs clock. The internal clock is quite well calibrated (for an RC) at +/- 1%, so you might well be OK for each unit at the start.

What about long term drift of the RC calibration? It will drift a lot more, and a lot more quickly, than a crystal oscillator. There is something else you must consider, and need to rely on the manufacturer's data for since you probably don't have a year or more to test the drift.
 
I know of one instance of a commercial product, which relied on the internal oscillator, where after a couple of thousand units were built, that started experiencing unexplained field failures.

To make a very long story short, it was related to the internal oscillator's statistical drift over time and temperature.

Fortunately, the engineer who had designed the PWB left over some placeholders to include an external crystal. The units were recalled and reworked.

Another question would be: how critical is the application? If you lose communications, what are its consequences?

Again, we don't know what your project does or its application, but want to point out the consequences of limited testing.
 
So I think I should go for crystal then...
What specifications should I mostly check on a crystal? The load capacitance only? Or any thing more? (other than freq and load capacitance)
 

See this document, pages 10 to 12:

http://www.atmel.com/images/doc2521.pdf

Basically, you want an AT-cut parallel resonant crystal. These are the general crystals stocked by every supplier everywhere. Load capacitors of 22pf to 33pf are acceptable. I have used whatever value I have on hand within that range for years on many MCU's from 4MHz up to 48MHz with no problems.
 
Hi, I read the documentation, it is really nice..
Now I have some doubt in selecting ceramic resonator and quartz crystal.
Because it says that ceramic resonators can change its freq on temperature...

I am planning to increase the UART baudrate to 115200, and supply voltage 3.3v so max crystal freq can be 8MHz for atmega.
 

Definitely go for crystal oscillators because they have constant oscillating speed (or a very, very low margin of error) which does not depend on temperature. A crystal resonator would not be able to count the same number of oscillations per second, measured in two consecutive seconds; some time calibrated routines you might be using in your PIC (delays for example) will actually last longer or shorter than expected. With a crystal this will never happen.
 
"Now I have some doubt in selecting ceramic resonator and quartz crystal. "

Definitively the selection depends on your application.

They already have the load capacitors integrated into the resonator, which makes it very compact. However........Ceramic resonators have an accuracy between the internal oscillator and a crystal.

Of course, if you want the utmost frequency stability, you can use an oven controlled crystal oscillator or OCXO....:-o expensive, though!
 
Now I am almost finalized the resonator ABM10 of 12MHz **broken link removed**
But what about the ESR 120,80, 60 etc...
How to choose the equivalent series resistance ? Which one suits for atmega microcontroller?
Load caps in specification is 10 pf. So I think I should connect (2*10 - 5) pf in two pins of xtal, right?

I am assuming that I can connect a 22pf.... right?
 

ABM10 does not have 12MHz in the range; it starts at 16MHz.

You could use ABM8 for 12MHz.

Leave ESR and CL at the standard manufacturing values, and treat as per the description in the second document I linked. Job done!
 
I am using atmega328p at 3.3v. From the graph for max freq/voltage in the data sheet of 328p, it seems like at 3.3V I can use around 12MHz, not more than that...
Any comments?
 

That is correct, the frequency range in many microcontrollers is dependent on its supply voltage.

If the Atmega datasheet indicates that you can run no faster than 12 Mhz @ 3.3 volt, they have already done the homework for you, use that frequency.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top