Searching \ for '[PIC]About USART Anyone' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=usart
Search entire site for: 'About USART Anyone'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]About USART Anyone'
2006\10\15@150340 by Genome

picon face
hello
Does abyone know how to implement auto baudrate detection.. as of now i'm
thingking of sending 0x00 continuosly at intervals and simply on the PIC
side detect framing and overrun errors and if errors are detected set the
baudrate to the next lower... will this work.. any body done something
similar and can point me somewher..

thanks..



2006\10\15@153618 by Jan-Erik Soderholm

face picon face
Note that many newer PICs (all with EUSART ?) has
autobaud builtin in the hardware.

Jan-Erik.



2006\10\15@162858 by Jinx

face picon face

> Does anyone know how to implement auto baudrate detection

How about measuring the length of a frame (with the Rx pin
not in UART mode) and use maths or a table to set the baud
rate ? Then switch the pin to UART mode

2006\10\15@174254 by William Chops Westfield

face picon face
>
>> Does anyone know how to implement auto baudrate detection
>>
There are three common algorithms that I know of for doing autobaud:

1) As you describe, step through appropriate bit rates till you don't
   get errors.
2) As above, except use the results in the shift register to glean
   "hints" of the likely bit rate; just as output at the wrong speed
   looks like garbage, specific input can also look like specific
   character(s), and you can usually detect a fairly large range in
   two keypresses or so.  Subject to lossage if there are unusual
   parity/stopbit configurations, or particularly large ranges of
   possible speed.
3) time the initial bit(s), either using the uart input as a gp input,
   or with dedicated hardware of some kind.  If you use any odd char
   as your speed select character, you'll be timing the single start
   bit of the character...

(Does anyone remember tymnet?  When you dialed in, they had a magic
prompt that showed up without garbage characters regardless of your
serial speed.  I always figured that this was clearly possible, and
somewhat interesting, but always wondered what the exact algorithm
was...  (of course, in those days, the variety of likely speeds was
pretty limited.))

 BillW

2006\10\15@182822 by Bob Axtell

face picon face
If I have a fast interrupt timer, I examine the bit width and compare it
to a known table.
You don't need a special character sent if you keep measuring until you
find the SMALLEST
width, that will be a single bit width. You MIGHT be able to measure
high speeds accurately
with tight looping; you will have to decide by testing which baud rate
causes what result. Note
that because the protocol is tolerant of minor speed differences, the
measurement will never
be exact all the time, just close.

Tymnet and others did it because the input message was identical in
spots; those spots were
examined, and dependent on the results, the baud rate was decided on. It
would therefore
always respond with the correct baud rate.

--Bob

William Chops Westfield wrote:
{Quote hidden}

2006\10\15@184318 by Howard Winter

face
flavicon
picon face
Bill,

On Sun, 15 Oct 2006 14:42:44 -0700, William "Chops" Westfield wrote:

{Quote hidden}

I believe that's why the Hayes commands always start with "AT" - they use the misreads to determine the error between the expected baud rate and
the actual one.  I don't know what the misreads look like, but I understand they are pretty predictable.

Cheers,


Howard Winter
St.Albans, England


2006\10\15@184413 by William Chops Westfield

face picon face

On Oct 15, 2006, at 3:26 PM, Bob Axtell wrote:

> You don't need a special character sent if you keep measuring
> until you find the SMALLEST width, that will be a single bit width.

Not all characters end up having either a zero or one that is only
a single bit width wide.  IIRC, a string of capital "U" characters
is nearly a perfect square wave (with f = 1/5 bitrate?) (this caused
some interesting problems with some of the early high-speed modems;
they'd lose sync...)

>  It would therefore always respond with the correct baud rate.

The prompt I was talking about appeared before there was ANY
user input...

BillW

2006\10\15@230311 by Jinx

face picon face
> Not all characters end up having either a zero or one that
> is only a single bit width wide.  IIRC, a string of capital "U"
> characters is nearly a perfect square wave

That's how the PIC EUARTs auto-baud

"Once the ABDEN bit is set, the state machine will clear
the BRG and look for a START bit. The Auto Baud
Detect must receive a byte with the value 55h (ASCII
"U", which is also the LIN bus Sync character), in order
to calculate the proper bit rate. The measurement is
taken over both a low and a high bit time in order to
minimize any effects caused by asymmetry of the
incoming signal. After a START bit, the SPBRG begins
counting up using the preselected clock source on the
first rising edge of RX. After eight bits on the RX pin, or
the fifth rising edge, an accumulated value totalling the
proper BRG period is left in the SPBRGH:SPBRG registers.
Once the 5th edge is seen (should correspond to
the STOP bit), the ABDEN bit is automatically cleared"

2006\10\16@045836 by Bob Axtell

face picon face
William Chops Westfield wrote:
> On Oct 15, 2006, at 3:26 PM, Bob Axtell wrote:
>
>  
>> You don't need a special character sent if you keep measuring
>> until you find the SMALLEST width, that will be a single bit width.
>>    
>
> Not all characters end up having either a zero or one that is only
> a single bit width wide.  IIRC, a string of capital "U" characters
> is nearly a perfect square wave (with f = 1/5 bitrate?) (this caused
> some interesting problems with some of the early high-speed modems;
> they'd lose sync...)
>
>  
>>  It would therefore always respond with the correct baud rate.
>>    
The 'U' character would be fine for my scheme. I am not needing a
character with ONE bit
width, I can measure the single bit width anytime, and a string of 'U's
are perfect.

>
> The prompt I was talking about appeared before there was ANY
> user input...
>
>  
No, there HAD to be traffic before the prompt appeared. Otherwise, how
would it know
anyone was even there?

--Bob

> BillW
>
>  

2006\10\16@055218 by Lee Jones

flavicon
face
>> The prompt I was talking about appeared before there was ANY
>> user input...

> No, there HAD to be traffic before the prompt appeared. Otherwise,
> how would it know anyone was even there?

Because the modem's carrier detect signal line went active.

                                               Lee Jones

2006\10\16@065023 by Bob Axtell

face picon face
Lee Jones wrote:
>>> The prompt I was talking about appeared before there was ANY
>>> user input...
>>>      
>
>  
>> No, there HAD to be traffic before the prompt appeared. Otherwise,
>> how would it know anyone was even there?
>>    
>
> Because the modem's carrier detect signal line went active.
>
>                                                Lee Jones
>
>  
That's it? Odd, my old BBS had traffic coming in before it  posted a
response...

--Bob

2006\10\17@095545 by Dave Lag

picon face
Howard Winter wrote:

> I believe that's why the Hayes commands always start with "AT" - they use the misreads to determine the error between the expected baud rate and
> the actual one.  I don't know what the misreads look like, but I understand they are pretty predictable.

Well, since they based on/called the ATTENTION codes.... :)

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...