Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Slightly unmatched UART frequencies



Valentin,

You bright up a good subject, and you're absolutely correct that if you
continuously send data from one serial port at 9600.01bps to a receiver at
9600, sooner or later there must be a buffer overflow.  There's no way
around this -- but keep in mind that RS-232 (or most any protocol, for that
matter) isn't designed to send a truly continuous stream for days, months,
or years at a time without a break!  With a typical RS-232 device, there are
MANY breaks, and keep in mind that something like a PC often has a pretty
generous software buffer (many kilobytes) backing up the hardware so that it
would take a 'long' time to create an overflow.  I can't explain your
observation that an, e.g., 8031-based data forwarder -- supposedly -- works
other than to say I suspect that perhaps you didn't really do the type of
torture test that could produce an overrun.  (I.e., did you look with a
scope or logic analyzer to make sure there was NEVER a idle bit time that
might have allowed the receiver to 'catch up'?)

One solution that you can use for protocols such as 8B/10B -- where you get
a bazillion data bytes interspersed with an occasional 'comma' character -- 
is to use a form of compression where you assign 9 bits to ever received
byte and 'swallow' any comma you get by setting the high bit.  You can then
sit down and work out how often you need to insert a comma into your
bitstream to avoid buffer overflow.  We had a gigabit fiber interface that
used this approach, and with a 16 byte FIFO for buffering and a +/-100PPM
clock at 1.0625Gbps, the numbers worked out to many thousands of bytes
before overflow would be a concern.

To build a data repeater that never suffers from potential buffer overflow
under any circumstances whatsoever, I don't think you have many options
other than locking the re-transmit bit rate to that of the received data
using, e.g., a PLL.  You could try this in software as well, I suppose, if
you have a bit rate generator that's 'finely tunable' -- most in
microcontrollers aren't!

A few other comments:

> UART is used to transfer a byte in serial form bit-by-bit. I know that 10%
> deriviations in frequencies of transmitter and receiver are permissible.

'Permissible,' yeah, I suppose, although 10% wouldn't be anything to write
home about!

> I have developed a simple UART. It's receiver and transimtter run at 9600
> bps with 16x oversampling.

Nothing wrong with 16x oversampling (it will definitely help -- a little),
but keep in mind that you _can_ get away with no oversampling at all and get
quite reasonable results if you position the sample point at the middle of
each bit interval.

---Joel Kolstad





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.