UART frame has 1 start bit, 8 bit payload data, 1 or 2 stop bits. Frame structure and baud rate is agreed by both transmitter and receiver for successful data transmission. Start bit is used to synchronize and tell receiver that frame is started. Why there is a need of stop bit per frame, since all data frame to be transmitted will always be 8 bits (frame will always end with 8 bits)?
-
\$\begingroup\$ stop bits are added to a communication protocol in case of unforeseen interference. In phone modems, we added this especially to handle communication issues with poor quality phone lines. \$\endgroup\$– David MikeskaApr 26, 2021 at 16:35
-
\$\begingroup\$ This comment may be relevant: electronics.stackexchange.com/questions/608214/… \$\endgroup\$– smwikipediaFeb 13, 2022 at 2:44
3 Answers
What is used for synchronization is not the start bit itself, but the falling edge between the previous stop bit and the start bit.
Without both stop and start bits, there might not be such an edge.
-
\$\begingroup\$ There are UART implementations that support half stop bits. \$\endgroup\$ Oct 17, 2015 at 10:24
-
3\$\begingroup\$ Yes, the length of the stop bit state does not matter. \$\endgroup\$– CL.Oct 17, 2015 at 10:28
-
\$\begingroup\$ Then why not just add a single one stop bit after all the data has been sent rather than have a stop bit for every frame of data. \$\endgroup\$ Feb 12, 2022 at 14:22
-
\$\begingroup\$ @smwikipedia The "A" in "UART" stands for "asynchronous". Sender and receiver have their own clocks, so they must regularly re-synchronize. \$\endgroup\$– CL.Feb 12, 2022 at 18:00
-
\$\begingroup\$ @CL. Thanks. To be honest, I don't have a practical experience about how bad the clocks of the two parties can differ. But even if we add stop bits for every frame, how could that make everything in sync? After all, the stop bits don't touch the receiver's clock (not sure if I am right on this). And if the receiver's clock is wrong, it will always be wrong. \$\endgroup\$ Feb 13, 2022 at 1:38
(sorry: I'm in lecturer mode)
What will the line signal look like (without a stop bit) when you transmit a continuous stream of 0x00 bytes? which problem will this cause?
-
\$\begingroup\$ For 9 bit (1 start bit + 8 data bit), UART lines will be 0 (9 spaces). \$\endgroup\$ Oct 17, 2015 at 7:37
-
1\$\begingroup\$ I think to re-synchronize receiver, stop bit is used \$\endgroup\$ Oct 17, 2015 at 7:40
-
8\$\begingroup\$ The point is that it will always be 0. Hence the receiver (which can have a clock that differs somewhat from the sending clock) will (after some time) lose track of where the bytes start. Hence 1000 bytes sent could be received as 999 or 1001 bytes. \$\endgroup\$ Oct 17, 2015 at 8:19
-
1\$\begingroup\$ I dont get it. Why wiuld he lose track if there is a predefined baud rate? I mean, the receiver should know that a bit should arrive each x time..? \$\endgroup\$ Apr 1, 2021 at 13:48
-
1\$\begingroup\$ The difference is assuming the data within a 8bit count vs knowing the 8-bits of data originated from the transmitter. if the frame size was skewed due to poor wiring, it couldn't tell the difference, and shift all the data and garbage bits from noise in. With a stop bit in certain communications, it has a frame reference and if it goes outside that frame reference it will send a retry bit back to the transmitter and error correct the transmission. \$\endgroup\$ Apr 26, 2021 at 16:47
It's a holdover from the days of electromechanical teletypewriters, when the time was used to release a clutch in the electromechanical transmitter mechanism. It was carried forward into fully electronic UARTs, perhaps because the original electronic designers didn't understand electromechanical teletypewriters.
Here's a discussion of how the old teletypewriters worked: http://mysite.du.edu/~jcalvert/tel/teletype.htm
-
1\$\begingroup\$ That's a valid reason for adding extra stop bits, but you always need at least one, as described in the other answers, in order to guarantee having at least one transition in the signal for every byte transmitted, even with back-to-back characters. \$\endgroup\$ Dec 16, 2015 at 15:03