Embedded System Application: Serial Communication
Embedded System Application: Serial Communication
Embedded System
Application
4190.303C
Laboratory
Serial Communication
ELPL
Naehyuck Chang
Dept. of EECS/CSE
Seoul National University
[email protected]
Introduction to System-on-Chip
i4040 - the first-generation microprocessor
Very low density even for a complete microprocessor core
Too expensive glue logic implementation when TTL is used
Companion chips
Component Commercial
development system
products
Death Valley
Synchronized!
Local clock
Local clock
CPU Rx
Rx FIFO
Interface Shift Reg.
Tx
Tx FIFO
Shift Reg.
HOST 1 Interrupt
Control
Tx FIFO Tx
Shift Reg.
HOST 2 Interrupt
Control
Tx FIFO Tx
Shift Reg.
Crossover cable
PAM
(DTE)
GND
Total Number of Drivers and Receivers on One Line (One driver active at 1 DRIVER 1 DRIVER 1 DRIVER 32 DRIVER
a time for RS485 networks) 1 RECVR 10 RECVR 10 RECVR 32 RECVR
Maximum Cable Length 50 FT. 4000 FT. 4000 FT. 4000 FT.
Maximum Data Rate (40ft. - 4000ft. for RS422/RS485) 20kb/s 100kb/s 10Mb/s-100Kb/s 10Mb/s-100Kb/s
Maximum Driver Output Voltage +/-25V +/-6V -0.25V to +6V -7V to +12V
+/-5V to
Driver Output Signal Level (Loaded Min.) Loaded +/-3.6V +/-2.0V +/-1.5V
+/-15V
Driver Output Signal Level (Unloaded Max) Unloaded +/-25V +/-6V +/-6V +/-6V
Driver Load Impedance (Ohms) 3k to 7k >=450 100 54
Max. Driver Current in High Z State Power On N/A N/A N/A +/-100uA
+/-6mA
Max. Driver Current in High Z State Power Off +/-100uA +/-100uA +/-100uA
@ +/-2v
Slew Rate (Max.) 30V/uS Adjustable N/A N/A
Receiver Input Voltage Range +/-15V +/-12V -10V to +10V -7V to +12V
Receiver Input Sensitivity +/-3V +/-200mV +/-200mV +/-200mV
Receiver Input Resistance (Ohms), (1 Standard Load for RS485) 3k to 7k 4k min. 4k min. >=12k
Embedded System
Application
4190.303C
Laboratory
I2C Bus
ELPL
Naehyuck Chang
Dept. of EECS/CSE
Seoul National University
[email protected]
Basic Characteristics
Two-wired communication
SDA and SCL
I2C is for on-board communication so the ground is shared
Multi-master
Multiple masters allowed with collision detection and arbitration
Operate as either a transmitter or receiver, depending on the function of the device
Devices can also be considered as masters or slaves when performing data transfers
Speeds
100 kbps (standard mode)
400 kbps (fast mode)
3.4 Mbps (high-speed mode)
8-bit oriented data transfer
Addressing
7-bit or 10-bit unique addresses
Basic Terminology
The I2C-bus specification
idth
SDA
SCL
SDA SDA
SCL SCL
S P
DATA OUTPUT
BY TRANSMITTER
not acknowledge
DATA OUTPUT
BY RECEIVER
acknowledge
SCL FROM
1 2 8 9
MASTER
S
clock pulse for
START acknowledgement
condition
MBC602
Transferring Data
during the acknowledge clock pulse. to allow the master to generate a STOP or repeated
START condition.
The receiver must pull down the SDA line during the
acknowledge clock pulse so that it remains stable LOW
Data transfer diagram
byte complete,
interrupt within slave
SCL S Sr
or 1 2 7 8 9 1 2 3-8 9 or
Sr P
ACK ACK
START or STOP or
repeated START Slave hold the SLK low during the interrupt processing repeated START
condition condition
MSC608
10
41 ELPL Embedded Low-Power
Laboratory
Transferring Data
Byte format
Every byte put on the SDA line must be 8-bits long
The number of bytes that can be transmitted per transfer is unrestricted
Each byte has to be followed by an acknowledge bit
Data is transferred with the most significant bit (MSB) first
DATA
2
SDA
SCL
S MSC609
7-Bit Addressing
MBC607
The addressing procedure for the I2C-bus determines which slave will be selected by the
master format.
Combined
The first byte after the START condition
Definition of bits in the first byte
The first seven bits of the first byte make up the slave address
When an address is sent, each device in a system compares the first seven bits after the START
condition with its address
If they match, the device considers itself addressed by the master as a slave-receiver or slave-
transmitter, depending on the R/Wbit
t the
es
ption MSB
handbook, halfpage LSB
ices. R/W
ory,
n be slave address
MBC608
SLAVE
R/W BIT DESCRIPTION
ADDRESS
0 0 0 0
0000 000 0 General call address
firs
0000 000 1 START byte(1) (general
0000 001 X CBUS address(2)
0000 010 X Reserved for different bus
format(3) F
0000 011 X Reserved for future purposes
0000 1XX X Hs-mode master code
When bit B i
1111 1XX X Reserved for future purposes definition:
1111 0XX X 10-bit slave addressing
• 00000110
Notes of slave ad
ELPL
1. No device is allowed to acknowledge at the reception
46
Embedded Low-Power
sequence,
Laboratory
general ca
byte or prepare another byte to be transmitted. Slaves can
SDA
S P
13
width A/A
S SLAVE ADDRESS R/W A DATA A DATA P
data transferred
'0' (write) (n bytes + acknowledge)
Fig.11
A master A master-transmitter
reads addressing
a slave immediately after thea first
slavebyte
receiver with a 7-bit address.
The transfer direction is not changed.
At the moment of the first acknowledge
The master-transmitter becomes a master-receiver
The slave-receiver becomes a slave-transmitter
This first acknowledge is still generated by the slave
The STOP condition is generated by the master
, full pagewidth 1
S SLAVE ADDRESS R/W A DATA A DATA A P
data transferred
MBC606 (read) (n bytes + acknowledge)
14
49 ELPL Embedded Low-Power
Laboratory
e I2C-bus specification
Formats with 7-Bit Addresses
Combined format
ull pagewidth
S SLAVE ADDRESS R/W A DATA A/A Sr SLAVE ADDRESS R/W A DATA A/A P
(n bytes (n bytes
+ ack.) * + ack.) *
read or write
read or write direction
of transfer
may change
* not shaded because Sr = repeated START condition at this point.
transfer direction of
data and acknowledge bits MBC607
depends on R/W bits.
BIT ADDRESSING
dressing procedure for the I2C-bus is such that the
e after the START condition usually determines
lave will be selected by the master. The exception 50 MSB
handbook, halfpage ELPL Embedded Low-Power
Laboratory
LSB
First frame 1 1 1 1 0 A0 A1 A2
Embedded System
Application
4190.303C
Laboratory
SPI Bus
ELPL
Naehyuck Chang
Dept. of EECS/CSE
Seoul National University
[email protected]
Basic Characteristics
SPI - Serial Peripheral Interface Bus
De facto standard
No unique specification or protocol defined
Many variants exist
Full duplex communication
Single master, single slave without chip-enable signals
Multi slave available with multiple chip-enable signals
Daisy-chain available with single chip-enable signal
Register read/write
ex) CMOS camera module