cheap way to calibrate the int. RC osc.

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

Found this in ladyada's forums:

http://ladyada.net/forums/viewto...

It's an way to calibrate the internal RC osc. with "ordinary household items."

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

Strange idea for me ;)
As far as I am concern after riding it, you connect your uC straight to comx via RS232.
Where is voltage converter MAX232 for example ???

Wouldn`t be easier just to connect accurate crystal like watch crystal to your AVR uC and then write function for calibrating main clock ?

Don`t you think ??

Adam

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

One does not really need a voltage converter with most newer PCs. One does not get really th voltage levels one should, but most PCs accept 0 V and 5 V for RS232 signals. Its not garantied, but usually works. The series Resistor and zener diode is a simple way to reduche the 12 V signal to something the AVR survives. I would recommend another resistor just in front of the input, just in case the avr supply is less than 4 V.

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

Hmm

Yeah it can work but I still don`t like a design.
http://en.wikipedia.org/wiki/Image:Rs232_oscilloscope_trace.jpg
"1" -3 to -15 [V]
"0" +3 to +15 [V]
In this design you reach close to allowed voltage specifications.

Oscilator changes its value according to temperature. So there is a need to make calibration many times during measurments.

For example if I would like to build guitar tuner what should I suppose to do to calibrate my tuner. Take a computer with me ??

Still don`t see much of application of such solution or maybe I am wrong.

Adam

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

Those who are interested may also want to check out the AVR application note at http://www.atmel.com/dyn/general/tech_doc.asp?doc_id=9883

There are a few things that you should keep in mind when using this calibration technique:
1. There can be significant deviations from the nominal bit rate used by ordinary household computers (particularly at high bit rates)
2. Lower bit rates can generally provide more calibration accuracy than higher ones
3. Timing a sequence of highs and lows generally can provide more accuracy than timing only one high or one low

Depending upon the computer serial hardware that you use, this calibration technique can range from good to poor. The problem is that you need a more robust calibration technique or test equipment in order to show how well it has worked.

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

fastmapper wrote:

There are a few things that you should keep in mind when using this calibration technique:
1. There can be significant deviations from the nominal bit rate used by ordinary household computers (particularly at high bit rates)
2. Lower bit rates can generally provide more calibration accuracy than higher ones
3. Timing a sequence of highs and lows generally can provide more accuracy than timing only one high or one low

1) Any reference to back this up? Only thing I know about is that the uart chip should run at 1.843200MHz, but in reality it is run with 24MHz divided by 13, which is 1846154, which is 0.16% faster than it should be, which is insignificant really. This affects all the normal baud rates. And in reality, the 24MHz comes from a PLL chip which has a 14.318181 NTSC crystal, so we really don't know how accurate the 24MHz is, as there are no small integer fractions to make 24 out of 14.318.

2) Depends if you count time or frequency. Low speeds, I would count time, high speeds, maybe frequency. Of course it is hard to count frequency, as there might be delays between bytes. But yes I agree.

3) Yes, you get more accuracy if you measure time of 10 bits and divide by ten, than measuring time of just 1 bit.

For calibration purposes, you cand send square wave (0xAA) to measure single bit times, 9 continuous bits easily by transmitting 0x00 (start bit included), and even 10 bits by using the parity bit (at least hardware can force sticky parity of 0, don't know about OS drivers though). Stop bit is always the same as the idle state 1.

- Jani

Edit: note to self, 24 MHz is propably done with fraction of 176/105. 14.31818... divided by 105 is 0.136363... and so 24 divided by 176 is also 0.136363... So yes it is quite small fraction.