SES Flashcards
What is a bus?
A communication highway shared by multiple devices
What are some challenges of using busses?
Maintaining synchronisation between devices
Differentiating between valid bits and an idle signal (when no data is being sent)
Knowing if a device is the intended recipient
Detecting message collisions
Prioritising senders
What is the solution to mismatched signals in busses?
The master controls the clock and sends it to the slave
What are the common communication protocols for microcontrollers?
RS232
I2C
SPI
What are the features of RS232?
Asynchronous
One wire is used for transmitting and another for receiving
Describe how an asynchronous serial bus functions
The sender doesn’t provide a clock to the receiver
Universal asynchronous receiver transmitter (UART) manages the transfer
Both ends must apply the same protocol
What are parts of a protocol?
Number of bits in the message msb or lsb first synchronisation of bits parity bits baud rate
How many wires are there in the I2C protocol?
2
serial data line (SDA) & serial clock line (SCL)
Briefly describe the I2C protocol
All communication is initiated by the master
In order to transmit to the slave the master must send the slave’s unique address
To receive data the master must send a read request alongside the slave’s address
For every 8 data bits an ‘ACK’ bit must be returned
Describe a multi-master I2C system
It must be decided which master has control of the bus
If a master tries to transmit a 1 but the wire has value another master must be sending
The master that lost the resolution stops sending
What does SPI stand for?
Serial Peripheral Interface
Describe the SPI protocol
Shift registers form a circular buffer
Data can be transferred in either direction using 2 pins
MISO - master in slave out
MOSI - master out slave in
Only the master can initiate a transfer
The SS (slave select) pin defines which slave should respond to a transaction so the master needs an SS pin for each peripheral
Alternatively slaves can be chained and all participate in transactions
What are the advantages of SPI?
High speed
No overhead
Full duplex
What are the disadvantages of SPI?
Master doesn’t know is slaves are online
Master doesn’t know if the data is received
At least 4 wires required
Multi-master is awkward
What are the advantages of I2C?
The master knows if data has been received
The master knows if slaves go offline
Only 2 wires required
Multi-master is easy to implement