Embedded Systems Reference Material
Embedded Systems Reference Material
UNIT iV
COMMUNICATIONS
1. The MSP430 contains built-in features for both parallel and
serial data communication.
2. The communication modules available for the MSP430
family of microcontrollers are USART (Universal
Synchronous/Asynchronous Receiver/Transmitter), USCI
(Universal Serial Communication Interface) and USI
(Universal Serial Interface).
3. These provide asynchronous data transmission between the
MSP430 and other peripheral devices when configured in
UART mode.
4. They also support data transmission synchronized to a
clock signal through a serial I/O port in Serial Peripheral
Interface (SPI) and Inter Integrated Circuit (I2C) modes.
5.1 INTRODUCTION
Full Duplex: This type of data transmission allows data transfer in both
directions simultaneously.
Eg: Telephone line
5.5 ASYNCHRONOUS (UART) COMMUNICATIONS
PROTOCOL
B 0 1 0 0 0 0 1 1 0
Q 1 0 0 0 1 0 1 0 1
3 1 1 0 0 1 1 0 1 0
Z 0 1 0 1 1 1 1 0 1
5.5.2 BAUD RATE
The transmission of the ASCII character "W" 7-bit character
requires eleven bits to be sent, with four additional bits being
used for control. This corresponds to a baud value of 11. If the
character transmission rate is 10 characters per second, it will
give a baud rate of 10x11 = 1100 baud/second.
The SPI (Serial Peripheral Interface) bus is a standard for synchronous serial
communication developed by Motorola, which operates in full duplex mode. The
devices have a master/slave relationship and the communication is always initiated
by the master.
Figure 6. Typical SPI communication system.
The SPI communications system shown in Figure 6 only supports one master, but can
support more than a slave. The distance between units should be minimized, ideally
limited to a single PCB. Special attention should be given to the polarity and phase of
the clock signal.
5.7 I2C (INTER-INTEGRATED CIRCUIT) PROTOCOL
The master (in transmit mode) sends a start bit followed by the
7-bit address of the slave it wishes to communicate with,
followed by a single bit representing whether it wishes to write
(0) to or read (1) to/from the slave. The target slave will
acknowledge its address.
5.8 UNIVERSAL SERIAL BUS (USB) PROTOCOL
USB is a wired high speed serial bus for data communication. The
USB communication system follows star topology with a USB
host at centre and one or more peripherals connected to it.
A USB host can support up to 127 slave peripheral devices and
other USB hosts.
USB transmits data in packet format. The USB communication is a
host initiated one.
The USB host controller is responsible for controlling the data
communication, establishing connectivity, packetizing and
formatting the data.
The USB standard uses two different types of connector at the ends
of the USB cable. Type A connector is used for upstream
connection (connection with host, ex: PC, laptop) and Type B
connector is used for downstream connection (connection with
slave device).
• USB interface has the ability to carry power to the connecting devices
(GND and VBUS pins).
• Each USB device contains a product ID (PID) which is embedded in to the USB chip
by the manufacturer and vendor ID (VID) is supplied by the USB standards forum.
These are essential for loading drivers to a USB device for communication.
• USB supports four different types of data transfers i.e. Control, Bulk, Isochronous
and Interrupt
Control transfer is used by USB system software to query,
configure and issue commands to the USB device.
•USART,
•USCI;
•USI.
Transmit and receive use the same clock frequency leading to the same baud
rate;
•Serial data transmitted and received by multiple devices using a shared clock
provided by the master;
•Three or four signals are used for SPI data exchange:
SIMO: Slave In, Master Out;
SOMI Slave Out, Master In;
UCLK USART SPI clock;
STE slave transmit enable (controlled by the master).
USART operation in SPI mode.
USART initialization/re-configuration process:
•Set SWRST (BIS.B #SWRST,&UxCTL);
•Initialize all USART registers with SWRST = 1 (including UxCTL);
•Enable USART module via the MEx SFRs (URXEx and/or UTXEx);
•Clear SWRST via software (BIC.B #SWRST,&UxCTL);
•Enable interrupts (optional) via the IEx SFRs (URXIEx and/or
UTXIEx);
One interrupt vector for transmission and one interrupt vector for
reception:
another character;
Although supporting UART, SPI and I 2C, the USCI (Universal Serial Communication
Interface) module is a communications interface specially designed to interconnect
with high-speed industrial protocols
LIN (Local interconnect Network), used in cars (door modules, alarm, sunroof, etc.);
IrDA (Infrared Data Association), used for remote controllers.
The USCI module is available in the following devices:
MSP430F5xx;
MSP430F4xx and MSP430FG461x;
MSP430F2xx.
The USCI module Features :
Low power operating modes (with auto-start);
Two individual blocks:
USCI_A:
UART with Lin/IrDA support;
UART and SPI (Master/Slave, 3 and 4 wire modes).
USCI_B:
SPI (Master/Slave, 3 and 4 wire mode);
DMA enabled;
USCI OPERATION: UART MODE
In asynchronous mode, the USCI_Ax modules connect the
MSP430 to an external system via two external pins the
MSP430 to an external system via two external pins ,
UCAxRXD and UCAxTXD;
UART mode is selected when the UCSYNC bit is cleared;
USCI transmits and receives characters asynchronously;
Timing for each character is based on the selected baud rate
of the USCI;
Transmit and receive use the same clock frequency leading
to the same baud rate;
USCI OPERATION: UART MODE
USCI OPERATION IN UART MODE BLOCK DIAGRAM
USCI OPERATION: UART MODE
The UCMSB bit controls the direction of the transfer and selects LSB (usual
in UART communication) or MSB first
Asynchronous communication formats:
Idle-line multiprocessor communication protocol ( ) minimum
of two devices ):
IDLE is detected after > 10 periods of continuous marks after
the stop bit;
The first character after IDLE is an address
USCI interrupts:
One interrupt vector for transmission and one interrupt
vector for reception:
USCI OPERATION: SPI MODE
Flexible interface:
Master or slave;
LPMx operation
USCI MODULE: SPI MODE BLOCK DIAGRAM
USCI MODULE: SPI CONNECTIONS
Serial data transmitted and received by multiple devices using a
shared clock provided by the master;
Three or four signals are used for SPI data exchange:
UCxSIMO: Slave in, master out;
UCxSOMI: Slave out, ; master in;
UCxCLK: USCI SPI clock;
UCxSTE: Slave transmit enable:
o Enables a device to receive and transmit data and is
controlled by the master;
o 4 wire master, senses conflicts with other master(s);
o In 4 wire slave, externally controls TX and RX.
USCI interrupts:
o One interrupt vector for transmission and one interrupt vector for
reception:
USCI OPERATION: I2C MODE
I2C mode:
oSTART/STOP detection;
o Arbitration lost detection.
Interrupt driven;
o Reset USISWRST;
o Set USIPEx bits (USI function for the pin and maintains the
PxIN and PxIFG functions for the pin):
o Port input levels can be read via the PxIN register by
software;
o Incoming data stream can generate port interrupts on data
transitions.