Académique Documents
Professionnel Documents
Culture Documents
BUS
Bus is the mechanism by which the
CPU communicates with memory
and I/O devices
Bus is not just a collection of wires
Bus defines the protocol for
communication
Bus (2)
Shared communication link
single set of wires used to connect
multiple subsystems
A Bus is also a fundamental tool for
composing large, complex systems
Processor
Control
Datapath
Input
Memory
Output
What defines a
bus?
Transaction Protocol
Generic bus
structure
m
Address
:
Data:
Control:
Generic Organization of a
Bus
Control lines:
Signal requests and acknowledgments
Indicate what type of information is on
the data lines
Data lines carry information between the
source and the destination:
Data and Addresses
Address: special form of data
Complex commands
Bus Characteristics
Bus signals are usually tri-stated.
Address and data lines may be
multiplexed.
Every device on the bus must be able to
drive the maximum bus load:
Bus wires.
Other bus devices.
Time Multiplexing
Share a single set of wires for multiple pieces of data
Saves wires at expense of time
Master
req
Servant
data(15:0)
data(15:0)
mux
demux
Master
addr
data
Servant
addr
mux
data(8)
demux
addr/data
req
data
req
req
7:0
15:8
data serializing
addr/data
addr
data
address/data muxing
data
Block transfers:
Allow the bus to transfer multiple words in back-toback bus cycles
Only one address needs to be sent at the beginning
The bus is not released until the last word is
transferred
Cost: (a) increased complexity
(b) decreased response time for request
Advantages of Bus
Versatility:
New devices can be added easily
Low Cost:
A single set of wires is shared in
multiple ways
Disadvantages of Bus
It creates a communication bottleneck
The bandwidth of the bus can limit the
maximum I/O throughput
Parallel communication
Multiple data, control, and possibly power wires
One bit per wire
High data throughput with short distances
Typically used when connecting devices on same IC
or same circuit board
Bus must be kept short
long parallel wires result in high capacitance
values which requires more time to
charge/discharge
Data misalignment between wires increases as
length increases
Higher cost, bulky
Serial communication
Single data wire, possibly also control and power wires
Words transmitted one bit at a time
Higher data throughput with long distances
Less average capacitance, so more bits per unit of
time
Cheaper, less bulky
More complex interfacing logic and communication
protocol
Sender needs to decompose word into bits
Receiver needs to recompose bits into word
Control signals often sent on same wire as data
increasing protocol complexity
Synchronous Bus
Includes a clock in the control lines
A fixed protocol for communication that is
relative to the clock
Advantage: involves very little logic and can
run very fast
Disadvantages:
Every device on the bus must run at the same
clock rate
To avoid clock skew, they cannot be long if they
are fast
Asynchronous Bus
Asynchronous Bus:
It is not clocked
It can accommodate a wide range of
devices
It can be lengthened without worrying
about clock skew
It requires a handshaking protocol
Bus Arbitration
One of the most important issues in bus design:
How is the bus reserved by a device that wishes to use it?
Master-slave arrangement:
Only the bus master can control access to the bus:
It initiates and controls all bus requests
Servant
req
Master
Servant
req
ack
data
data
req
data
req
3
2
taccess
ack
3
2
data
Strobe protocol
Handshake protocol
A strobe/handshake combination
Master
req
Servant
wait
data
req
req
wait
data
wait
2
taccess
4
2
data
5
taccess
Fast-response case
Slow-response case
Microprocessor
Memory
I/O Device
ISA bus
memory-read bus cycle
CYCLE
C1
C2
WAIT
C3
C4
CLOCK
DATA
D[7-0]
ADDRESS
A[19-0]
ALE
/MEMR
CHRDY
C1
C2
WAIT
C4
DATA
D[7-0]
A[19-0]
ADDRESS
ALE
/MEMW
CHRDY
C3
The Daisy
Chain
Advantage: simple
Device1
Highest
Priority
Grant
Bus
Arbiter
DeviceN
Lowest
Priority
Device2
Grant
Grant
Release
Request
wired-OR
Disadvantages:
Cannot assure fairness:
A low-priority device may be locked out
indefinitely
The use of the daisy chain grant signal also
limits the bus speed
Centralized Parallel
Arbitration
Device1
Grant
Device2
DeviceN
Req
Bus
Arbiter
5
Priority
arbiter
Int
Peripheral1
Ireq1
Iack1
Peripheral2
Ireq2
Iack2
Increasing Transaction
Rate on Multi-master
Bus
Overlapped arbitration
perform arbitration for next transaction
during current transaction
Bus parking
master holds onto bus and performs
multiple transactions as long as no other
master makes request
Peripheral to memory
transfer with DMA
1(a): P is executing its main
program. It has already configured 3: DMA ctrl
asserts Dreq to
the DMA ctrl registers.
request control of
system bus.
4: After executing an
instruction, P sees Dreq
5: (a) DMA ctrl
asserted, releases the system
asserts ack (b)
bus, asserts Dack, and
reads data from
resumes execution. P stalls
0x8000 and (b)
only if it needs the system bus
writes that data to
to continue executing.
0x0001.
7(a): P de-asserts Dack and
resumes control of the bus.
7(b):
P1 de-asserts req.
Memory
ISA-Bus
R A
R
DMA
I/O Device
C1
C7
C2
C3
C4
C5
C6
CYCLE
CLOCK
DATA
D[7-0]
A[19-0]
ADDRESS
C1
C7
C2
C3
C4
DATA
D[7-0]
A[19-0]
ALE
ALE
/IOR
/MEMR
/MEMW
/IOW
CHRDY
CHRDY
C5
ADDRESS
C6
Multilevel bus
architectures
One bus for all
communication
Peripherals would
need high-speed,
processor-specific bus
interface
excess gates, power
consumption, and
cost; less portable
Microprocessor
Cache
Memory
controller
DMA
controller
Processor-local bus
Peripheral
Peripheral
Peripheral bus
Peripheral
Bridge
Multi-level Buses
Processor-local bus
High speed, wide, most frequent communication
Connects microprocessor, cache, memory
controllers, etc.
Peripheral bus
Lower speed, narrower, less frequent communication
Typically industry standard bus (ISA, PCI) for
portability
Bridge
Single-purpose processor converts communication
between busses
PCI Read/Write
Transactions
All signals sampled on rising edge
Centralized Parallel Arbitration
overlapped with previous transaction
PCI Read/Write
Transactions
Data transfers happen on when
IRDY# asserted by master when ready to
transfer data
TRDY# asserted by target when ready to
transfer data
transfer when both asserted on rising edge
PC/104
Small Size: 3.6 x 3.8
P1 Bus has 64 pins like PC-XT
P2 Bus has 40 pins
(note: 64+40=104 as in PC/104)
SBC
SBCs follow the technology developed by the
PC Industry
Basic Architecture
ISA/PCI Bus protocol
Serial & Parallel Port
The latest SBCs provide all the flexibility and
power of a PC with very small space
requirements
PC/104 and PC/104 plus meet the need of
SBCs
Summary
We have studied about Bus
connecting CPU to memory and I/O
devices
There may be more than one bus
master
We need arbitration
BUS STRUCTURE-2
SOC BUS
SERIAL BUS
Recap: SBC
SBCs follow the technology developed by the PC
Industry
Basic Architecture
ISA/PCI Bus protocol
Serial & Parallel Port
Bridge
A bridge is a slave on the fast bus
and master of the slow bus
Takes command from the fast bus
on which it is slave
Issues commands on the slow bus
Returns results from slow bus to
fast bus
Also functions as protocol translator
The System-on-a-Chip
System Bus
DMA
CPU
DSP
Mem
Ctrl.
Bridge
MPEG
Custom
Interfaces
Control Wires
Peripheral
Bus
System-on-a-chip
(SoCs) requires
busing systems to
connect various
components,
including one or
more
microprocessors,
memory,
peripherals, and
special logic
External
ROM
External
RAM
TIC
External
Bus
Interface
AMBA
Reset
ARM
Timer
Bus Interface
Remap/
Pause
Bridge
Arbiter
Decoder
On-chip
RAM
Interrupt
Controller
AHB or ASB
APB
System Bus
Peripheral Bus
AMBA
AMBA is a multi-level Bus
ASB/AHB: Advanced System Bus: To
connect High Performance modules
APB: Advanced Peripheral Bus: Simpler
interface for low performance peripherals
Support 32-, 64-, and 128-bit data-bus
implementations with a 32-bit address bus
as well as smaller byte and half-word designs.
AHB
The AHB puts the address on the
bus, followed by the data.
It supports wait-state insertion and
has a data-valid signal (HREADY).
It has separate read (HRDATA) and
write (HWDATA) buses.
AHB operation
AHB supports bursts, with 4-, 8-,
and 16-beat bursts, as well as
undefined-length bursts and single
transfers.
Bursts can be address wrapped, i.e.,
staying within a fixed address range.
Slaves can insert wait states to adjust
its response (up to 16).
Bus operation
All bus operations are initiated by bus
masters, which also can serve as a slave.
The master-generated address is
decoded by a central address decoder
that provides a select signal to the
addressed bus slave unit.
The bus master can "lock" the bus,
reserving it with the central arbiter for a
series of locked transfers.
Arbitration
Master x requests for the AHB by
issuing req[x]
When bus is available the arbiter
issues a hgrant[x] to master x
Upon receiving grant signal master
issues address and control
information to indicate the type of
transfer
master
1
master
2
master
3
slave
1
slave
2
slave
3
read
data
decoder
Bus transaction
The slave unit has the option to terminate a
transaction
as an error,
signal the master to retry, or
split the transaction for later completion.
Split Transaction
The slave signals a split transaction and
saves the master number (HMASTER[]).
When ready to complete the transaction, the
slave signals the arbiter with the master
number.
When the arbiter grants bus access to the
master, it restarts the transaction.
No master can have more then 1 pending split
transaction.
AHB Signals
HTRANS[1:0]
Transfer signals indicate the type of the next
transaction, which may be address-only, nonsequential or sequential. These signals are
driven by a bus master when the appropriate
GRANTx signal asserted.
Timing Diagram
APB
Designed to support low-speed peripherals
such as UARTs, keypads, and PIO
All bus devices are slaves to the master, the
bridge to the AHB, or ASB system bus.
Provides a simple address, with latched
address and control signals for easy
interfacing.
APB can be implemented with a single tristated data bus.
APB Bridge
APB Transaction
As a simple bus, the APB doesn't support bursting.
Each transaction consists of 2 cycles: an address
cycle (Setup state) and a data cycle (Enable state).
The bus uses a single clock, PCLK.
In Setup, the bus brings PSEL and PWRITE up, putting
the address on the PADDR address bus.
In the Enable state, it brings PENABLE up and places
data on the PWDATA/PRDATA bus.
The enable signal, PENABLE, is de-asserted on the next
clock.
System Architecture
IP Core
Master
IP Core
Slave
Slave
Request
Slave
Master
On-Chip Bus
Target
Response
Master
Protocol Phases
Request Phase (begins Transfer)
Master presents request (command,
address, etc.) to Slave
Protocol Phases
Datahandshake Phase (Optional)
Allows pipelining request ahead of
write data
Only available for write transfers
Phase ordering
Request -> Datahandshake ->
Response
Use of Protocol
A designer selects only those
signals and features from the
palette of OCP configurations
needed to fulfill all of an IP cores
unique data, control and test
signaling requirements
Serial Buses
Serial Protocol
Used for moving data quickly from
one device to another
Serial protocols like I2C & SPI are
meant for short distances inside
the box
Low complexity
Low cost
I2C
Meant for inter-Integrated Circuit
Communication
Developed by Philips Semiconductor for TV
sets in the 1980s
I2C devices include EEPROMs, thermal
sensors, and real-time clocks
Used as a control interface to signal
processing devices that have separate data
interfaces, e.g. RF tuners, video decoders
and encoders, and audio processors.
I2C: Features
Bi-directional
Data can flow in both directions
Synchronous
Data is clocked along with a clock signal
Clock signal controls when data is changed and when it
should be read
Clock rate can vary unlike asynchronous (RS-232 style)
communication
I2C bus has three speeds:
Slow (under 100 Kbps)
Fast (400 Kbps)
High-speed (3.4 Mbps) I2C v.2.0
I2C: Connections
Two wired bus
Serial data line(SDA)
Serial Clock line (SCL)
Voltage Levels
High - 1
Low - 0
Bit transfer
SCL=1 implies SDA = valid data
Stable data during high clock
Data change during low clocks
Basic Protocol
I2C is a master slave protocol
Master device controls the clock (SCL)
Slave devices may hold the clock low
to prevent data transfer
No data is transferred unless a clock
signal is present
All slaves are controlled by the master
clock
Summary
We have studied bus specifications
used in a SOC
Looked at a serial bus for
connecting devices to a microcontroller
We shall learn more about serial
buses in the next class
Bus Structure-3
Serial Interfaces
I2C: Basics
Two wired bus
Serial data line(SDA)
Serial Clock line (SCL)
Voltage Levels
High - 1
Low - 0
Bit transfer
SCL=1 implies SDA = valid data
Stable data during high clock
Data change during low clocks
I2C Signals
I2C lines can have two possible
states
Float high
Drive low
Wired-and Connection
Bus is free implying SDA and SCL are high
By pull-up resistors
Frame
Start Condition(S)
SDA 1->0 transition when SCL=1
Stop Condition(P)
SDA 0->1 transition when SCL=1
Bus state
Busy - after S and before next P
Free after P and before next S
Data transfer
Data bits are transferred after start condition
Transmission is byte oriented
8 bits + 1 acknowledge bit
Addressing Scheme
First byte transmitted by master
7 bits: address
1 bit: direction(R/W)
0 master writes data
1 master receives data
After ack
Master tries to generate next bytes first
pulse
Slave can hold SCL low forcing master to
switch to wait state
Frame Format
Bus Arbitration
I2C designed as a multi-master bus
Any one of several different devices may act as
the master at various times
No global master to generate clock
A master drives both SCL and SDL
I2C in PIC
In PIC micro-controller MSSP
module provides the support for
I2C
MSSP
SSPBUF: a
register that stores
data sent or
received on I2C
bus
I2C in PIC
I2C Engine
implements I2C
protocol in hardware
Controls actions of
the device based
I2C instructions
I2C Tradeoffs
Advantages:
Good for communication with on-board
devices that are accessed occasionally.
Easy to link multiple devices because of
addressing scheme
Cost and complexity do not scale up with the
number of devices
Disadvantages:
The complexity of supporting software
components can be higher than that of
competing schemes ( for example, SPI ).
SPI
Shorthand for Serial Peripheral Interface
Defined by Motorola on the MC68HCxx line of
microcontrollers
Generally faster than I2C, capable of several Mbps
Applications:
Like I2C, used in EEPROM, Flash, and real time
clocks
Better suited for data streams, i.e. ADC
converters
Full duplex capability, i.e. communication
between a codec and digital signal processor
Master
MOSI
MISO
/SS
Slave
Bus Signals
Synchronous serial data link operating at full
duplex
Master/slave relationship
2 data signals:
MOSI master data output, slave data input
Also called SDO : serial data output
2 control signals:
SCLK clock
/SS slave select
(no addressing)
SPI Protocol
CPHA
Active
edge
Rising
Falling
Rising
SPI in PIC
The SSP and MSSP module in PIC can
implement SPI protocol
I2C by MSSP only
Serial buffer:
Data is put
after SPI
transfer or
before
SPI transfer
Communicating with
Embedded System
USB
USB is a serial protocol and physical link
transmits all data differentially on a single
pair of wires.
Another pair provides power to downstream
peripherals
PC centric protocol
Every USB device is an embedded
system.
USB signaling
Speeds:
High-speed is 480 Mb/s.
Full-speed is 12 Mb/s.
Low-speed is 1.5 Mb/s.
Signals:
Vbus, Gnd.
D+, D-.
USB power
USB devices can pull a limited
amount of power from the bus.
May also supply their own power.
USB architecture
USB Peripherals are slaves responding
to commands from the host.
When a peripheral is attached to the
USB network, the host communicates
with the device
To learn its identity and
To discover which device driver is required
(a process called enumeration ).
USB devices
The specification recognizes two
kinds of peripherals:
Stand-alone (single function units, like a
mouse)
Compound devices (those that have
more than one peripheral sharing a USB
port).
An example of a compound device is a video
camera with separate audio processor.
Summary
We have studied serial interfaces
for connecting peripherals
We have also looked at serial bus
protocol for connecting embedded
systems to hosts
Serial Intefaces
USB, IEEE 1394, IrDA
Bus Protocol
data transfer
token
Type of transaction
Direction of trans.
handshake
USBdevice address
Hub
port
port
port
Enable port
allocate USB
Remove
address
indicator
upstream port
indicatordisable
device
USB Organization
USB Hubs
Hubs are bridges
Increase the logical and physical fan-out of the
network.
A hub has a single upstream connection
Many downstream connections.
USB Communication
Communications between the host
and endpoints located in the
peripherals.
An endpoint is a uniquely addressable
portion of the peripheral that is the
source or receiver of data.
Four bits define the device's endpoint
address;
Codes also indicate transfer direction and
the transaction
PIPE
Pipe: all transfers occur through virtual pipes
that connect the peripheral's endpoints with
the host.
When establishing communications with the
peripheral, each endpoint returns a
descriptor
Descriptor is a data structure that tells the host
about the endpoint's configuration and
expectations.
Include transfer type, max size of data packets, perhaps
the interval for data transfers, and in some cases, the
bandwidth needed.
Interrupt transfer
Interrupt transfers, though not
interrupts in the CPU-diverting sense,
poll devices to see if they need
service.
Peripherals exchanging small amounts
of data that need immediate attention
(such as mice and keyboards) use
interrupt transfers.
Error checking validates the data.
Isochronous transfer
Isochronous data transfer ensures that data
flows at a pre-set rate so that an application
can handle it in a timed way.
Isochronous transfers handle streaming data
like that from an audio or video device.
It is time sensitive information so, within
limitations, it has guaranteed access to the
USB bus.
No error checking occurs so the system must
tolerate occasional scrambled bytes.
IEEE 1394
Firewire:features
Packet-based layered design structure
Applications using FireWire include:
disk drives, printers, scanners, cameras
Connecting Devices
In work area #1 a video
camera, PC, and video
recorder, all interconnected
PC is also connected to a
physically distant printer
via a 1394 repeater
Repeater extends the interdevice distance by redriving
the 1394 signals.
Source: http://www.pctechguide.com/26interfaces_IEEE_1394.htm
Connecting Devices
The 1394 bus bridge isolates
data traffic within each work
area.
Bus bridges allow selected
data to be passed from one
bus segment to another.
PC #2 can request image data
from the video recorder in work
area #1.
Since the 1394 cable is powered,
the signalling interface is always
powered
Video data is transported even if
PC #1 is powered off.
Source: http://www.pctechguide.com/26interfaces_IEEE_1394.htm
Protocol Stack
Soure: Xilinx
Physical Layer
Physical layer provides the initialization and
arbitration services
It assures that only one node at a time is sending
data
Includes
Electrical signaling
Mechanical connectors and cabling
Arbitration mechanism
Serial coding and decoding of data being
transferred or received
Transfer speed detection
Link Layer
Extracts and put data packets on and off
the wire
Does error detection and correction
Does retransmission
Handles provision for cycle control for
isochronous channel
Link layer supplies an acknowledged
datagram to the transaction layer
A datagram is a one-way data transfer with
request confirmation
Transaction Layer
Implements Request-response
protocol
Minimizes amount of circuitry
required to interconnect with
standard buses such as the PCI bus
Host Controller
Soure: Xilinx
Wireless Protocol
IRDA
Wireless communication
Infrared (IR)
Electronic wave frequencies just below
visible light spectrum
Diode emits infrared light to generate
signal
Infrared transistor detects signal,
conducts when exposed to infrared light
Cheap to build
Need line of sight, limited range
IrDA
IrDA is a standard defined by the IrDA
consortium (Infrared Data Association).
Specifies a way to wirelessly transfer data via
infrared radiation.
Specifications include standards for both the
physical devices and the protocols they use to
communicate with each other.
Can connect various mobile/embedded systems
Primary use has been to link notebooks or various
personal communicators
Features
Most IrDA work over distances up to 1.0m
with BER 10-9 and maximum level of
surrounding illumination 10klux (daylight).
Bit Error Ratio - number of incorrectly
transferred bits over number of correctly
transferred bits
Pulse width
Transmitter can use either 3/16 mark-to-space ratio
for one bit, or a fixed length 1.63 us of each optical
pulse, which would correspond to 115kbps (ver1.0).
IR Frame
Packet Structure
A packet consists of two start words
followed by target address
IrDA devices are assigned numbers by the
means of IrDA protocol, so they are able to
unambiguously identify themselves
Protocols
IrDA Infrared Link Access Protocol
(IrLAP)
Encapsulates the frames
Provides arbitration
Only one primary device, others are
secondary
The communication is always half-duplex
IrDA Protocols
IrDA Infrared Link Management Protocol
(IrLMP)
Every device lets the others know about itself
via the IrLMP protocol, which runs above IrLAP
IrLMP's goal is to detect presence of devices
offering a service, to check data flow, and to act
as a multiplexer for configurations with more
devices with different capabilities involved
Applications use the IrLMP layer to ask if a
required device is within range, etc.
Protocols
IrDA Transport Protocols (Tiny TP)
This layer manages virtual channels between
devices, performs error corrections (lost
packets, etc.), divides data into packets, and
reassembles original data from packets.
Application Protocols
Extensions to IrOBEX for Ir Mobile
Communications
Extension for mobile devices - handhelds, PDA,
cellular phones - defines how to transfer
informations pertaining to GSM network
address books, SMS, calendar, dialing control, digital
voice transfer over IR, etc.
Application of IrDA
Wireless Communication
Radio frequency (RF)
Electromagnetic wave frequencies in
radio spectrum
Analog circuitry and antenna needed
on both sides of transmission
Line of sight not needed, transmitter
power determines range
Generic Issues
Example: PCI-express
Summary
We have studied about bus
structures used for connecting CPU
and peripherals
We have also looked at the
interface specifications for
connecting two or more systems