AVR Freaks
AVR forum - Using internal RC oscillator for USART clock source
induna - Aug 26, 2006 - 07:49 AM
Post subject: Using internal RC oscillator for USART clock source
Hello,
can anyone tell me if it is *NOT* recommended to use the internal RC oscillator for USART clock source. I'm using the ATmega88 and so far have not seen any official Atmel advice to use a crystal if using the USART.
stevech - Aug 26, 2006 - 08:10 AM
Post subject: RE: Using internal RC oscillator for USART clock source
use your noodle!
Read the error specs
induna - Aug 26, 2006 - 08:36 AM
Post subject:
Hi stevech,
Thanks for your warm welcome to the AVR forum
Which error specs are you referring too? The one in the ATMega88 datasheet or the one in this forum, or some other one?
I have checked both and cannot see anything which says that if using the USART then a XTAL should be used. If anyone can give me a URL link to where it advises to use a XTAL I would be grateful.
js - Aug 26, 2006 - 09:12 AM
Post subject:
If you use the internal oscillator as some do, you will need to fine tune it (using the calibration byte). It is generally recommended to use a crystal for heavy duty comms because the baud rate error can be kept to pretty much 0% with the right crystal at pretty much all baud rates. I personally never thought of using a chip without a crystal or at least a ceramic resonator as the cost savings are negligible for my applications.
dl8dtl - Aug 26, 2006 - 09:19 AM
Post subject:
We've recently had a lengthy thread here that examined about every pro
and con of using the RC oscillator as RS-232 clock source. Why don't
you simply do a forum search? It's been at most a week ago, it should
be easily to spot.
There's no universal "yes" or "no" answer to your question.
induna - Aug 26, 2006 - 11:57 AM
Post subject:
Hi dl8dtl,
there are over 200 000 posts in the AVR freaks forum but I guess the lengthy thread you are referring to is at http://www.avrfreaks.net/index.php?name ... ight=rs232
The pros and cons given by posters to that thread are very interesting. I was hoping though that someone would be able to guide me to an ATMEL document such as an application note.
stevech - Aug 27, 2006 - 12:35 AM
Post subject: Re: RE: Using internal RC oscillator for USART clock source
stevech wrote:
use your noodle!
Read the error specs
have you read the Atmel data sheets' discussion of internal oscillator tolerance design considerations and the calibration techniques?
bear_phillips - Aug 27, 2006 - 03:46 PM
Post subject: RE: Re: RE: Using internal RC oscillator for USART clock sou
Take look at application note http://www.atmel.com/dyn/resources/prod ... oc2555.pdf
It gives a little overview on this.
Sceadwian - Aug 28, 2006 - 01:02 AM
Post subject: RE: Re: RE: Using internal RC oscillator for USART clock sou
Keep in mind, some of the newer AVR chips have internal temperature sensors, these devices are obviously coupled directly to the AVR chip die. Between knowing the chip temperature and using an ADC line to sense the VCC voltage you can come up with a calibration table for an AVR that will temperature and voltage compensate it to some degree. Though this may be more of a hassle than using a crystal in a lot of applications. The nice thing about it is all that is required is two resistors for a voltage divider for VCC and you have a stable enough clock for UART.
theusch - Aug 28, 2006 - 01:39 AM
Post subject: RE: Re: RE: Using internal RC oscillator for USART clock sou
Quote:
The nice thing about it is all that is required is two resistors for a voltage divider for VCC
Well, that kills using AVcc for VRef, eh? Our 8-pin apps are always tight on pins; external reference would be a luxury.
One can measure supply voltage "backwards" with AVRs that can do a conversion on the internal bandgap. Use Vcc/AVcc as VRef and do a conversion on the bandgap. Should be close enough for the application stated even with the tolerances on the internal bandgap. No external components needed.
We also calibrate our internal bandgap this way on the programming/test station, where the Vcc level is known.
Lee
induna - Sep 20, 2006 - 06:06 PM
Post subject: RE: Re: RE: Using internal RC oscillator for USART clock sou
Guys, thanks for the help. I have read the app notes and also tried using a ATmega168 straight out the tube with no RC calibrartion or default oscillator changes. Managed to get 4800 baud with no problem @3V with 8MHz internal RC osc and 1MHz fosc. At 9600 started to get data errors.
Jepael - Sep 20, 2006 - 06:19 PM
Post subject: Re: RE: Re: RE: Using internal RC oscillator for USART clock
induna wrote:
Guys, thanks for the help. I have read the app notes and also tried using a ATmega168 straight out the tube with no RC calibrartion or default oscillator changes. Managed to get 4800 baud with no problem @3V with 8MHz internal RC osc and 1MHz fosc. At 9600 started to get data errors.
The question is not whether it works or not in a single experiment, but for some people, the question is that will it *always* work if 1000 devices are manufactured.
And it is also good to keep in mind, that in different AVRs, one of the internal oscillators is calibrated with a factory preset value, which assumes some specific supply voltage and temperature. For example in Mega8, I think (can't remember exactly)the 1MHz oscillator was calibrated according to 5.0V supply and 25C temperature.
It was a nice idea to read about people doing temperature and supply voltage measurements to come up with a lookup table for calibration. The traditional methods include a calibration based on 32768Hz real-time clock crystal or some other external reference connected to the AVR. But still, I think, for USART comms, there is no better than crystal or ceramic resonator. Preferably one with USART-friendly frequency.
- Jani
All times are GMT + 1 Hour
Powered by
PNphpBB2 © 2003-2006 The PNphpBB Group
Credits