Interfacing Embedded Systems
Interfacing Embedded Systems
Interfacing basics.
Microprocessor interfacing
I/O addressing.
Interrupts.
Direct Memory Access (DMA).
addr[0-11]
bidirectional (data) data[0-7]
• Bus
entire wires collection along with their communication protocol.
• Protocol: rules for communicating over the wires. (low level HW protocols)
Real-time Embedded Systems/Interfacing 4
Basic Terminology
Port: the actual conducting device (metal) on the processor (or
memory) through which the signal is input to, or output from.
We could use the term pin to refer to a port on a processor.
Pin is also a term referring to the extending pins from the processor (
as own IC package). They are designed to be plugged into a socket on a
printed-circuit board.
Small metallic balls could be used rather than pins( if the processor
is packaged in its own IC ).
If the processor coexists on a single IC with other processors and
memories, pads of metal are used in the IC.
data
data
tsetup tread
read protocol
tsetup twrite
write protocol
It is the most common method for describing a HW protocol.
Time proceeds to the right along the x-axis.
Control lines high or low.
Data lines (addr, data) invalid (one horizontal line) or valid (two horizontal lines).
The processor must place the address on addr for at least tsetup time before setting
the enable high.
The high enable line triggers the memory to put data on the data wires after tread
time.
When line is active (high, or commonly low) , it triggers the data transfer.
Assert means setting control line to its active value.
Deassert means setting control line to its low value.
A protocol could be consisted of subprotocols (i.e. read, write), known as
transaction or a bus cycle. A bus cycle may consists of several clock cycles.
Real-time Embedded Systems/Interfacing 6
Basic protocol concepts
Actor: is the processor or memory involved in data transfer.
A protocol involves two actors: a master, and a servant (slave).
A master initiates the data transfer (usually general-purpose
processor), and the servant responds to the initiation request
(usually memories and peripherals).
Data direction: the direction that the transferred data moves btw.
actors( receiving or sending data).
Addresses: a special type of data used to indicate where regular
data should go to or come from (used to address memory locations ,
peripherals and peripheral's registers).
req req
data 15:8 7:0 addr/data addr data
data
data
req 1 3
req 1 3
ack 2 4
data 2 4
data
taccess
1. Master asserts req to receive data 1. Master asserts req to receive data
2. Servant puts data on bus within time taccess 2. Servant puts data on bus and asserts ack
3. Master receives data and deasserts req 3. Master receives data and deasserts req
4. Servant ready for next request 4. Servant ready for next request
wait
data
req 1 3 req 1 4
wait wait 2 3
data 2 4 data 5
taccess taccess
1. Master asserts req to receive data 1. Master asserts req to receive data
2. Servant puts data on bus within time taccess 2. Servant can't put data within taccess, asserts wait ack
(wait line is unused) 3. Servant puts data on bus and deasserts wait
3. Master receives data and deasserts req 4. Master receives data and deasserts req
4. Servant ready for next request 5. Servant ready for next request
It achieves both the speed of strobe protocol, and the varying response time
tolerance of a handshake protocol.
The handshake only occurs if it necessary.
Real-time Embedded Systems/Interfacing 10
The ISA bus protocol – Memory Access
ISA: The Industry Standard Microprocessor Memory I/O Device
ISA bus
Architecture.
• 80x86 microprocessor.
CYCLE
CLOCK
C1
C4
C2 WAIT C3
A[19-0]
DATA
•
ADDRESS
•
/MEMR
• Compromise strobe/handshake
CYCLE C1 C2 WAIT C3
control method is used. CLOCK C4
A[19-0]
DATA
ADDRESS
CHRDY before the rising clock ALE
/MEMW
In standard I/O (I/O-mapped I/O), the bus includes an additional pin (M`/IO), to
include whether the access is to memory or peripheral.
e.g., Bus has 16-bit address, all of them for memory addressing if M`/IO=0, and
all of them for I/O addressing if M`/IO=1.
Memory-mapped I/O
Requires no special instructions
Assembly instructions involving memory like MOV and ADD
work with peripherals as well.
Standard I/O requires special instructions (e.g., IN, OUT) to
move data between peripheral registers and memory.
Standard I/O
No loss of memory addresses to peripherals.
Simpler address decoding logic in peripherals possible.
When number of peripherals much smaller than address
space then high-order address bits can be ignored
smaller and/or faster comparators.
D[7-0] DATA
A[15-0] ADDRESS
ALE
/IOR
CHRDY
/ADV Data is
ready
addr <15…0> GO=0
GO=1 here!
/WE
/OE
ADSP=1, ADSP=1,
/CS1 and /CS2 ADSC=0 ADSC=1
S2 S3
ADV=1, OE=1, ADV=0, OE=0,
CS3 Addr = ‘Z’ GO=1 Addr = ‘Z’
data<31…0>
GO=1
GO=0
Generates control signals to drive the TC55V2325FF memory chip in burst mode.
Addr0 is the starting address input to device.
GO is enable/disable input to device.
ISR
needed!
Peripheral1 Peripheral2
Inta
Ack_in Ack_out Ack_in Ack_out
Int Req_out Req_in Req_out Req_in 0
Processor-local bus
Peripheral Peripheral Peripheral Bridge
Peripheral bus
Real-time Embedded Systems/Interfacing 31
Advanced Communication
Principles
Physical layer: the medium that is used to carry
data from one device to another.
Single wire, a set of wires, radio waves, or infrared
waves.
Parallel communication
Serial Communication
Wireless Communication