How the USART deciphers 1's and 0's

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

Not completely off-topic, but has anyone read the Atmel (OK, Xmega) datasheet on USART and how it 'decides' if a 1 is a 1, or not... Sample, and majority jury decision.

 

Last Edited: Fri. Mar 18, 2016 - 05:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 

Remember that the de-coupling caps are not just to provide a nice smooth power supply to your circuit, protecting it from the nasty noisy stuff elsewhere.

They are also to have a reservoir of charge available as close as possible to the power-input to the chip to prevent voltage dip when the chip itself switches things inside on and off. The power supply may not be able to react quickly enough to some of the high speed switching inside your own chip, so you keep a "back pack" of charge on hand, right at the VCC pin. It is there to provide instant backup for you when you make sudden demands on the PSU.

 

**EDIT** I swear I did not post this to this thread. This was a reply I posted to another thread entirely. No idea how it got in here.

SpiderKenny
@spiderelectron
www.spider-e.com

 

Last Edited: Fri. Mar 18, 2016 - 11:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

andycrofts wrote:

Not completely off-topic, but has anyone read the Atmel (OK, Xmega) datasheet on USART and how it 'decides' if a 1 is a 1, or not... Sample, and majority jury decision....

That it a common feature on modern, hardware USARTs. Do you need to do that in software?

- John

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

This has been a property of UARTs since the very early days. That is why the UART clock needs to be 8X or 16X the bit rate. At 8X, it will sample 8 times during each bit. If 5 or more of those have some specific value, then that "value" is taken to be the bit value. 

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

andycrofts wrote:
Atmel (OK, Xmega) datasheet on USART and how it 'decides' if a 1 is a 1, or not... Sample, and majority jury decision.

Similar in AVR8 datasheets.  Three center samples.

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

An important point:

 

Sample weighting for bit state determination is implementation specific. Atmel (and many others) use the middle three bits. Early on, I think (but cannot confirm) that it was 5 out of 8. However, majority voting seems relatively expensive in terms of gates so you do not want to use more bits than really necessary. Hence, I believe, the "modern" three bit test which is also justified as being the "most representative" samples. 

 

BUT, there is nothing magic about choosing 3 bits only. A designer COULD determine the majority of all 8 or 16 samples and validly justify that. Majority of 8 requires 5 or more equal-state samples and majority of 16 requires 9 or mores equal-state samples. The really important point is that all of this makes absolutely no difference in the normal function of asynchronous serial. This ONLY effects noise tolerance and behavior at the outer limits of operation. Under good conditions, one can get away with ONE sample, near the middle of the bit. 

 

It is important to be aware that semiconductor UARTs have been around for more than 40 years, now. There is LOTs of experience about behavior under extreme conditions. UART designers must, I have to believe, have a good handle on what provides the best performance considering power consumption, silicon cost, bit error rates, maximum bit rate, and such.  

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

ka7ehk wrote:
Early on, I think (but cannot confirm) that it was 5 out of 8.

Early in history, or early in AVRland?  AT90S8535 datasheet from an earlier millennium:

...These bits are also sampled at samples 8, 9 and 10. The logical value found
in at least two of the three samples is taken as the bit value.

...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I was thinking at least another 10 years earlier, when UARTs were physically external chips.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

And I was going to answer, "Nicely."

The largest known prime number: 282589933-1

Without adult supervision.

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

I think selecting the 3 central samples also provides some error immunity from two other factors.

With long cable distances, and perhaps "poor" drivers, the cable capacitance can result in the bit transitions being more of an RC curve rather than a nice, fast rise time, step function.

By skipping the first few samples one avoids sampling the signal before it has (hopefully) reached its steady state logic value, (be that low or high).

Skipping the last few samples avoids errors introduced by mis-match or jitter or slightly varying differences in the transmitter's actual baud rate and the decoder's actual baud rate, (and hence center of bit times).

 

With Xtals on the transmitter and the receiver, strong line drivers, and short cables with minimal capacitance, a simple single mid-point sampling software USART usually works great.

(And hence a three sample, mid-point, voting system works even better than great!)

 

JC 

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

ka7ehk wrote:

I was thinking at least another 10 years earlier, when UARTs were physically external chips.

 

Jim

 

I was using the HD6402 in 1978/9 in a 16 boat radio controlled fairground attraction design. Nice chip.

Ross McKenzie ValuSoft Melbourne Australia

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

SpiderKenny wrote:

**EDIT** I swear I did not post this to this thread. This was a reply I posted to another thread entirely. No idea how it got in here.

The thread was split from this one.  Right... here... I believe.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Ross, where did you get the 6402 from? R&D electronics in burwood?

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

Yep, that sounds about right. Cannot remember the guy's name... craft disease.

 

Probably still have a few... hiding somewhere with my TI SR-52 calculator.

Ross McKenzie ValuSoft Melbourne Australia

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

valusoft wrote:
I was using the HD6402 in 1978/9 in a 16 boat radio controlled fairground attraction design. Nice chip.

The RCA CDP1854 was another CMOS UART. Like the 6402 and other UARTs introduced in the 1970s, it sampled each bit just once, midway in: to detect a false start bit, capture the 5-8 data bits and then detect a framing error. A sample per bit worked just fine for more than a decade – and probably still does!

- John