Serial RS232 Communication for Newbies

After a long time again, While working in FARASBEE, First project I got finally compelled me to study about Serial Communication, the term I heard very long time before. 🙂 Its not that terrifying but ya concepts are bit complication ( at least were for me), In this post I am discussing about the Concept of Serial Communication , its interfacing with Computer using serial terminals and few more stuff that I got while working on this project.

Serial Communication:-

Process of sending 1 bit at a time over a communication channel is Serial Communication. RS232 is the most common and one of the oldest type of Serial Communication protocol still widely used.

RS232 Block Diagram

This is the basic block diagram for serial communication.

Line Driver ( important part) :-

RS232 communication uses voltage upto +15V and it uses inverse logic that is

high | true  1  =  negative voltage,

low | false |0 =  positive  voltage.

Now the question arises Why do we need Line Driver?

Answer is pretty clear : Since these voltages are far too high for modern computer logic, So we do have to use Line Driver. It converts computer logic to High Voltage & output voltage is typically continuous short-circuit safe.

Why does Line receiver required here?

It just inverses the operation of line driver i.e. converts incoming RS232 Signal to voltage safe for computer logic.

UART (Universal Asynchronous Receiver Transmitter) :-

  • The Universal Asynchronous Receiver/Transmitter (UART) takes bytes of data and transmits the individual bits in a sequential fashion. At the destination, a second UART re-assembles the bits into complete bytes.
  • The UART usually does not directly generate or receive the external signals used between different items of equipment. Separate interface devices are used to convert the logic level signals of the UART to and from the external signaling levels.
  • It adds necessary start/stop & Parity bits when transmitting & decode this information when recieving.
  • It operates completely on Logic Voltage.
  • UARTs are called asynchronous, because they don’t use a special clock signal to synchronize with the the remote side. Instead, they use the start/stop bits to identify the data bits in the serial stream.

 This is the theory part. Now back to some practical stuff I learned.

In a UART serial Communication, Line Driver/Receiver shifts voltage level for that TTL is normally used in this chip. Now basic pins you have to consider are Transmitter (Tx), Receiver (Rx) & Ground (GND) in that Line Driver/Receiver IC. Normally for RS232 communication Maxim MAX232 IC is used to change the level from 3.3V to your computer level which is usually at 12V.

Technique to find Tx, Rx & GND from Line Driver/Receiver IC (if you don’t know its datasheet its really hard) that I found after lot of searching is as follows:

To find out the serial console pins on the PCB, you’ll be looking for a populated or unpopulated 4-pin header, which can be far from the SoC (signals are relatively slow) and usually with tracks on the top or bottom layer of the PCB, and connected to the TX and RX.

Once found, you can easily check where is the GND, which is connected to the same ground layer than the power connector. The VCC should be fixed at 3.3V and connected to the supply layer ; the TX is also at 3.3V level, but using a multimeter as an ohm-meter, if you find an infinite resistance between the TX and VCC pins, it means they’re distinct signals (else, you’ll need to find the correct TX or VCC pin). The RX and GND are by default at 0V, so you can check them using the same technique.

If you don’t have a multimeter, a simple trick that usually works is using a speaker or a LED to determine the 3.3V signals.

Now here comes an important term BAUD RATE , Many of us gets confused with Baud Rate and Bit rate, so here is the best place to find its difference BAUD RATE Vs BIT RATE . Now Software part and its tracing will be discussed in my next post.

Advertisements