8. Communications Flashcards

1
Q

Do microcontrollers need to communicate with other digital devices? Examples where it is the main purpose of the mc?

A

Yes many, or even most, do. In many cases this is the main purpose of the microcontroller: remote controls, keyboards. Many are used primarily as interfaces to larger digital systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is the scale of communication large or small? Examples?

A

Mostly the scale of communication is modest. Keyboards and other human devices: few bytes per sec. Sensors, few kbytes per sec.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does communication within a piece of equipment usually mean?

A

Communication with other devices of the same PCB.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are examples of communication within a piece of equipment?

A
  • user interface (eg keypads, selector switches) can easily run from pins on the ports of a small mC
  • Sensors with digital interfaces
  • additional memory, perhaps for data logger or processing
  • displays more complicated that the mC can drive directly (eg LCD displays which usually have their own mC built in)
  • other mCs in a big system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What interfaces are available to deal with these?

A

serial (eg USB), microwire, serial peripheral interface (SPI), inter-integrated circuit (I2C) bus, LINbus, one-wire bus…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can mCs have these interfaces built in?

A

Many do, which makes them very easy to use

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are examples of communication between pieces of equipment?

A

Huge range of possibilities:

  • components of a hi-fi or home cinema system may be linked with a control system - sometimes I2C
  • test equipment, often linked together with a specialised interface called IEEE-488
  • control of a large building (heating, cooling, ventilation, lighting, fire,..)- might be linked on a network, smart buildings
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what interfaces are used for communication between pieces of equipment?

A

Tended to use proprietary systems in the past but are increasingly based on the internet for larger systems, eg buildings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the specialized network for cars called?

A

CANBUS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the characteristics of CANBUS?

A
  • designed to be robust physically and electrically, with several levels of error checking
  • needs a dedicated interface, either a separate chip or built into a mC
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How might communication with a computer be done?

A
  • serial port (COM1 etc)
  • parallel (printer) port
  • keyboard and mouse ports
  • USB
  • firewire , similar to USB but more specialised
  • wireless eg bluetooth
  • can use the bus inside the PC
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is serial communication?

A

data is sent as a stream of bits, only one at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is parallel communication?

A

Many bits (usually 1, 2 or 4 bytes) are sent at the same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the most common type of communication and why?

A

Serial because it is simpler and needs fewer wires.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an exception to this trend?

A

The venerable parallel port on PCs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the result if more than 2 nodes are connected?

A

A network or bus and most modern interfaces are of this kind.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What has taken the place of serial ports (2 items only) ?

A

bus (USB), up to 127 nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is full duplex?

A

Can send data in both directions at the same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is half duplex?

A

Can send in both directions but not at the same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is synchronous communication?

A

A clock signal is sent along with the data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is asynchronous communication?

A

The receiver must generate its own clock to match that in the transmitter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What does the clock do?

A

Defines when signals contain valid data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is protocol?

A

Need to ensure that data arrives safely, messages don’t collide when 2 nodes try to transmit at the same time, and so on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the I2C bus?

A

The inter-integrated circuit bus is a very widely used, simple, synchronous interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is I2C often used to interface a microcontroller to?

A
  • sensors, real-time clock/calendars, ADCs, DACs, extra I/O ports
  • Memory (RAM or Flash)
  • interfaces to other systems such as displays, IEEE-488
  • other microcontrollers, sometimes other equipment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

How many wires does I2C need?

A

2

27
Q

What are the wires called?

A

SDA - serial data
SCL - serial clock
(of course it needs ground as well so there really are 3)

28
Q

Why do we need a protocol?

A

Any form of communication must follow certain rules if it is to work reliably

29
Q

Why is this particularly important for a bus such as I2C?

A

Because many devices may be involved

30
Q

What do we need to define for the protocol?

A
  • Who is in charge
  • When does a new transmission start?
  • Precisely when is the value on the data line valid and should be read by the receiver?
  • When has transmission finished?
  • Has the message been successfully received?
31
Q

What is a master node?

A

A node which gives all the orders to the other nodes and generates the clock. (Used in I2C, can be many masters but only one active at any time)

32
Q

How are the nodes connected together?

A

The nodes must all be connected to the SDA and SCL lines in such a way that no damage can arise if more than one node tries to drive the line. DRAW DIAGRAM. If no outputs are active, SDA is pulled up to Vdd (logic 1) by the resistor. When one output is active and its switch is closed, SDA is brought down to ground (logic 0). Further active outputs have no further effect, nor damage.

33
Q

How can the circuit be represented to include SDAs capacitance to ground?

A

DRAW DIAGRAM. After the switch has opened the capacitance C must charge through the pullup resistor R.

34
Q

Equation for time constant?

A

t = RC

35
Q

How long does it take for the capacitor to become 95% charged?

A

3* time constant

36
Q

What is the I2c protocol?

A
  • both SDA and SCL float high when idle (pullup resistor)
  • SDA may change only when SCL is low (logic 0)
  • SDA is valid when SCL is high
  • The redeiver sends a low ‘acknowledge’ bit to confirm receipt
  • to start a transmission, pull SDA high to low when SCL is high
  • to finish, SDA goes low to high when SCL is high
37
Q

How is data transferred in I2C?

A

In bytes (8 bits) each followed by an acknowledgment bit

38
Q

What does a transaction usually involve in I2C?

A

the master sending a command to a slave (such as a sensor), which then responds

39
Q

What do all messages start with in I2C?

A

The address of the target, which occupies at least one byte.

40
Q

Can you draw a message of a single byte for I2C?

A

DRAW DIAGRAM

41
Q

What does the clock do in I2C?

A

The clock makes it clear when SDA is valid and should be recorded.

42
Q

What is bit-banging?

A

I2C is simple enough that it can be implemented in software: a programmer specifies the actions in detail and any digital I/O pin is used.

43
Q

If bit-banging is unacceptable what do you do?

A

Many mCs have interfaces for I2C built in - look for a synchronous serial port. The main program moves data to a special register and gets on with other tasks; the port deals with the detail of I2C and tells the main program when it is finished.

44
Q

What is another way of transmitting data synchronously?

A

Often there is no separate clock but the data are coded in such a way that the clock can be recovered from the data by the receiver. USB works in this way.

45
Q

What are the characteristics of the traditional asynchronous serial port?

A
  • Asynchronous - no clock is sent along with the data.
  • Connects 2 nodes only - not a bus
  • data is sent in only one direction along a wire (but there are usually 2 wires to give full duplex communication)
  • can also send data over a telephone circuit with a modem, or using infra-red, radio or many other media
  • ancient system, full of historical artifacts
  • data are transmitted in small, separate packets, bytes (8 bits).
46
Q

What does the core of a packet look like?

A

DRAW Diagram

47
Q

What does the receiver need to know to decode the data reliably?

A
  • the duration of each bit in time (reciprocal of baud rate)
  • when each byte starts
  • would be helpful to be able to check when each byte finishes
48
Q

What is the reciprocal of the baud rate?

A

Each bit is transmitted for a certain length of time

49
Q

What is the baud rate usually?

A

300 times a power of 2, often 9600 or 19200.

50
Q

How is the timing set?

A

Start and stop bits are added at the ends of the packet to set the timing. DRAW DIAGRAM

51
Q

What are the rules for packets?

A
  • the line is held at logic 1 when it is idle
  • a transition from 1 to 0 signals the start of a byte and triggers the receiver
  • the 0 is held for the usual period to form the start bit
  • the 8 bits of data are then transmitted
  • finally a stop bit of 1 is sent for the usual duration
  • this may be followed by the start bit of the next byte.
52
Q

How does the receiver decode the packet?

A

Draw diiagram

53
Q

When will disaster strike when decoding a packet?

A

if the receiver uses a different period from the transmitter.

54
Q

What is a tolerable error between the period of the receiver and the transmitter?

A

about 4% is tolerable

55
Q

Is asynchronous communication hard work?

A

Yes, particularly for the receiver. It can be done in software but will occupy the mC exclusively, even for relatively slow baud rates.

56
Q

What are the names of the built in interfaces to handle serial communication?

A
  • Serial communication interface or controller (SCI or SCC)

- Universal asynchronous receiver transmitter (UART) it may also handle synchronous signals (USART)

57
Q

What voltages does the RS-232C specify?

A

+5V to +25V for logic 0 (around +12V is usually used)

-5 V to -25V for logic 1 (around -12V is often used)

58
Q

What are serial ports being replaced by?

A

Universal Serial Bus - USB.

59
Q

Why are serial ports being replaced by these?

A

Much faster and also provides (limited) power via the bus - avoids the need for power supplies in every component.

60
Q

What is LINbus / how does it work?

A

Local Interconnect Network Bus (a bus using asynchronous communication) - data are sent asynchronously as bytes with start and stop bits. The bus has one wire, connected rather like each wire of I2C. Unlike RS-232 there are protocols for synchronising the clocks in the transmitter and receiver, for controlling the bus and detecting errors.

61
Q

What is a disadvantage of LINbus?

A

It is slow and so only intended for signals that change on the human timescale.

62
Q

What does LINbus complement?

A

CANBUS - major systems and assemblies in a car are linked by CANBUS. LINbus provides the network within assemblies, such as a door: window button and window motor, lock button and motor, mirror positioning control and motor - these are slow and need to communicate with each other but rarely with other systems.

63
Q

What is a disadvantage of LINbus?

A

It is slow and so only intended for signals that change on the human timescale.

64
Q

What does LINbus complement?

A

CANBUS - major systems and assemblies in a car are linked by CANBUS. LINbus provides the network within assemblies, such as a door: window button and window motor, lock button and motor, mirror positioning control and motor - these are slow and need to communicate with each other but rarely with other systems.