I am new to embedded programming and have very little knowledge in how digital/electronic system works, but I have been given a task to bring up USART communication between two chips. For that, I have started learning from the basics of serial communication etc etc. What I don't understand in serial protocol is that what is the difference between synchronous and asynchronous communication? Let us say I have two devices d1 and d2. They both are aware of their baud rates. d1 sends data at a baudrate of 9600 and d2 receives data at the same rate. Then my question is, how the clock plays role in synchronous communication? Means with baud-rate I think we have all the information of the communication channel. With this confusion I am not able to clearly understand the exact difference between synchronous and a synchronous communication.
With asynchronous data transmission, when there is no payload data to be sent, the data line becomes idle and therefore the receiver waits for a transition that marks the beginning of new incoming data. In this respect there is no definite phase relationship between data previously received and the new data arriving.
This is why it is called "asynchronous"
With synchronous data, either a clock is permanently present as a seperate signal or, the clock is embedded into the data (as per Manchester encoding or scrambling) so that the receiver is always aware when real payload data could be present. When no payload data is present the clock is still present. Manchester encoded data: -
how the clock plays role in synchronous communication?
Whether you extract the clock from the data (or have a dedicated clock line) you need a clock; that is fundamental to any data transmission. Asynchronous transmission re-creates a clock internally based on the agreed baud rate and the first transition of data following an idle period. From this point on until the end of the data block it generates a clock internally for the whole transmission.
So the clock plays a vital role in both asynchronous and synchronous data communications.
with baud-rate I think we have all the information of the communication channel
Not quite - knowing baud rate at both ends is useful but it doesn't tell you when bits actually change state in the data - this "synchronization" to the data is performed by the idle-to-start bit transmission in asynchronous data and is everpresent in synchronous data communication.
In Synchronous mode, the clock is shared between the 2 devices. Example SPI --> At each Clock Cycle, the slave sample the data sent from the master.
In Asynchrounous mode; there is no clock shared and the 2 devices need to work at the same frequency. Asynchronous challenge lies in making sure that both devices are at the same frequency (whatever voltage, temperature, drift ...)
In General Digital Systems to communicate serially between two or more devices we need some reference that is Clock. Based on the Clock reference there are two modes of Serial communications.
Synchronous Serial Communication
In Synchronous communication, the communicating devices should at least need two lines to send the Data. One line for Clock it will be the reference and another line will be the data to be sent. Basically clock is given by any system or on-chip clock. Its Frequency based on the Baud Rate.
Refer the Image: Clock is separate and Data is separate and absence of start and stop bits
Asynchronous Serial Communication
In Asynchronous Serial communication using single line data can transfer between the devices. Here there is no need of clock line separately, this will handled by some Start and Stop bits with in the data block itself.
Refer the Image: Clock is absent but start, stop and other supporting bits are presence
Note : Synchronous communication suitable for Bulk data transfer.It mostly transfer the data frames by frames
ASynchronous Serial communication suitable for byte transfer.It mostly transfer the data byte by bytes.