Interfacing Serial Communication
Interfacing Serial Communication
----------------------------------------------------------------------------------------------------------------------------------------------
P. C. Pandey
----------------------------------------------------------------------------------------------------------------------------------------------
<[email protected]> serial_comm_01apr16.doc
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 2
------------------------------------------------------------------------------------------------------------------------------------
2. Asynchronous Communication
No clock transmission. Only data & handshake lines. Tx & Rx use local
clocks with same nominal value, not synchronized.
• Transmission: Idle state, start bit, data bits, (parity, error correction
bits), stop bit(s) / idle state. Reception: Detect start (1 → 0) transition,
wait 1/2 bit time, sample the input at bit time intervals.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 11
------------------------------------------------------------------------------------------------------------------------------------
• Clock tolerance
Tx bit time = Tb
Rx bit time = Tb+∆
Cumulative error = N∆ < 0.5Tb
(N = No. of bits (including start, excluding stop/idle)
⇒ For N=10, ∆ ⁄ Tb < 5% %.
• Baud rate: Limited by clock tolerance.
• Throughput (data bandwidth) for a given baud rate: Low due to
overheads per frame and small frame size.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 12
------------------------------------------------------------------------------------------------------------------------------------
3. Synchronous Communication
Tx & Rx use clock generated by the master.
• Output at one clock edge (falling) & input at the other edge (rising).
• Signal lines: Data, Clock, [Select] (Clock & data may be combined)
• Clock [& select] generated by the master
• Drivers may be
needed
• No basic restriction
on frame length
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 13
------------------------------------------------------------------------------------------------------------------------------------
• Shielded cable
o Shield connected to frame ground at one end
(signal ground → power supply ground)
o Reduced RF & electrostatic interference
• Twisted pair
o Reduced inductive pick-up
o Baud rate limited due to increased capacitive loading
4.2 Connectors
DB25 / RS232: 1-13,14-25; DB9 / E1A-574: 1-5, 6-9;
RJ45: 1-8 (Telephone type jack)
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 15
------------------------------------------------------------------------------------------------------------------------------------
Problem to be tackled
• Signal attenuation (caused by loading & distance)
• Pulse transition delay / double pulsing due to reflection (caused by
impedance mismatches & sharp transition)
• Interference between signal lines
• External pick up (electrostatic, inductive, electromagnetic)
• Difference in ground potential
• Overvoltage & overcurrent
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 17
------------------------------------------------------------------------------------------------------------------------------------
Some solutions
• Large voltage or current levels
• Trapezoidal pulses
• Matched termination
• Use of current loop
• Differential voltage transmission
• Special cables: Shielded (reduces EM pick up), Grounded shielded
(reduces EM & electrostatic pickup), Twisted pair (reduces inductive
pickup)
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 18
------------------------------------------------------------------------------------------------------------------------------------
Polarity-Insensitive
Current Loop
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 26
------------------------------------------------------------------------------------------------------------------------------------
6.1 Signaling
• Single ended link
• Shielded cable with
shield connected to
frame ground at DTE.
• Signal ground
connected to power
supply ground at both
ends.
6.2 Connectors
DB25 (RS 232): 25 pins, 21 signals
DB9 (EIA 574): 9 pins, 9 signals
RJ45 (EIA 561): 8 pins, 8 signals
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 28
------------------------------------------------------------------------------------------------------------------------------------
6.3 Drivers
e.g., Max 232
±12 V from 5 V supply using
charge pump & four 100nF
capacitors
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 30
------------------------------------------------------------------------------------------------------------------------------------
Input specs
• |dVin/dt| ≤ 30 V/µS
• True: −15 V ≤ Vin ≤ −3 V, False: 3 V ≤ Vin ≤ 15 V
• Rin: 3 − 7 kΩ, Cin ≤ 2500 pF
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 31
------------------------------------------------------------------------------------------------------------------------------------
7.2 Specifications
• No. of nodes (Tx/Rx) ≤ 32 nodes
• True : - 5 V < Vout < −1.5 V; Vin < −0.2 V
False : +1.5 V < Vout < +5 V; Vin > + 0.2
Transn. : −1.5 V < Vout < +1.5 V; | Vin | < + 0.2
• Balanced o/p & i/p impedances
Ro+ ≈ Ro- ≈ 54 Ω, Rin+ ≈ Rin- > 12 KΩ
• Termination for high baud rate or long distance, so that Rterm. ≈ 50 Ω
(combination of all terminations) → 120 Ω termination at two far ends.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 33
------------------------------------------------------------------------------------------------------------------------------------
• Unterminated Configuration
o Minimal load on driver; Better DC noise margin (noise margin : driver
swing – receiver sensitivity)
o Clock rate and distance restriction due to signal reflections on the
cable (time to traverse < bit interval, rise time > 4 propagation time): <
200 kbps, short distances;
• Parallel Termination
o Termination at two ends : RT ~ 1.1 ZO → negligible reflection
o Increased loading & reduced noise margin
o Disturbance of Rx internal biasing
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 35
------------------------------------------------------------------------------------------------------------------------------------
• Power Termination
• AC Termination
o No effect at lower frequencies;
No static loading
o Rt ≈ 100 − 150 Ω
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 36
------------------------------------------------------------------------------------------------------------------------------------
8.2 Example
One master (microcontroller) & 3 slaves (ADC, DAC, microcontroller)
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 40
------------------------------------------------------------------------------------------------------------------------------------
8.6 Applications
Low pin count, Low cost, Low to moderate speed
• EEPROM for configuration data; NVRAM for user settings.
• Real-time clock; Low speed DACs and ADCs; Sensors with digital
readout; Power supplies with digital control.
8.7 Limitations
• Conflict of slave addresses. May be solved by having device pins for
user settable address.
• Spurious address detection due to speed mismatch.
• Throughput degradation due to clock stretching. Separate segments for
low and high latency devices.
• Problems due to shared bus.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 45
------------------------------------------------------------------------------------------------------------------------------------
• Device types
o Master (single): Generates the clock & originates the frame for reading
and writing by selecting the slave.
o Slave (multiple): Selected slave reads and writes data.
• Slave selection: Through slave select line; No device address. Only one
slave may communicate with the master.
• Low-overhead full-duplex data transfer under complete control by
Master.
o Clock generated by master. Rate (up to a few MHz) should be
supported by slave.
o Delay between slave select & clock to allow for slave response time.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 48
------------------------------------------------------------------------------------------------------------------------------------
• Operation sequence
o Master generates Slave Select (logic 0) & produces clock cycles,
after a delay if required for response by the Slave.
o A full-duplex transmission occurs during each clock cycle. Master
sends data bit on MOSI & slave reads it. Simultaneously, slave
sends a bit on MISO & master reads it. Sequence maintained even if
only one-directional data transfer intended.
o For more data exchange, the shift registers are reloaded and
process repeated. After data transfer, master stops toggling the
clock & deselects the slave.
o Unless selected, slave device disregards Clock & MOSI, & does not
drive MISO.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 51
------------------------------------------------------------------------------------------------------------------------------------
9.7 Variations
Clock handling: (i) Ignore additional clocks after the specified number of
clocks, (ii) Continue shifting data bits if SS active.
Interrupts: Extra line from slave to send an interrupt to the host Master.
Examples: Pen-down from touch-screen sensor, thermal limit alert from
temperature sensor, alarm from RTC, headset jack insertion from the
sound codec, etc.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 54
------------------------------------------------------------------------------------------------------------------------------------
9.7 Advantages
• Defualt full-duplex communication.
• High speed & good signal integrity due to push-pull output (as opposed
to open-drain). Low power requirement (no pull-up resistors). No
transcievers needed. Simple hardware interfacing.
• Unidirectional signals, permitting easy Galvanic isolation.
• Higher throughput due to low overheads.
• Protocol flexibility (not limited to 8-bit words); Arbitrary choice of
message size.
• No arbitration or associated failure modes. Slaves do not need unique
addresses, permitting multiple identical slaves.
• Low processing overhead for microcontrollers with on-chip SPI
controllers capable of running in either master or slave mode.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 55
------------------------------------------------------------------------------------------------------------------------------------
9.8 Disadvantages
• Needs more pins (than I2C), particularly in case of multiple
independent slaves.
• No hardware flow control by the slave.
• No hardware slave acknowledgment.
• Typically only one master supported.
• Many existing variations, which may not be supported by development
tools like host adapters.
• Fixed configuration; No hot swapping (dynamic adding of nodes).
• Interrupt from the slave to the host master to be implemented using
extra line, or by periodic polling.
P.C. Pandey, "Serial communication interface", lecture notes, EE Dept, IIT Bombay, March'05, rev. Apr'16 56
------------------------------------------------------------------------------------------------------------------------------------
9.9 Applications
Microcontollers & FPGAs
Peripherals: ADCs, DACs, touch-screens, video game controllers, audio
codecs, digital potentiometers, Digital MEMS (temperature, pressure,
accelerometer, magnetometer, etc.).
Communication chips: Ethernet, USB, USART, CAN, etc.
Flash memory, EEPROM, RTC.
Display controllers: LCD controllers, LED drivers.