Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Embedded Systems
4 - Hardware Architecture
CPU Input/Output mechanisms Memory Buses and Aux I/O Input/Output interfaces
RMR2012
Power Management
UART
RMR2012
Asynchronous Transmission
Mquina A
Mquina B
Tx A
Rx A
Rx B
Tx B
Bit Time
65H
RMR2012
RMR2012
RMR2012
SPI
RMR2012
RMR2012
What is SPI?
Serial bus protocol Fast, easy to use, and simple Very widely used Not standardized
RMR2012
SPI Basics
Synchronized
Maths is not everything
RMR2012
SPI Capabilities
Always full-duplex
Communicates in both directions simultaneously Transmitted (or received) data may not be meaningful
RMR2012
Bus wires
Master-Out, Slave-In (MOSI) Master-In, Slave-Out (MISO) System Clock (SCLK) Slave Select/Chip Select (SS1#, , SS#n or CS1, , CSn)
Master generates clock signal Shift registers shift data in and out
RMR2012
MOSI carries data out of master to slave MISO carries data out of slave to master
Both MOSI and MISO are active during every transmission
SS# (or CS) unique line to select each slave chip SCLK produced by master to synchronize transfers
RMR2012
Master shifts out data to Slave, and shifts in data from Slave
RMR2012
RMR2012
Master and selected slave must be in the same mode During transfers with slaves A and B, Master must
Congure clock to Slave As clock mode Select Slave A Do transfer Deselect Slave A Congure clock to Slave Bs clock mode
Maths is not everything
RMR2012
RMR2012
RMR2012
Pros
Fast for point-to-point connections Easily allows streaming/constant data inow No addressing in protocol, so its simple to implement Broadly supported
Cons
Slave select/chip select makes multiple slaves more complex No acknowledgement (cant tell if clocking in garbage) No inherent arbitration
Maths is not everything
RMR2012
18
I2C
RMR2012
I2C bus
Inter-Integrated Circuit Two wire serial bus specification Designed for low-cost, medium data rate applications. Several microcontrollers come with built-in I2C controllers. Invented by Philips in the early 1980s
Maths is not everything
The division is now NXP Was a patented protocol, but patent has now expired
RMR2012
20
RMR2012
I2C details
Two-wire serial protocol with addressing capability Speeds up to 3.4 Mbps What limits I2C to such small speeds? Multi-master architecture Open collector bus driver Pull-up resistors
Maths is not everything
RMR2012
22
master 1
SDA SCL
slave 1
SDL
master 2
slave 2
+
Maths is not everything
SCL
RMR2012
23
I2C signaling
Sender pulls down bus for 0. Sender listens to bus---if it tried to send a 1 and heard a 0, someone else is simultaneously transmitting. Transmissions occur in 8-bit bytes.
Maths is not everything
RMR2012
I2C clock
Not a traditional clock Normally is kept high using a pull-up Pulsed by the master during data transmission
Master could be either the transmitter or receiver
RMR2012
25
I2C transaction
RMR2012
26
I2C bus transactions: start and stop conditions Master pulls SDA low while SCL is high Normal SDA changes only happen when SCL is low
RMR2012
34
Data is always sampled on the rising clock edge Address is 7 bits An 8-th bit indicated read or write
High for read Low for write
RMR2012
28
RMR2012
29
Sender listens while sending address. When sender hears a conflict, if its address is higher, it stops signaling. Low-priority senders relinquish control early enough in clock cycle to allow bit to be transmitted reliably.
RMR2012
I2C transmissions
adrs
data
adrs
data
RMR2012
RMR2012