Cat -
I'm not very clear on this but async data really does not
use "clock recovery". However, some of the synchronous
modes do (manchester comes to mind).
The "standard algorithm" is to detect the leading edge of
the start bit, then sample some number of times during the
first excpected bit interval (typically 8 or 16). During
start-bit time, three samples are evaluated near the middle
of the bit and if they are consistent with it being a start
bit, then it proceeds. The UART then blindly samples at the
8X or 16x rate, taking the majority value of the three
samples near each expected bit center and calls that the
bit value. It proceeds blindly through the entire byte
until the stop-bit is reached, and does the same, there. If
the stop-bit value is not consistent with what a stop-bit
ought to be, then typically an error flag is set.
Because the UART samples blindly (that is why it is called
asynchronous, the "A" im UART), there us a maximum
allowable difference in the clock rate at the transmitting
end and the receiving end so that the stop bit samples
actually fall within the transmitted stop bit. If the
difference is too great, the stop-bit samples will either
fall before or after the actual stop bit.
Jim
On Thu, 31 May 2007 17:16:17 -0600
"Cat" <catalin_cluj@hotmail.com> wrote:
> Page 136 in the ATmega8 doc2486.pdf mentions some "clock
> recovery" but I'm
> not sure what it does... could it do some of this
> adaptation by itself, in
> the USART?
>
> Cat
> ----- Original Message -----
> From: "np np" <harrabylad@yahoo.co.uk>
> To: <AVR-Chat@yahoogroups.com>
> Sent: Thursday, May 31, 2007 4:01 PM
> Subject: Re: [AVR-Chat] Re: What serial speed (RS232) can
> I achieve using
> the built-in osc...
>
>
> > You could try some adaptive software to work out the
> baud rate ?
> >
> > We wanted to use a cheap internal osc so had the PC
> send out some 55H
> > characters before transmission.
> > The PIC measured the bits and used the value as the
> length of a bit.
> > It then could match itself to the rx and tx of the PC.
> >
> > www.ckp-railways.talktalk.net/pcbcad21.htm
> >
> >
> >
> > ----- Original Message ----
> > From: Mike Harrison <mike@whitewing.co.uk>
> > To: AVR-Chat@yahoogroups.com
> > Sent: Thursday, 31 May, 2007 10:45:55 PM
> > Subject: Re: [AVR-Chat] Re: What serial speed (RS232)
> can I achieve using
> > the built-in osc...
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Thu, 31 May 2007 15:27:21 -0600 (MDT),
> you wrote:
> >
> >
> >
> >> That is a brilliant tuning suggestion! I never
> thought of that one
> >
> >><chuckle>. Another "gotcha" when using the internal RC
> oscillators is
> >
> >>that they are not as stable over temperature
> >
> >
> >
> > ..or voltage
> >
> >
> >
> >>as a resonator or crystal.
> >
> >>As long as you stay pretty close to the 20-25C
> temperature range they
> >
> >>are fine, otherwise they can drift (see data sheet for
> the drift rate).
> >
> >
> >
> > There can also be significant jitter - seems to be
> worse on some parts
> > than others - not sure if
> >
> > Microchip's tolerance specs take this into account or
> not.
> >
> >
> >
> >>DLC
> >
> >>
> >
> >>> Hi guys,
> >
> >>>
> >
> >>> Only bit of advice that I can give from my own
> experience is that the
> >
> >>> on chip RC oscillator is FINE for UART when your
> running on a accurate
> >
> >>> 5V supply AND you program the OSCCAL register with
> the correct value.
> >
> >>>
> >
> >>> If your VCC is low (3V or 3.3V) etc, you can still
> use the UART by
> >
> >>> setting the value of OSCCAL correctly (Not the value
> that the
> >
> >>> programmer gives you), I have done this by entering
> into a loop where
> >
> >>> I increment the OSCCAL register, then output it's
> value out the serial
> >
> >>> port, as soon as you can read the value, you know you
> have a value for
> >
> >>> OSCCAL that will allow the UART to work correctly.
> This is NOT a good
> >
> >>> way to do things for mass production, but is fine for
> homers and
> >
> >>> on-offs. The loop looks something like:
> >
> >>>
> >
> >>> OSCCAL = 0;
> >
> >>> while(OSCCAL < 255){
> >
> >>>
> >
> >>> OSCCAL++;
> >
> >>> UART_Write_Number( OSCCAL);
> >
> >>> }
> >
> >>>
> >
> >>>
> >
> >>> Cheers
> >
> >>> Hein B
> >
> >>> Auckland, New Zealand
> >
> >>>
> >
> >>> --- In AVR-Chat@yahoogroup s.com, dlc@... wrote:
> >
> >>>>
> >
> >>>> > On 5/30/07, dlc <dlc@...> wrote:
> >
> >>>> >> I've gotten 9600 baud to work well with the
> internal 1MHz
> >
> >>> oscillators of
> >
> >>>> >> the Tiny11. You can handle quite a bit of slop
> reading serial
> >
> >>> data if
> >
> >>>> >> your baud rate is low enough.
> >
> >>>> >
> >
> >>>> > Unfortunately, clock speed error is proportional,
> so 5% error is 5%
> >
> >>>> > error in baud rate, no matter what baud rate you
> pick. But, as the
> >
> >>>> > baud rates get higher, the granularity of the
> steps in the UBRR
> >
> >>>> > setting get proportionally larger (ie: 20 vs 21 is
> smaller error than
> >
> >>>> > 3 vs 2)
> >
> >>>>
> >
> >>>> There is no hardware UART in these small chips, I
> bit bang my serial
> >
> >>>> there and that seems to be more tolerant of bit slip
> and stretch.
> >>>> Being
> >
> >>>> in software gives me the option of very high
> granularity. The hardware
> >
> >>>> UARTS are not as tolerant of error. That is
> probably the difference.
> >
> >>>>
> >
> >>>> DLC
> >
> >>>> --
> >
> >>>> Dennis Clark
> >
> >>>>
> >
> >>>
> >
> >>>
> >
> >>>
> >
> >>>
> >
> >>>
> >
> >>> Yahoo! Groups Links
> >
> >>>
> >
> >>>
> >
> >>>
> >
> >>>
> >
> >>
> >
> >>
> >
> >>
> >
> >>
> >
> >>
> >
> >>Yahoo! Groups Links
> >
> >>
> >
> >>
> >
> >>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > <!--
> >
> > #ygrp-mlmsg {font-size:13px;font-family:arial,
> helvetica, clean,
> > sans-serif;}
> > #ygrp-mlmsg table {font-size:inherit;font:100%;}
> > #ygrp-mlmsg select, input, textarea {font:99% arial,
> helvetica, clean,
> > sans-serif;}
> > #ygrp-mlmsg pre, code {font:115% monospace;}
> > #ygrp-mlmsg * {line-height:1.22em;}
> > #ygrp-text{
> > font-family:Georgia;
> > }
> > #ygrp-text p{
> > margin:0 0 1em 0;}
> > #ygrp-tpmsgs{
> > font-family:Arial;
> > clear:both;}
> > #ygrp-vitnav{
> >
>
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
> > #ygrp-vitnav a{
> > padding:0 1px;}
> > #ygrp-actbar{
> > clear:both;margin:25px
> 0;white-space:nowrap;color:#666;text-align:right;}
> > #ygrp-actbar .left{
> > float:left;white-space:nowrap;}
> > .bld{font-weight:bold;}
> > #ygrp-grft{
> > font-family:Verdana;font-size:77%;padding:15px 0;}
> > #ygrp-ft{
> > font-family:verdana;font-size:77%;border-top:1px solid
> #666;
> > padding:5px 0;
> > }
> > #ygrp-mlmsg #logo{
> > padding-bottom:10px;}
> >
> > #ygrp-vital{
> > background-color:#e0ecee;margin-bottom:20px;padding:2px
> 0 8px 8px;}
> > #ygrp-vital #vithd{
> >
>
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
> > #ygrp-vital ul{
> > padding:0;margin:2px 0;}
> > #ygrp-vital ul li{
> > list-style-type:none;clear:both;border:1px solid
> #e0ecee;
> > }
> > #ygrp-vital ul li .ct{
> >
>
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
> > #ygrp-vital ul li .cat{
> > font-weight:bold;}
> > #ygrp-vital a {
> > text-decoration:none;}
> >
> > #ygrp-vital a:hover{
> > text-decoration:underline;}
> >
> > #ygrp-sponsor #hd{
> > color:#999;font-size:77%;}
> > #ygrp-sponsor #ov{
> > padding:6px
> 13px;background-color:#e0ecee;margin-bottom:20px;}
> > #ygrp-sponsor #ov ul{
> > padding:0 0 0 8px;margin:0;}
> > #ygrp-sponsor #ov li{
> > list-style-type:square;padding:6px 0;font-size:77%;}
> > #ygrp-sponsor #ov li a{
> > text-decoration:none;font-size:130%;}
> > #ygrp-sponsor #nc {
> > background-color:#eee;margin-bottom:20px;padding:0
> 8px;}
> > #ygrp-sponsor .ad{
> > padding:8px 0;}
> > #ygrp-sponsor .ad #hd1{
> >
>
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
> > #ygrp-sponsor .ad a{
> > text-decoration:none;}
> > #ygrp-sponsor .ad a:hover{
> > text-decoration:underline;}
> > #ygrp-sponsor .ad p{
> > margin:0;}
> > o {font-size:0;}
> > .MsoNormal {
> > margin:0 0 0 0;}
> > #ygrp-text tt{
> > font-size:120%;}
> > blockquote{margin:0 0 0 4px;}
> > .replbq {margin:4;}
> > -->
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
___________________________________________________________
> > Copy addresses and emails from any email account to
> Yahoo! Mail - quick,
> > easy and free.
> http://uk.docs.yahoo.com/trueswitch2.html
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------