Documente Academic
Documente Profesional
Documente Cultură
Chapter Objectives
I/O Addressing Compromises / Extensions Types of Bus-based I/O
Arbitration
SECTION 1:
MICROPROCESSOR INTERFACING
Embedded System
Embedded system has three functionality aspects: Processing
Transformation of data Implemented using processors
Storage
Retention of data Implemented using memory
Communication
Transfer of data between processors and memories Implemented using buses Called interfacing
Embedded System
CPU MEM
I/O
Simple Bus
Wires are conducting channels interconnecting system devices and components
may be uni-directional or bi-directional
Bus is a set of wires with a single function e.g. address bus, data bus
Though may also be an entire collection of wires with various functionalities
Bus Structure
rd'/wr enable
Processor
addr[0-11]
Memory
data[0-7]
bus
bus structure
Ports
A port is a conducting device on periphery of a design entity
e.g. a port connects a bus to processor or memory
Ports are often referred to as pins Actual pins are located on the periphery of an IC package and plugs into a socket on a pc board. Sometimes metallic balls are used instead of pins A pad may be a single wire or set of wires with single function within a chip
e.g., 12-wire address port
Ports
rd'/wr Processor Memory
port
enable
addr[0-11]
data[0-7]
bus
Timing Diagrams
Most common method for describing a communication protocol is by the use of timing diagrams On a timing diagram, time proceeds to the right on x-axis A control signal may be low or high at some intervals
1
assert is used to indicate that the signal is made active and deassert means deactivated Asserting go means set go=0
Invalid
valid
Timing Diagrams
A bus protocol may have sub-protocols A sub-protocol is also called a bus cycle
e.g., read and write
Read Protocol
rd'/wr
0
enable
addr
data
tsetup tread
read protocol
Write Protocol
rd'/wr enable addr data tsetup twrite
write protocol
Direction: sender, receiver Addresses: special kind of data that specifies a location Time (division) multiplexing: Sharing a single set of wires for multiple pieces of data
save amount of wires at expense of time
Time-Multiplexing
Time-multiplexed data transfer
Send 16 bit data over 8 bit databus Master data(15:0) mux data(8) req Servant data(15:0 ) demux Master addr dat a mux addr/data req Servant addr dat a demux Send both data and address through a single bus
data serializing
address/data muxing
Control Methods
Master req Servant
Master
req ack
Servant
data
req data 1 2 taccess
Master wants to receive data 1. Master asserts req (uest) to receive data 2. Servant puts data on bus within time taccess 3. Master receives data and deasserts req 4. Servant ready for next request Strobe protocol (faster if response time of servant is known)
data
3 4 req ack data
Master wants to receive data 1. Master asserts req to receive data 2. Servant puts data on bus and asserts ack to indicate data is ready and valid 3. Master receives data and deasserts req 4. Servant ready for next request Handshake protocol (better if there are multiple servants with different response times ack line required)
1 2
3 4
A Strobe/Handshake Compromise
Master req wait data Servant
req
wait data
1
2
3
4
req 1
wait data 2 3
4
5
taccess 1. Master asserts req to receive data 2. Servant puts data on bus within time taccess (wait line is unused) 3. Master receives data and deasserts req 4. Servant ready for next request Fast-response case
taccess 1. Master asserts req to receive data 2. Servant can't put data within taccess, asserts wait 3. Servant puts data on bus and deasserts wait 4. Master receives data and deasserts req 5. Servant ready for next request Slow-response case
I/O Addressing
A microprocessor communicates with other devices using some of its pins (non-control pins)
For an I/O device, communication may be port-based or bus-based
Port-based I/O (parallel I/O) the processor has one or more Nbit ports, connected to dedicated registers
e.g., P0 = 0xFF; v = P1; where P0 and P1 are 8-bit ports
For bus-based I/O the processor has address, data and control ports that form a single bus Communication protocol is built into the processor
a single instruction carries out Read (or Write) sub-protocol on the bus
Compromises/Extensions
Parallel I/O peripheral:
When processor only supports busbased I/O but parallel I/O needed
Compromises/Extensions
Processor Memory System bus Address, system and control lines Parallel I/O peripheral Processor Port 0 Port 1 Port 2 Port 3 Parallel I/O peripheral
Port A
Port B
Port C
Port A
Port B
Port C
Standard I/O
entire address space is available for memory access entire address space is available for I/O access required accessmemory or I/O? Need to indicate.
Microprocessor Interfacing
Polling
Processor polls peripherals regularly Wasteful if too frequent Ineffective if not frequent enough
Interrupt-driven
Peripheral interrupts processor when servicing is required Upon interrupt assertion
Processor suspends current task Jumps to and run the appropriate ISR in response Interrupt detection mechanism implemented in hardware
Interrupts
Fixed interrupt
An address is built into processor Either ISR starts from the address or a jump-to-ISR instruction is stored there To service multiple peripherals several interrupt pins needed
Vectored interrupt
Peripherals provide addresses of their associated ISRs Commonly used when multiple peripherals are connected by system bus Only one interrupt pin necessary
Compromise: interrupt address table of known location, peripherals provide indices into table
System bus
0x8000
0x8001
Data memory
Inta Int PC
P1 16 0x8000
P2
0x8001
P1
16 16 0x8000
P2
0x8001
5(a): PC jumps to the address on the bus (16). The ISR there reads data from 0x8000, modifies the data, and writes the resulting data to 0x8001. 5(b): After being read, P1 deasserts Int.
Program memory ISR 16: MOV R0, 0x8000 17: # modifies R0 18: MOV 0x8001, R0 19: RETI # ISR return ... Main program ... 100: instruction 101: instruction 100 System bus P Data memory
Inta Int PC
0
P1
16 0x8000
P2
0x8001
Int PC
+1
P1 0x8000
P2 0x8001
ISR location can be moved without changing peripheral Only one interrupt pin required
A non-maskable interrupt
A separate interrupt pin that cannot be masked Reserved for drastic situations
DMA (2)
Peripheral makes a request to DMA to write data to the memory DMA requests system bus control from the P P relinquishes control of bus to DMA controller
no jumping into an ISR with its attendant overhead
6:. DMA de-asserts Dreq and ack completing handshake with P1.
No ISR needed!
System bus
Dack Dreq
P1
req
0x8000
100
Dack Dreq 1
P1
0x8000
0x8000
P
0x0000
System bus
1
Dack Dreq
DMA ctrl
P1
0x0001
0x8000
Dack Dreq
P1
0x8000
Dack Dreq 0
DMA ctrl
0x0001
0x8000
ack req
P1
PC
100
0x8000
Priority Arbiter
Multiple peripherals request service from single resource (e.g., microprocessor, DMA controller) simultaneously Which one gets serviced first? A priority arbiter provides a solution
A single-purpose processor is the arbiter makes requests to the resource on behalf of the requesting peripheral with the highest priority
The arbiter is connected to system bus for the purpose of configuration only
Types of Priority
There are two types of priority Fixed priority
each peripheral has unique rank highest rank is chosen first in the event of simultaneous multiple requests preferred when a clear difference in rank between peripherals exists
CAS[2..0] SP/EN
Daisy-chain Arbitration
Arbitration by peripherals themselves Arbitration functionality built into the peripheral or provided by added external logic req input and ack output on peripherals Peripherals connected together in a daisy-chain manner
Priority Arbiter
P System bus
Network-oriented Arbitration
When multiple microprocessors share a bus (sometimes called a network) Arbitration typically built into bus protocol
Separate processors may try to write simultaneously causing collisions
Peripheral bus
Serial communication
Physical layer transports one bit of data at a time
Wireless communication
No physical connection needed for transport at physical layer
Parallel Communication
Multiple data, control, and possibly power wires are involved A word is sent one bit per wire High data throughput
Serial Communication
Serial: bits sent in sequence one at a time higher data throughput over long distances due to low average capacitance Cheaper and less bulky
Wireless Communication
Infrared (IR)
Electromagnetic wave just below visible light spectrum Diode emits infrared light to generate signal Infrared transistor detects signal Cheap to build Line-of-sight, limited range
Electromagnetic wave in radio spectrum Analog circuitry and antenna on both sides of T-mission Line of sight is not needed Range is determined by transmitter power
Radio frequency
Error correction
ability of receiver and transmitter to cooperate to correct errors
Typically done by acknowledgement/retransmission protocol