PIC/AVR internal RC oscillator stability

Dec 18, 2008 7 Replies

The datasheets I read on the PIC MCU says the precision is 2% for most common voltage and temperature ranges (and 1% for the sweet spot). I assume the AVR MCUs have similar characteristics.



This should mean that for say 10 clock periods at 4 MHz the period would vary between 2450 - 2550 ns?



Is the stability higher for a shorter timescope wherein the temperature and voltage should not have the ability to change as much. Such that between two timepoints spaced 25 us apart. The period for 10 clockcycles would vary less than the specified 2% ..?



,,,,



For a rs232 byte transmission the dataspec precision should mean 2% per bit, and 21% for the full transmission? (maybe this is still acceptable for a pc serial port?).



Maybe it's possible to work around this by creating a bitbang protocol that resync with software at every bittransition such that any bitperiod will only deviate with 1-2%?


1 us = 10^-9 s

** You think the temp and supply voltage can change *at all* in 25uS ????
** Not last time I looked - pal.

....... Phil

I think you're confusing yourself a bit with some terminology here. "Stability" tells you how quickly the frequency might wander around, whereas "accuracy" tells you the absolute difference in frequency between what you wanted and what you get. The PIC oscillators is 2% *accurate*, whereas I couldn't tell you what the stability is, but it's certainly quite good over any reasonably brief interval (...us or low ms).

It's still a 2% error... if the PC is expecting 9600bps, and your oscillator is 2% fast -- 9792bps -- then to send one RS-232 character (ten bits) takes you 1.021ms when it *should* have taken you 1.042ms -- a 2% difference.

A PC will be perfectly hapy with a 2% error in RS-232 timing. Even 5% will generally work fine... as you push 10% you might start to have problems.

What some people do is to time the incoming characters and adjust their own transmit clocks such that their own bit rate matches the sender's. This is particularly handy if it's not necessarily a safe assumption that the device you're talking to has a particularly accurate clock... if you're +3% and they're -3%, now overall you're 6% off, and that's definitely worth addressing.

Mmm.... I think not...

---Joel

Since, in asynchronous transmission, the leading edge of the received start bit determines the beginning of time, all that\'s necessary for the receiver to decode the data is to take slices of the incoming signal which are far enough separated from the transitions to be meaningful and error-free.

The temperature isn't going to change much in 25us! The oscillator is temperature and supply voltage dependant. Keep those two stable and the oscillator will have the stability to match.

Dave.

IIRC the AVR oscillator is particularly temperature stable at 2.7V

you are reccomended to be within 5% of correct clock-rate for sucessful rs-232 (async 8 data bits)

manchester coding

AVR's have internal calibrated osc. It works fine on baudrates to 56K above that it gets tricky at 115K ,beyond that impossible with int. RC. AVR have an app. to calibrate the RC more accurately but with xtalsa costing a few cents now, it's hardly worth the effort....

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required