MSP430 Teaching Materials

Similar documents
I2C Demonstration Board I 2 C-bus Protocol

Activity 4: Due before the lab during the week of Feb

EECE494: Computer Bus and SoC Interfacing. Serial Communication: RS-232. Dr. Charles Kim Electrical and Computer Engineering Howard University

The ST7588T is a driver & controller LSI for graphic dot-matrix liquid crystal display systems. It contains 132 segment and 80

EEL 4744C: Microprocessor Applications. Lecture 9. Part 2. M68HC12 Serial I/O. Dr. Tao Li 1

Single-wire Signal Aggregation Reference Design

In this lecture, we will look at how different electronic modules communicate with each other. We will consider the following topics:

SECTION 6 SERIAL AUDIO INTERFACE

INF8574 GENERAL DESCRIPTION

SC16IS General description. 2. Features

Roland Kammerer. 13. October 2010

SC16C550B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 16-byte FIFOs

MSP430 Teaching Materials

Serial Input/Output. Lecturer: Sri Parameswaran Notes by: Annie Guo

Designing with STM32F3x

EIE/ENE 334 Microprocessors

Systems & Devices Part 1

SC16C550 Rev June 2003 Product data General description Features

ROM/UDF CPU I/O I/O I/O RAM

SC16C650B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 32-byte FIFOs and infrared (IrDA) encoder/decoder

Interfacing to External Devices

ELCT 912: Advanced Embedded Systems

RW1026 Dot Matrix 48x4 LCD Controller / Driver

INTEGRATED CIRCUITS. Control signals. 8 bits

Debugging a Boundary-Scan I 2 C Script Test with the BusPro - I and I2C Exerciser Software: A Case Study

ALPHA Encoder / Decoder IC s

Microcontrollers. Serial Communication Interface. EECE 218 Microcontrollers 1

MSP430 Interfacing Programs

a6850 Features General Description Asynchronous Communications Interface Adapter

Preliminary Information IP0 -IOW -IOR RXB N.C. TXB OP1 OP3 OP5 OP7

The ST7528 is a driver & controller LSI for 16-level gray scale graphic dot-matrix liquid crystal display systems. It contains

How to Troubleshoot System Problems Using an Oscilloscope with I 2 C and SPI Decoding

Obsolete Product(s) - Obsolete Product(s)

Serial Communication AS5132 Rotary Magnetic Position Sensor

SC16C750B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 64-byte FIFOs

SC28L General description. 3.3 V, 5 V UART, Mbit/s, with 256-byte FIFO

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

ST16C450 UNIVERSAL ASYNCHRONOUS RECEIVER/TRANSMITTER (UART) GENERAL DESCRIPTION. PLCC Package FEATURES ORDERING INFORMATION.

DS1807 Addressable Dual Audio Taper Potentiometer

Serial Communications RS232, RS485, RS422

SC16C Description. 2. Features. Dual UART with 32 bytes of transmit and receive FIFOs

SH X Grayscale Dot Matrix OLED/PLED Driver with Controller. Features. General Description 1 V2.2

APPLICATION BULLETIN. SERIAL BACKGROUNDER (Serial 101) AB23-1. ICS ICS ELECTRONICS division of Systems West Inc. INTRODUCTION CHAPTER 2 - DATA FORMAT

Bluetooth low energy IC. Rev 1.20 TC35679IFTG

King Fahd University of Petroleum & Minerals Computer Engineering Dept

XR88C92/192 DUAL UNIVERSAL ASYNCHRONOUS RECEIVER AND TRANSMITTER DESCRIPTION FEATURES. PLCC Package ORDERING INFORMATION.

DATA SHEET. PCD5002 Advanced POCSAG and APOC-1 Paging Decoder INTEGRATED CIRCUITS Jun 24

Unit D. Serial Interfaces. Serial vs. Parallel. Serial Interfaces. Serial Communications

PERIPHERAL INTERFACING Rev. 1.0

This document is designed to be used in conjunction with the CMX869A data sheet.

Carbon Dioxide (Tiny CO2) Gas Sensor. Rev TG400 User Manual

WWVB Receiver/Decoder With Serial BCD or ASCII Interface DESCRIPTION FEATURES APPLICATIONS

Imaging serial interface ROM

2F. No.25, Industry E. 9 th Rd., Science-Based Industrial Park, Hsinchu, Taiwan Application Note of OGM220, AN001 V1.8

G3P-R232. User Manual. Release. 2.06

ROTRONIC HygroClip Digital Input / Output

CANRF UHF Wireless CAN module

DS1307ZN. 64 X 8 Serial Real Time Clock

DATA SHEET. PCF pixels matrix LCD driver INTEGRATED CIRCUITS. Objective specification 2003 Mar 13

DATA SHEET. PCF pixel matrix driver INTEGRATED CIRCUITS

RayStar Microelectronics Technology Inc. Ver: 1.4

Description PKG. NO. TRC NC EPE GND CLS1 RRD CLS2 RBR8 SBS RBR7 PI RBR6 CRL RBR5 TBR8 RBR4 TBR7 RBR3 TBR6 RBR2 TBR5 RBR1 TBR4 PE TBR3 FE TBR2 OE

sercalo MEMS TUNABLE OPTICAL FILTER

I2C Encoder. HW v1.2

RCLK N.C. CS0 CS1 -CS2 -BAUDOUT

RF RECEIVER DECODER RDF1. Features Complete FM Receiver and Decoder. Applications

CS601 Data Communication Solved Objective For Midterm Exam Preparation

Chapter 9: Serial Communication Interface SCI. The HCS12 Microcontroller. Han-Way Huang. September 2009

SC16C652B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V dual UART, 5 Mbit/s (max.) with 32-byte FIFOs and infrared (IrDA) encoder/decoder

CS601-Data Communication Latest Solved Mcqs from Midterm Papers

Minimal UART core. All the project files were published on the LGPL terms, you must read the GNU Lesser General Public License for more details.

ADC081C021/ADC081C027

Interfacing Sensors & Modules to Microcontrollers

Low Power 3D Hall Sensor with I2C Interface and Wake Up Function

Review for Final Exam

Project Final Report: Directional Remote Control

Data Acquisition Modules/ Distributed IO Modules

DS1307/DS X 8 Serial Real Time Clock

Lecture #3 RS232 & 485 protocols

USING RS-232 to RS-485 CONVERTERS (With RS-232, RS-422 and RS-485 devices)

SV613 USB Interface Wireless Module SV613

Kongsberg Mesotech Ltd.

Application Note 160 Using the DS1808 in Audio Applications

DS1307ZN. 64 X 8 Serial Real Time Clock PIN ASSIGNMENT FEATURES

Data transmission - Transmission modes

FEATURES PLCC Package RXB RXA -TXRDYB TXA TXB -OPB -CSA -CSB

Remote Switching. Remote Gates. Paging.

Module 3: Physical Layer

)454 6 TELECOMMUNICATION STANDARDIZATION SECTOR OF ITU

a8259 Features General Description Programmable Interrupt Controller

ADC081C021/ADC081C027 I 2 C-Compatible, 8-Bit Analog-to-Digital Converter (ADC) with Alert Function

ST16C550. UART WITH 16-BYTE FIFO s GENERAL DESCRIPTION. PLCC Package FEATURES ORDERING INFORMATION

I2C Digital Input RTC with Alarm DS1375. Features

NMEA Protocol Converter 2 Plus 3 Users Guide


C16450 Universal Asynchronous Receiver/Transmitter. Function Description. Features. Symbol

EXPERIMENT NO:-1. OBJECTIVE: To study Basics of serial communication ports and protocols.

EE 308 Lab Spring 2009

ZKit-51-RD2, 8051 Development Kit

Description TRC NC EPE GND CLS1 RRD CLS2 RBR8 SBS RBR7 PI RBR6 CRL RBR5 TBR8 RBR4 TBR7 RBR3 TBR6 RBR2 TBR5 RBR1 TBR4 PE TBR3 FE TBR2 OE TBR1 SFD

Transcription:

MSP430 Teaching Materials Lecture 11 Communications Introduction & USI Module Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis Gaspar, António Espírito Santo, Bruno Ribeiro, Humberto Santos University of Beira Interior, Electromechanical Engineering Department

Contents (1/2) Communication Introduction Communications system model Transmission mode Serial communications Synchronous and asynchronous serial communications Peripheral Interface Serial (SPI) protocol I 2 C (Inter-Integrated Circuit) protocol MSP430 communications interfaces 2

Contents (2/2) USI module introduction USI operation: SPI mode USI operation: I 2 C mode USI registers (SPI and I 2 C modes) 3

Introduction An important feature of modern microprocessor based systems is their communication capability, that is, their ability to exchange information with other systems in the surrounding environment; At the low level, communications interfaces are used to download a firmware update or to set up local configurations (e.g. turn features on or off), amongst other tasks; At a higher level, communication interfaces are used to exchange information in distributed applications. 4

Communications system model (1/2) Digital communication devices: Transmitter: Has the task of putting the information into the appropriate format for subsequent transmission; Receiver: Is responsible for collecting the message that has been sent and extracting the original information; Communication medium: The physical medium through which the information flows and is commonly implemented as: Twisted pair wire; Fibre optic cable; Radio frequency transmission. 5

Communications system model (2/2) Devices participating in a digital communication system: DTE: Data Terminal Equipment; DCE: Data Communications Equipment. Transmitter Receiver DTE DCE Transmission medium DCE DTE Receiver Transmitter 6

Transmission mode (1/5) Communications between digital devices can be divided into two types : Parallel communications; Serial communications. Parallel communications: The physical transmission medium has independent signal lines in numbers equal to the transmitted digital word bits; The information transmitted at any given instant is the data word formed by the logical levels on the various signal lines. 7

Transmission mode (2/5) Parallel communications: Example: Character ASCII W parallel transmission. Wire 8 Wire 7 Wire 6 Wire 5 Wire 4 Wire 3 Wire 2 Wire 1 Bit 8=0 (odd parity) Bit 7=1 (MSB) Bit6 =0 Bit 5=1 Bit 4=0 Bit 3=1 Bit 2=1 Bit 1=1 (LSB) Transmitter Receiver Information flow 8

Transmission mode (3/5) Serial communications: Physical transmission medium needs only one signal line; The information transmitted is provided by the transmitter as a sequence of bits, sent at the rate established between the transmitter and the receiver; Additional information is needed to enable the synchronization between the receiver and transmitter: Start bit: Added to the beginning of the information transmitted, so that the receiver can identify the beginning of a new transmission; Stop bit(s): Added to the end of the information transmitted to indicate that the data value is complete. 9

Transmission mode (4/5) Serial communications: Example: Character ASCII W serial transmission: 7 characters bits (Hi) Start bit Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Parity bit Stop Stop (low) 8 data bits 11 bit per character 10

Transmission mode (5/5) Advantages and disadvantages of parallel and serial communication: Characteristic Parallel Serial Bus line One line per bit One line Sequence Transmission rate All bits of one word simultaneously High Sequence of bits Low Bus length Short distances Short and long distances Cost High Low Critical characteristics Synchronisation between the different bits is demanding Asynchronous transmission needs start and stop bits Synchronous transmission needs some other synchronisation 11

Serial communications (1/3) The start bit identifies the beginning of a data transfer and is generated by a high-to-low transition on the bus; Following the start bit are the data bits. In this example, the ASCII code for the text transfer uses seven data bits; The error-checking bit (parity bit) is sent after the data bits; To terminate the transmission, one or two stop bits are issued; Using seven data bits, the complete message can use one or two stop bits. Using eight data bits, only one stop bit is available for transmission. 12

Serial communications (2/3) Parity bit: Used to verify the integrity of information transmitted; The bit is added by the transmitter and indicates whether the total sum of the numbers "1" in the message data is odd or even; The transmissions can be configured for odd or even parity. Bit B Q 3 z 7 bit ASCII code 1 2 3 4 5 6 7 0 1 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 1 1 1 Parity bit odd Parity bit even 1 0 0 1 1 0 0 1 13

Serial communications (3/3) Baud rate example: The transmission of W : Character uses seven data bits; Four bits are used for control, making a total of 11 bits. This corresponds to 11 baud; If the characters are transmitted at a rate of 10 characters per second, the baud rate will be: 10x11 = 1100 baud/s. 14

Synchronous and asynchronous serial communications (1/2) Serial communications may be: Asynchronous: where the transmission rate (baud rate) is fixed by the transmitter and the receiver works at the same baud rate, using the transmitted start bit to synchronize the start of a new message; Synchronous: where there is a separate synchronization clock signal connected between the receiver and the transmitter. Synchronous communications: Normally one unit assumes the role of master and one or more of the other units take the role of slaves; The clock signal generated by the master is used by the slave units to transfer data in/out of the TX and RX registers; It is possible for a device to transmit and receive simultaneously. 15

Synchronous and asynchronous serial communications (2/2) Asynchronous communications: Characterised by the absence of any synchronization clock signal between the units; The transmission in this mode does not allow simultaneous transmission and reception, that is, when one device transmits the other devices just listen. 16

Serial Peripheral Interface (SPI) protocol (1/2) The Serial Peripheral Interface ( SPI) bus is a standard form of synchronous serial communication; Developed by Motorola; Operates in full duplex mode; Master/Slave relationship; Communication is always initiated by the master. Low cost. 17

Peripheral Interface Serial (SPI) protocol (2/2) Supports only one master; Can support more than a slave; Short distance between devices, e.g. on a printed circuit boards (PCBs); Special attention needs to be observed to the polarity and phase of the clock signal; The master sends data on one edge of clock and reads data on the other edge. Therefore, it can send/receive at the same time. 18

I 2 C (Inter-Integrated Circuit) protocol (1/3) Multi-master synchronous serial computer bus; Invented by Philips Semiconductors; Developed with the main objective of establishing links between integrated circuits and to connect low-speed peripherals; Based on two bi-directional open-drain lines pulled up with resistors: SDA: Serial Data; SCL: Serial clock. Typical voltages used are +5.0 V or +3.3 V, although systems with other voltages are possible. 19

I 2 C (Inter-Integrated Circuit) protocol (2/3) Communications is always initiated and completed by the master, which is responsible for generating the clock signal; In more complex applications, I 2 C can operate in multimaster mode; The slave selection by the master is made using the seven-bit address of the target slave; The master (in transmit mode) sends: Start bit; 7-bit address of the slave it wishes to communicate with; A single bit representing whether it wishes to write (0) to or read (1) from the slave; The target slave will acknowledge its address. 20

I 2 C (Inter-Integrated Circuit) protocol (3/3) Example of an I 2 C communication system: VDD SCL SDA DAC (slave) uc (master) SCL SDA SCL SDA EEPROM (slave) SCL SDA ADC (slave) 21

MSP430 communications interfaces (1/2) Equipped with three serial communication interfaces: USART (Universal Synchronous/Asynchronous Receiver/Transmitter): UART mode; SPI mode; I 2 C (on F15x/ F16x only). USCI (Universal Serial Communication Interface): UART with Lin/IrDA support; SPI (Master/Slave, 3 and 4 wire modes); I 2 C (Master/Slave, up to 400 khz). USI (Universal Serial Interface): SPI (Master/Slave, 3 & 4 wire mode); I 2 C (Master/Slave, up to 400 khz). 22

MSP430 communications interfaces (2/2) Comparison between the communication modules: USART USCI USI UART: - Only one modulator - n/a - n/a - n/a SPI: - Only one SPI available - Master and Slave Modes - 3 and 4 Wire Modes I 2 C: (on 15x/ 16x only) - Master and Slave Modes - up to 400kbps UART: - Two modulators support n/16 timings - Auto baud rate detection - IrDA encoder & decoder - Simultaneous USCI_A and USCI_B (2 channels) SPI: - Two SPI (one on each USCI_A and USCI_B) - Master and Slave Modes - 3 and 4 Wire Modes I 2 C: - Simplified interrupt usage - Master and Slave Modes - up to 400kbps SPI: - Only one SPI available - Master and Slave Modes I 2 C: - SW state machine needed - Master and Slave Modes 23

USI module introduction (1/2) The USI (Universal Serial Interface) module supports basic SPI and I 2 C synchronous serial communications; It is available in the MSP430x20xx family of devices; The USI module supports: SPI or I 2 C modes; Interrupt driven; Reduces CPU load; Flexible clock source selection. 24

USI module introduction (2/2) USI block diagram: SPI mode: Programmable data length (8/16-bit shift register); MSB/LSB first. I 2 C mode: START/STOP detection; Arbitration lost detection. Interrupt driven; Reduces CPU load; Flexible clock source. 25

USI operation: SPI and I 2 C modes (1/5) Shift register and bit counter that include logic to support SPI and I 2 C communication; USISR shift register (up to 16 bits supported): Directly accessible by software; Contains the data to be transmitted/received (simultaneously); MSB or LSB first. Bit counter: Controls the number of bits transmitted/received; Counts the number of sampled bits; Sets USIIFG when the USICNTx = 0 (decrementing or writing zero to USICNTx bits); Writing USICNTx > 0 automatically clears USIIFG when USIIFGCC = 0 (automatically stops clocking after last bit). 26

USI operation: SPI and I 2 C modes (2/5) USI initialization: Reset USISWRST; Set USIPEx bits (USI function for the pin and maintains the PxIN and PxIFG functions for the pin): Port input levels can be read via the PxIN register by software; Incoming data stream can generate port interrupts on data transitions. 27

USI operation: SPI and I 2 C modes (3/5) Recommended USI initialization process: Set the USIPEx bits in the USI control register (USI function for the pin and set up the PxIN and PxIFG functions for the pin as well); Set the direction of the RX and TX shift register (MSB or LSB first) by USILSB bit; Select the mode (master or slave) by USIMTS bit; Enable or disable output data by USIOE bit; Enable USI interrupts by setting USIIE bit; Set up USI clock by configuring the USICKCTL control register; Enable USI by setting USISWRST bit; Read port input levels via the PxIN register by software; Incoming data stream will generate port interrupts on data transitions. 28

USI operation: SPI and I 2 C modes (4/5) USI clock generation: Clock selection multiplexer: Internal clocks ACLK or SMCLK; External clock SCLK; USISWCLK (software clock input bit); Timer_A CAP/COM outputs. Configurable divider; Auto-stop on interrupt: USIIFG; Selectable phase and polarity. 29

USI operation: SPI and I 2 C modes (5/5) USICKPL: Selects the inactive level of the SPI clock (data latching on rising or falling edge); USICKPH: Selects the clock edge on which SDO is updated and SDI is sampled (idle high or low support). USIIFG automatically cleared and set by USICNTx; Clock stop on IFG: USIIFG and USISTTIFG. changing edge change first inactive low 30

USI operation: SPI mode (1/2) Configure SPI mode: SPI master: USIMST = 1; USII2C = 0; Select clock source; SCLK -> output. SPI slave: USIMST = 0; USII2C = 0; SCLK -> input; Receives the clock externally from the master. USIPEx bits enable data and clock pins; Port logic functions, including interrupts as normal; Data output latched on shift clock. 31

USI operation: SPI mode (2/2) SPI interrupts: One interrupt vector associated with the USI module; One interrupt flag, USIIFG: Set when bit counter counts to zero; Generates an interrupt request when USIIE = 1; Cleared when USICNTx > 0 (USIIFGCC = 0), or directly by software; Stops clock when set. 32

USI operation: I 2 C mode (1/10) Configure USI module in I 2 C mode: USII2C =1; USICKPL = 1; USICKPH = 0; I 2 C data compatibility: USILSB = 0; USI16B = 0; Enable SCL and SDA port functions: Set USIPE6 and USIPE7. 33

USI operation: I 2 C mode (2/10) I 2 C master: USIMST = 1 and USII2C = 1; Select clock source (output to SCL line while USIIFG = 0). I 2 C slave: USIMST = 0; SCL is held low if USIIFG=1, USISTTIFG=1 or if USICNTx=0. 34

USI operation: I 2 C mode (3/10) I 2 C transmitter: Data value is first loaded into USISRL; USIOE= 1: Enable output and start transmission (writes 8 into USICNTx); Send Start (or repeated Start); Define address and set R/W; Slave ACK: (Data TX/RX + ACK for N bytes); SCL is generated in master mode or released from being held low in slave mode; USIIFG is set after the transmission of all 8 bits (stops clock signal on SCL in master mode or held low at the next low phase in slave mode); Stop (or repeated Start). 35

USI operation: I 2 C mode (4/10) I 2 C receiver: Clear USIOE (disable output); Enable reception by writing 8 into USICNTx (USIIFG = 0); SCL is generated in master mode or released from being held low in slave mode; USIIFG is set after 8 clocks (stops the clock signal on SCL in master mode or holds SCL low at the next low phase in slave mode). 36

USI operation: I 2 C mode (5/10) SDA configuration: Direction; Used for TX/RX, ACK/NACK handling and START/STOP generation; USIGE: Output latch control (clock); USIOE: Data output enable. 37

USI operation: I 2 C mode (6/10) START condition: (high-to-low transition on SDA while SCL is high); Clear MSB of the shift register; USISTTIFG set on start (Sources USI interrupt). 38

USI operation: I 2 C mode (7/10) STOP condition: (low-to-high transition on SDA while SCL is high): Clear the MSB in the shift register and loads 1 into USICNTx (finishes the acknowledgment bit and pulls SDA low); USISTP set on stop (CPU-accessible flag). 39

USI operation: I 2 C mode (8/10) Receiver ACK/NACK generation: After address/data reception; SDA = output; Output 1 data bit: 0 = ACK, 1 = NACK. Transmitter ACK/NACK Detection: After address/data transmission; SDA = input; Receive 1 data bit: 0 = ACK, 1 = NACK. Arbitration procedure (in multi-master I 2 C systems); 40

USI operation: I 2 C mode (9/10) I 2 C Interrupts: One interrupt vector associated with the USI; Two interrupt flags, USIIFG and USISTTIFG; Each interrupt flag has its own interrupt enable bit, USIIE and USISTTIE; When an interrupt is enabled and the GIE bit is set, a set interrupt flag will generate an interrupt request; USIIFG is set (USICNTx = 0); USISTTIFG is set (START condition detection). 41

USI operation: I 2 C mode (10/10) Example: Procedure for I 2 C communication between a Master TX and a Slave RX. Master TX Slave RX 1: Send Start, Address and R/W bit 1: Detect Start, receive address and R/W 2: Receive (N)ACK 2: Transmit (N)ACK 3: Test (N)ACK and handle TX data 3: Data RX 4: Receive (N)ACK 4: Transmit (N)ACK 5: Test (N)ACK and prepare Stop 5: Reset for next Start 6: Send Stop 42

USI registers (SPI and I 2 C modes) (1/8) USICTL0, USI Control Register 0 7 6 5 4 3 2 1 0 USIPE7 USIPE6 USIPE5 USILSB USIMST USIGE USIOE USIWRST Bit Description 7 USIPE7 USI SDI/SDA port enable: SPI mode Input I2C mode Input or open drain output USIPE7 = 0 USI function disabled USIPE7 = 1 USI function enabled 6 USIPE6 USI SDO/SCL port enable: SPI mode Output I2C mode Input or open drain output USIPE6 = 0 USI function disabled USIPE6 = 1 USI function enabled 5 USIPE5 USI SCLK port enable: SPI slave mode Input SPI master mode Output I2C mode Input USIPE5 = 0 USI function disabled USIPE5 = 1 USI function enabled 43

USI registers (SPI and I 2 C modes) (2/8) USICTL0, USI Control Register 0 (continued) 7 6 5 4 3 2 1 0 USIPE7 USIPE6 USIPE5 USILSB USIMST USIGE USIOE USIWRST 4 USILSB LSB first select (direction of the receive and transmit shift register): USILSB = 0 MSB first USILSB = 1 LSB first 3 USIMST Master select: USIMST = 0 Slave mode USIMST = 1 Master mode 2 USIGE Output latch control: USIGE = 0 Output latch enable depends on shift clock USIGE = 1 Output latch always enabled and transparent 1 USIOE Data output enable: USIOE = 0 Output disabled USIOE = 1 Output enabled 0 USIWRST USI software reset: USIWRST = 0 USI released for operation USIWRST = 1 USI logic held in reset state 44

USI registers (SPI and I 2 C modes) (3/8) USICTL1, USI Control Register 1 7 6 5 4 3 2 1 0 USICKPH USII2C USISTTIE USIIE USIAL USISTP USISTTIFG USIIFG Bit Description 7 USICKPH Clock phase select: USICKPH = 0 Data is changed on the first SCLK edge and captured on the following edge USICKPH = 1 Data is captured on the first SCLK edge and changed on the following edge 6 USII2C I2C mode enable: USII2C = 0 I2C mode disabled USII2C = 1 I2C mode enabled 5 USISTTIE START condition interrupt-enable: USISTTIE = 0 Interrupt on START condition disabled USISTTIE = 1 Interrupt on START condition enabled 4 USIIE USI counter interrupt enable: USIIE = 0 Interrupt disabled USIIE = 1 Interrupt enabled 45

USI registers (SPI and I 2 C modes) (4/8) USICTL1, USI Control Register 1 (continued) 7 6 5 4 3 2 1 0 USICKPH USII2C USISTTIE USIIE USIAL USISTP USISTTIFG USIIFG 3 USIAL Arbitration lost: USIAL = 0 No arbitration lost condition USIAL = 1 Arbitration lost 2 USISTP STOP condition received: USISTP = 0 No STOP condition received USISTP = 1 STOP condition received 1 USISTTIFG START condition interrupt flag: USISTTIFG = 0 No interrupt pending USISTTIFG = 1 Interrupt pending 0 USIIFG USI counter interrupt flag: USIIFG = 0 No interrupt pending USIIFG = 1 Interrupt pending 46

USI registers (SPI and I 2 C modes) (5/8) USICKCTL, USI Clock Control Register 7 6 5 4 3 2 1 0 USIDIVx USISSELx USICKPL USISWCLK Bit Description 7-5 USIDIVx Clock divider select: USIDIV2 USIDIV1 USIDIV0 = 000 Divide by 1 USIDIV2 USIDIV1 USIDIV0 = 001 Divide by 2 USIDIV2 USIDIV1 USIDIV0 = 010 Divide by 4 USIDIV2 USIDIV1 USIDIV0 = 011 Divide by 8 USIDIV2 USIDIV1 USIDIV0 = 100 Divide by 16 USIDIV2 USIDIV1 USIDIV0 = 101 Divide by 32 USIDIV2 USIDIV1 USIDIV0 = 110 Divide by 64 USIDIV2 USIDIV1 USIDIV0 = 111 Divide by 128 4-2 USISSELx Clock source select. Not used in slave mode. USISSEL2 USISSEL1 USISSEL0 = 000 SCLK (1 ) USISSEL2 USISSEL1 USISSEL0 = 001 ACLK USISSEL2 USISSEL1 USISSEL0 = 010 SMCLK USISSEL2 USISSEL1 USISSEL0 = 011 SMCLK USISSEL2 USISSEL1 USISSEL0 = 100 USISWCLK bit USISSEL2 USISSEL1 USISSEL0 = 101 TACCR0 USISSEL2 USISSEL1 USISSEL0 = 110 TACCR1 USISSEL2 USISSEL1 USISSEL0 = 111 TACCR2 (2 ) (1 ) Not used in SPI mode (2 ) Reserved on MSP430F20xx devices 47

USI registers (SPI and I 2 C modes) (6/8) USICKCTL, USI Clock Control Register (continued) 7 6 5 4 3 2 1 0 USIDIVx USISSELx USICKPL USISWCLK 1 USICKPL Clock polarity select: USICKPL = 0 Inactive state is low USICKPL = 1 Inactive state is high 0 USISWCLK Software clock: USISWCLK = 0 Input clock is low USISWCLK = 1 Input clock is high 48

USI registers (SPI and I 2 C modes) (7/8) USICNT, USI Bit Counter Register 7 6 5 4 3 2 1 0 USISCLREL USI16B USIIFGCC USICNTx Bit Description 7 USISCLREL SCL line release from low to idle: USISCLREL = 0 SCL line is held low if USIIFG is set USISCLREL = 1 SCL line is released 6 USI16B 16-bit shift register enable: USI16B = 0 8-bit shift register mode. (Uses USISRL low byte) USI16B = 1 16-bit shift register mode (Uses both USISRx bytes) 5 USIIFGCC USI interrupt flag clear control: USIIFGCC = 0 USIIFG automatically cleared on USICNTx update USIIFGCC = 1 USIIFG is not cleared automatically 4-0 USICNTx USI bit count (Number of bits to be received or transmitted) 49

USI registers (SPI and I 2 C modes) (8/8) USISRL, USI Low Byte Shift Register 7 6 5 4 3 2 1 0 USISRLx Bit Description 7-0 USISRLx Contents of the USI low byte shift register USISRH, USI High Byte Shift Register 7 6 5 4 3 2 1 0 USISRHx Bit Description 7-0 USISRHx Contents of the USI high byte shift register 50