4
\$\begingroup\$

I am trying to understand UART synchronization. In a UART, the default state is high, and it starts the reception process when it receives a start bit (high-to-low transition)

In some scenarios any spike, noise or interrupt may change the state from high to low, which is enough for the UART to detect it as a start bit. I know that a UART internally handles these scenarios and avoids the process of receiving a full byyr.

Can anyone explain me how a UART handles these spikes?

\$\endgroup\$
  • 6
    \$\begingroup\$ There's a lot of information in this related question if you haven't already seen it. \$\endgroup\$ – Roger Rowland Mar 21 '16 at 5:26
  • \$\begingroup\$ ur saying that the junk has the same logic level and baud rate as the start bit?? \$\endgroup\$ – AlphaGoku Mar 21 '16 at 5:26
  • \$\begingroup\$ @AkshayImmanuelD junk means spike or noise \$\endgroup\$ – Embedded C Mar 21 '16 at 5:29
  • \$\begingroup\$ @LetUsEmbed "I know UART internally handles these scenarios and avoids the processing." AFAIK UART cannot differentiate between an actual data and a data that is induced by noise. Basic level of support that you can expect from the hardware UART Logic is parity check, that too it can detect only one bit Errors. The rest of the filtering of good and bad data frames is done in the Serial Protocol part. \$\endgroup\$ – seetharaman Mar 21 '16 at 6:03
  • \$\begingroup\$ Are you assuming UARTs do edge detection? It sounds to me like UARTs are doing level detection and oversampling. \$\endgroup\$ – JS. Mar 21 '16 at 15:58
5
\$\begingroup\$

UART Receiver samples the Rx line 16 times(most uC's) before confirming the value of each bit. For example, if the baud is 9600,each bit time will be 104uS. Now to correctly detect the value of each bit(i.e whether its high or low), the UART receiver samples the bus every 104uS/16 seconds. The majority voting of these samples is then used to decide the value of a bit. The start bit is used to indicate to the receiver that data bits are about to be received. Its mandatory that the start bit be low.By employing such a sampling scheme, the receiver ensures that the effects of noise is eliminated.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is called oversampling. On some MCUs the oversample (16x, 8x, etc) is configurable. \$\endgroup\$ – Chad Kennedy Mar 21 '16 at 15:37
3
\$\begingroup\$

The UART will not start receiving a character simply because the line went low. It needs to be low for a certain period of time (30 to 50 percent of one bit time, and on some devices this may even be selectable). A glitch won't be long enough to trigger the reception of a character.

If noise does trigger this operation, that means your communication line is too noisy to be used for serial communication, at least not without some added error detection and correction.

| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.