A microcontroller alone is useless.
It must:
• Read sensors
• Control displays
• Talk to memory
• Connect to other controllers
• Connect to PC
• Connect to internet
Temperature Sensor --> MCU --> LCD
|
--> WiFi Module --> Cloud
Without communication interfaces, none of this works.
Communication Classification
We classify communication in embedded systems into two major categories:
Communication
|
---------------------------------
| |
Parallel Serial
Parallel Communication
Multiple data bits are sent at the same time.
Example: 8-bit data bus
D7 D6 D5 D4 D3 D2 D1 D0
| | | | | | | |
------------------------
Receiver
Advantages:
• High speed (in short distances)
• Simple logic
Disadvantages:
• Many wires
• EMI problems
• Crosstalk
• Not scalable
Parallel is mostly used:
• Inside MCU (internal buses)
• Old LCD interfaces
• External memory
Modern embedded systems prefer serial.
Serial Communication
Data is sent one bit at a time.
TX -----> RX
1 0 1 0 1 1 0 0
Advantages:
• Fewer wires
• Lower EMI
• Longer distance
• Cheaper PCB
Almost all modern communication protocols are serial.
Communication Direction
There are 3 modes:
Simplex
One direction only
Device A -----> Device B
Half Duplex
Both directions but not at same time
Device A <----> Device B (One at a time)
Full Duplex
Both directions simultaneously
Device A <=====> Device B
Synchronous vs Asynchronous
Asynchronous Communication
No shared clock.
Each side agrees on:
• Baud rate
• Frame format
Example:
UART
Synchronous Communication
Shared clock signal.
CLK _|‾|_|‾|_|‾|_
DATA 1 0 1 1 0
Examples:
• SPI
• I2C
• CAN (internally synchronized)
Physical Layer vs Protocol Layer
Engineers often mix them.
Physical Layer:
• Voltage levels
• Electrical standard
• Timing
• Wiring
Protocol Layer:
• Frame format
• Addressing
• CRC
• Arbitration
• Acknowledgment
Example:
UART → protocol
RS232 → electrical standard
Very important difference.
Voltage Level Standards
Example:
MCU GPIO:
0V – 3.3V
RS232:
-12V to +12V
So we need a level shifter:
Example IC:
Maxim Integrated MAX232
MCU (3.3V) -> MAX232 -> RS232 (-12V/+12V)
This is hardware communication layer engineering.