Monday, 18 June 2018

rs232 - Why does RS-232 need a stop bit?



This might be obvious but I don't understand why RS-232 needs a stop bit. I understand that the start bit is necessary to notify the other end about the beginning of a transmission.



Let's say we are communicating at 9600BPS. We go from high to low, so that the receiver will know something is coming. The receiver also knows that we are at 9600BPS and it will receive 7 bits of data in total.


So, after receiving 7 bits, the transmission will end. Since we can determine the end of the transmission just by calculation, why do we need a stop bit as well?



Answer



The thing to remember is that RS232 is an asynchronous protocol. There is no clock signal associated with it.


Timing diagram of 8 bit byte showing margin of error for clock


Figure 1. Receiver sampling points. Source: Sangoma.


The start bit is used to trigger the read cycle in the receiver. The receiver synchronises itself on the start bit and then waits 1.5 cycles to start sampling bits. Thereafter the bits are sampled at the baud rate. This initial delay means that even with a 5% clock error the receiver should still be within the bit timing for the last bit.


Since the start bit - shown low in Figure 1. - is identified by a falling edge then it must be preceded by a high and this is what the stop bit ensures. The alternative would be two start bits and no stop bits but it wouldn't change the total message length.


The linked article has some other points worth noting.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...