In-Depth with MSP430 s New Communication Interfaces

Similar documents
XIO1100 NAND-Tree Test

Hands-On: Implementing an RF link with MSP430 and CC1100

Application Report. 1 System Requirements. 2 Using the DM643x Pin Multiplexing Utility. Bernard Thompson...

System-on-Chip Battery Board User s Guide

This document describes the features of the GUI program used to control Power Line Modem with E-Meter Platform.

DSP/BIOS Link. Platform Guide Published on 20 th JUNE Copyright 2009 Texas Instruments Incorporated.

AC Induction Motor (ACIM) Control Board

Application Report. 1 Introduction. MSP430 Applications. Keith Quiring... ABSTRACT

Bootstrap Loader (BSL) Scripter User s Guide

The examples in this application report require the Flash API Modules (SPRC236) within the "Tools & Software" folder.

TMS470R1x External Clock Prescale (ECP) Reference Guide

ez430-rf2480 Sensor Monitor SWRU Low-Power RF

Application Note AN045

DS25BR204 Evaluation Kit

Table 1. Proper Termination of Unused (Port) Pins in a Single-Port PSE System

WL1271 ini File Description and Parameters User's Guide

description VCC 1PRE 1OC 1D1 1C 1Q1 1Q2 1Q3 1Q4 2Q1 2Q2 2Q3 2Q4 2C 2PRE 1D2 1D3 1D4 2D1 2D2 2D3 2D4 2OC GND 1PRE 1OC 1Q1 1D1 1Q2 1Q3 1Q4 1D2 1D3 1D4

Application Report. 1 Hardware Description. John Fahrenbruch... MSP430 Applications

Wolverine - based microcontrollers. Slashing all MCU power consumption in half

TCI6616/C6670/TCI6608/C6678 Device Simulator EMAC Model I/O user-guide

TMS320C6414T/15T/16T Power Consumption Summary

In this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them.

TMS320C64x DSP Peripheral Component Interconnect (PCI) Performance

PRODUCT DATASHEET. Features. IPNetCam Reference Design on DM365 Product Release 1.5.0, Nov 2009

TPS62290EVM-279. User's Guide SLVU217 July 2007

TMS470R1VF334E TMS470 Microcontrollers Silicon Errata

In this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them.

MSP430F20xx Device Erratasheet

Protecting the TPS25810 from High Voltage DFPs

Stacking the REF50xx for High-Voltage References

Application Report. Low-Power Wireless. Shreharsha Rao... ABSTRACT

TMS320C6000 DSP Interrupt Selector Reference Guide

PCIxx12 Single Socket CardBus Controller with Integrated 1394a-2000 OHCI Two-Port PHY/Link-Layer Controller

UCD3138 Responding to Multiple PMBus Slave Addresses

DaVinci System Optimization

TMS320C6000 DSP 32-Bit Timer Reference Guide

Power Line Modem with E-Meter Platform Quick Start Guide

Ethernet-Enabled Intelligent Display Modules (IDMs)

TMS320C620x/C670x DSP Boot Modes and Configuration Reference Guide

Using Endianess Conversion in the OMAP5910 Device

SN5476, SN54LS76A SN7476, SN74LS76A DUAL J-K FLIP-FLOPS WITH PRESET AND CLEAR

PACKAGE OPTION ADDENDUM

Quad-Channel TEC Controller Getting Started Guide. Contents. Introduction. Contents of Evaluation Kit

SN65DSI86 SW Examples

External Programming of the TMS320C64x EDMA for Low Overhead Data Transfers

USB Connectivity using MSP430 and TUSB3410

Interfacing the ADS8320/ADS8325 to The TMS320C6711 DSP

Calibration Routines and Register Value Generation for the ADS1216, ADS1217 and ADS1218

TMS320C6000 DSP General-Purpose Input/Output (GPIO) Reference Guide

HV Solar MPPT DC-DC GUI Overview. Getting Started Guide

SN64BCT757 OCTAL BUFFER/DRIVER WITH OPEN-COLLECTOR OUTPUTS

Application Report. 1 Overview. Marc Sousa... Power Supply ABSTRACT

TVP5146 PDC and VPS APPLICATION NOTE HPA Digital Audio Video

Table 1. EVM Description

2. With the Evaluation Kit DVD, click the Tools button and then click the Code Composer Studio logo to start the setup program.

User s Guide for Sonic MDIO Software

DRV8833 Evaluation Module. User's Guide

TMS320C672x DSP Software-Programmable Phase-Locked Loop (PLL) Controller. Reference Guide

UNIT IV SERIAL COMMUNICATIONS

4-Level Strap Device Configuration

CPE 323: MSP430 Serial Communication

TPS63020EVM-487. User's Guide. 1 Introduction. 1.1 Background. 1.2 Performance Specification

Data sheet acquired from Harris Semiconductor SCHS041D Revised October 2003

Passing CISPR25-Radiated Emissions Using TPS54160-Q1

18-Line SCSI Terminator (Reverse Disconnect) UCC5617 FEATURES DESCRIPTION BLOCK DIAGRAM

OMAP5912 Multimedia Processor Direct Memory Access (DMA) Support Reference Guide

Designing for Ultra-Low Power with MSP430

Interfacing CMR3000-D01 to an MSP430 ultra low-power microcontroller

UART Bootloader for Hercules TMS570LS04x MCU

SN54LS169B, SN54S169 SN74LS169B, SN74S169 SYNCHRONOUS 4-BIT UP/DOWN BINARY COUNTERS

IndoTraq Development Kit 1: Command Reference

SN54155, SN54156, SN54LS155A, SN54LS156, SN74155, SN74156, SN74LS155A, SN74LS156 DUAL 2-LINE TO 4-LINE DECODERS/DEMULTIPLEXERS

Design Considerations for Avoiding Timing Errors during High-Speed ADC, High-Speed ADC, LVDS Data Interface with FPGA

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller

TMS320VC5501/5502 DSP Host Port Interface (HPI) Reference Guide

TMS320C55x DSP Peripherals Overview Reference Guide. Preliminary Draft

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018

SN74BCT756 OCTAL BUFFER/DRIVER WITH OPEN-COLLECTOR OUTPUTS

HSKT TM Technology Specifications

TLK10081 EVM Quick Start Guide Texas Instruments Communications Interface Products

Using the DSP in the Dual-Core DaVinci as a Graphics Render Engine

Stereo Dac Motherboard application information

27 - Line SCSI Terminator With Split Disconnect

TMS320VC5510 DSP Host Port Interface (HPI) Reference Guide

임베디드시스템기초 (# ) #11. Serial Communications 한림대학교전자공학과이선우

Connecting Bluetooth to the OMAP5910

TIDA Test Report

Using the TMS320VC5509/5510 Enhanced HPI

AN-2245 MSP430 Interface to DAC161P997 Code Library

The photograph below shows the PMP9730 Rev E prototype assembly. This circuit was built on a PMP9730 Rev D PCB.

AN-2254 MSP430 Interface to LMP91200 Code Library

Bluetooth Low Energy CC2540 Mini Development Kit User s Guide

Features. Applications

1 Photo. 7/15/2014 PMP10283 Rev A Test Results

TMS470R1x Serial Communication Interface (SCI) Reference Guide

AN-2062 LM3549 Evaluation Kit

Test Report PMP Test Data For PMP /20/2015

Serial Peripheral Interface (SPI)

I2C and the TAS3001C. Introduction. The I2C Protocol. Digital Audio Group ABSTRACT

Transcription:

In-Depth with MSP430 s New Communication Interfaces Volker Rzehak MSP430 Systems Engineer Texas Instruments 2006 Texas Instruments Inc, Slide 1

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What module for what purpose 2006 Texas Instruments Inc, Slide 2

What is the USI? Universal Serial Interface SPI Mode 8/16-bit shift register MSB/LSB first I 2 C Mode Support START/STOP detection Arbitration lost detection Interrupt Driven Reduces CPU load In low pin-count 2xx devices 2006 Texas Instruments Inc, Slide 3

What is the USCI? Universal Serial Communication Interface Two independent blocks USCI_A: UART UART with automatic Baud rate detection (LIN support) IrDA (SIR - Slow InfraRed) SPI (Master & Slave, 3 & 4 wire) USCI_B: I2C (Master & Slave modes) SPI (Master & Slave, 3 & 4 wire) In high-end 2xx and 4xx devices 2006 Texas Instruments Inc, Slide 4

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What module for what purpose 2006 Texas Instruments Inc, Slide 5

USI: Close-up Clock Control Data I/O USI Interrupts Pin Functionality 2006 Texas Instruments Inc, Slide 6

Data I/O Data shift register: up to 16 bits supported Number of bits TX d & RX d controlled by bit counter TX & RX is simultaneous Data I/O is user-defined: MSB or LSB first Selectable phase and polarity Bit counter automatically stops clocking after last bit & sets interrupt flag No data buffering! SCLK ACLK SMCLK SMCLK USISWCLK TA0 TA1 TA2 USISSELx USIIFG USISR Shift Register USICNTx Bit Counter USIDIVx Clock Divider /1/2/4/8 /128 HOLD Set USIIFG Data I/O 2006 Texas Instruments Inc, Slide 7

USI Interrupts USIIFG (used for SPI & I2C) Set when bit counter counts to zero Enabled by USIIE Cleared automatically when USICNTx is > 0 (USIIFGCC = 0) Stops clock when set USISTTIFG (only used for I2C) Set when start condition detected Enabled by USISTTIFG Must be cleared in software Stops clock when set 2006 Texas Instruments Inc, Slide 8

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What module for what purpose 2006 Texas Instruments Inc, Slide 9

USI SPI Communication Master or slave mode supported: USIMST USIPEx bits enable data & clock pins Port logic including interrupts functions as normal Data output latched on shift clock USISWRST SCLK ACLK SMCLK SMCLK TA0 TA1 TA2 Shift Clock Data Shift Register Bit Counter Clock Divider /1/2/4/8 /128 HOLD Phase Select Set USIIFG Polarity Select Data Latch USIMST SDO SDI SCLK USIIFG 2006 Texas Instruments Inc, Slide 10

SPI Initialization & Processing // // Configure USI USI USICTL0 USICTL0 = USIPE7+USIPE6+USIPE5+USIMST+USIOE; USICTL1 USICTL1 = USIIE; USIIE; // // Enable Enable USI USI interrupt USICKCTL = USIDIV_4+USISSEL_2; // // Setup Setup USI USI clocks: clocks: SMCLK/16 USICTL0 USICTL0 = USISWRST; // // Enable Enable USI USI while(1) {_BIS_SR(LPM0_bits + GIE);} GIE);} // // Enter Enter LPM0 LPM0 w/ w/ interrupt interrupt void void USI_TXRX (void) (void) { SLV_Data = USISR; USISR; // // Store Store RX RX data data USISR USISR = MST_Data; // // Load Load next next TX TX data data USICNT USICNT = USI16B USI16B + 16; 16; // // Load Load counter, clear clear USIIFG USIIFG } 2006 Texas Instruments Inc, Slide 11

USI I 2 C Communication Master & slave modes 8-bit data MSB first Start & stop detection SCL control (divider > 1) USISWRST SCLK ACLK SMCLK SMCLK TA0 TA1 TA2 Shift Clock Data Shift Register Bit Counter Clock Divider /1/2/4/8 /128 HOLD Set USIIFG SCL Hold Control Data Latch Logic Control START Detect STOP Detect Logic Control SDA Set USISTTIFG Set USISTP SCL USIIFG 2006 Texas Instruments Inc, Slide 12

I 2 C Clocking and Data Start (or repeated Start) Address + R/W Slave Ack Data TX/RX + Ack for N bytes Stop (or repeated Start) 2006 Texas Instruments Inc, Slide 13

I2C Data and Clock Handling SDA Control Direction of SDA must also be controlled Used for TX/RX, ACK/NACK handling and START/STOP generation USIGE: Output latch control USIOE: Data output enable USIGE USIOE D Q G USISRL DQ Set USIAL, Clear USIOE SDA SCL Control SCL automatically held low in slave mode if USIIFG = 1 or USISTTIFG = 1 (Requires I2C compliant master supporting clock stretching) SCL can be release by software with USISCLREL = 1 (clock) USIIFG USISTTIFG Shift Clock SCL SCL Hold USISCLREL USIMST USICLK 2006 Texas Instruments Inc, Slide 14

Start/Stop Generation: Master Only Start ; Generate START START MOV.B MOV.B #000h,&USISRL ; MSB MSB = 0 BIS.B BIS.B #USIGE+USIOE,&USICTL0 ; Latch/SDA output output enabled enabled BIC.B BIC.B #USIGE,&USICTL0 ; Latch Latch disabled...continue... Stop ; Generate STOP STOP BIS.B BIS.B #USIOE,&USICTL0 ; SDA=output MOV.B MOV.B #000h,&USISRL ; MSB MSB = 0 MOV.B MOV.B #001h,&USICNT ; USICNT USICNT = 1 for for one one clock clock TEST_USIIFG BIT.B BIT.B #USIIFG,&USICTL1 ; Test Test USIIFG USIIFG JZ JZ TEST_USIIFG ; MOV.B MOV.B #0FFh,&USISRL ; USISRL=1 to to drive drive SDA SDA high high BIS.B BIS.B #USIGE,&USICTL0 ; Transparent latch latch enabled enabled BIC.B BIC.B #USIGE+USIOE,&USICTL ; Latch/SDA output output disabled...continue... 2006 Texas Instruments Inc, Slide 15

Start/Stop Detection Slave mode START & STOP detection 100% in hardware USISTTIFG set on start Sources USI interrupt USISTP set on stop CPU-accessible flag SCL held low in hardware when USISTTIFG = 1 (requires an I2C compliant master supporting clock stretching) START Detect STOP Detect SDA Set USISTTIFG Set USISTP SCL 2006 Texas Instruments Inc, Slide 16

Receiver Ack/Nack Generation ;Generate (N)ACK (N)ACK BIS.B BIS.B #USIOE,&USICTL0 ; SDA SDA output output MOV.B MOV.B #00h,&USISRL ; MSB MSB = 0 -> -> Ack Ack OR OR MOV.B MOV.B #FFh,&USISRL ; MSB MSB = 1 -> -> NAck NAck MOV.B MOV.B #001H,&USICNT ; USICNT USICNT = 1 for for one one clock clock TEST_USIIFG BIT.B BIT.B #USIIFG,&USICTL1 ; Test Test USIIFG USIIFG JZ JZ TEST_USIIFG...continue... After address/data reception SDA = output Output 1 data bit: 0 = Ack, 1 = NAck 2006 Texas Instruments Inc, Slide 17

Transmitter Ack/Nack Detection ; Receive Receive ACK/NACK BIC.B BIC.B #USIOE,&USICTL0 ; SDA SDA input input MOV.B MOV.B #01h,&USICNT ; USICNTx USICNTx = 1 TEST_USIIFG BIT.B BIT.B #USIIFG,&USICTL1 ; Test Test USIIFG USIIFG JZ JZ TEST_USIIFG BIT.B BIT.B #01h,&USISRL ; Test Test received ACK ACK bit bit JNZ JNZ HANDLE_NACK ; Handle Handle if if NACK NACK...Else, handle handle ACK ACK After address/data transmission SDA = input Receive 1 data bit: 0 = Ack, 1 = NAck 2006 Texas Instruments Inc, Slide 18

USI I 2 C Master TX Slave RX CPU Active CPU Active SCL SCL SDA SDA 1: Send Start, Address & R/W bit 2: Receive (N)Ack 3: Test (N)Ack & handle TX data 4: Receive (N)Ack 5: Test (N)Ack & prep Stop 6: Send Stop 1: Detect Start & receive address + R/W 2: Transmit (N)Ack 3: Data RX 4: Transmit (N)Ack 5: Reset for next Start 2006 Texas Instruments Inc, Slide 19

Typical USI I 2 C CPU Loading SCL = 125kHz SCL = 500kHz CPU Freq 1MHz 8MHz 16MHz 1MHz 8MHz 16MHz USI Master CPU Loading 63% 18% 11% 87% 43% 28% USI Slave CPU Loading 73% 23% 12% 90% 53% 30% 1 byte TX d & 1 byte RX d: MST to SLV Dependent on S/W protocol details 125 & 500kHz used as simple example 2006 Texas Instruments Inc, Slide 20

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What module for what purpose 2006 Texas Instruments Inc, Slide 21

USCI Features Overview Two independent communication blocks Asynchronous communication modes UART standard and multiprocessor protocols UART with automatic Baud rate detection (LIN support) IrDA (SIR - slow Infrared, up to 115kBaud) LPMx wake up Synchronous communication modes SPI (Master & Slave modes, 3 & 4 wire) I2C (Master & Slave modes) LPMx operation DMA enabled Interrupt driven 2006 Texas Instruments Inc, Slide 22

USCI_A UART with IrDA/LIN support or SPI Baud-rate generator with auto-baud rate detect Double buffered TX/RX USCI_B I2C master/slave up to 400kHz or SPI Bit clock generator Double buffered TX/RX 2006 Texas Instruments Inc, Slide 23

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What module for what purpose 2006 Texas Instruments Inc, Slide 24

USCI_A UART Mode Ultra-low power Flexible 7- or 8-bit data Odd, even or non-parity LSB or MSB first Glitch suppression Communication Schemes IrDA Idle Line Multi-processor Address Bit Multi-processor Auto baud (S/W LIN) Interrupt Driven Error detection TX/RX 2006 Texas Instruments Inc, Slide 25

UART Baud Rate Generator Low power, low frequency mode Allows use of slower clocks n/8 modulator Max baud rate 1/3 BRCLK 16x over-sampling mode Quasi-standard for UART, LIN, IrDA n/16 modulator Max baud rate 1/16 BRCLK Flexible clock sources External UCA0CLK input ACLK SMCLK 2006 Texas Instruments Inc, Slide 26

UART Ultra-low Power Operation Wake-up from LPMx RX start edge or writing to TXBUF automatically turns on the internal BRCLK source if turned off by LPMx BRCLK source off after end of TX or RX in LPMx No software handling required Instant-on DCO clock prevents loss of received char. SMCLK can support high baud rates in LPM3 mode! 2006 Texas Instruments Inc, Slide 27

UART Automatic Baud Rate Detect Automatic baud rate detection protocol Baud rate calculated from a valid SYNC Auto baud rate value stored in BR1, BR0 & modulator bits BREAK time-out detect in hardware Programmable delimiter time 2006 Texas Instruments Inc, Slide 28

UART LIN Support Local Interconnect Network is used in automotive UART automatic baud rate detect required LIN mode UART = 8-bits, LSB first, no parity, 1 stop LIN device driver is implemented in software External LIN bus line drivers required LIN slave mode support Break synch detection and automatic baud rate measurement is based on received LIN break and synch field 0x55 2006 Texas Instruments Inc, Slide 29

LIN Master Support LIN Master mode support Automatic break-synch generation S/W sequence transmits a break synch field required for LIN master mode 1. Select auto baud rate detect mode & UCTXBRK = 1 2. Specify break delimiter bit length with DELIMx, default = 1 bit period 3. Check if TXBUF ready & write LIN synch 0x55h to TXBUF Break field of 13 bits followed by a break delimiter & the synch field are transmitted UCTXBRK is reset automatically after the synch loads into TX shift register Further data written to TXBUF is transmitted normally 2006 Texas Instruments Inc, Slide 30

UART IrDA Support Integrated IrDA encoder & decoder Directly connects to external IR analog Programmable digital filter stage for receive pulse filtering Programmable pulse length IrDA standard 3/16 bit period pulse supported IrDA protocol stack implemented in S/W UART TX UART CLK RX IR Transmit Formatter IR Receive Decoder 2006 Texas Instruments Inc, Slide 31

USCI_A & USCI_B SPI Mode Flexible interface 3- or 4-pin SPI 7- or 8-bit data length Master or slave LSB or MSB first S/W configurable clock phase & polarity Programmable SPI master clock Double buffered TX/RX Interrupt driven TX/RX DMA enabled LPMx operation BRCLK RXBUF Receive Shift Register Master Bit Clock Generator 16-Bit Prescaler BR1,BR0 Transmit Shift Register TXBUF Slave Slave SOMI CLK SIMO 2006 Texas Instruments Inc, Slide 32

SPI Connectivity 3 wire mode supports master & slave modes 4 wire master STE senses conflicts other master(s) In 4 wire slave, TX & RX are controlled externally using the STE 2006 Texas Instruments Inc, Slide 33

USCI_B I 2 C Mode Ultra-low power LPMx slave receiver START detect Slave operation in LPM4 Flexible clock choice Integrated bit clock generator Philips specification v2.1 7- & 10-bit address Multi-master support Slave mode Up to 400kbps Interrupt driven No acknowledgement Arbitration lost Start/Stop condition TX/RX 2006 Texas Instruments Inc, Slide 34

USCI I2C Master Receiver UCB0CTL1 UCB0CTL1 = = UCSWRST; UCSWRST; // // Enable Enable SW SW reset reset UCB0CTL0 UCB0CTL0 = UCMST UCMST + UCMODE_3 UCMODE_3 + UCSYNC; UCSYNC; // // I2C I2C Master Master UCB0CTL1 UCB0CTL1 = UCSSEL_2 UCSSEL_2 + UCSWRST; UCSWRST; // // Use Use SMCLK, SMCLK, SW SW reset reset UCB0BR0 UCB0BR0 = 12; 12; UCB0BR1 UCB0BR1 = 0; 0; // // fscl=smclk/12=~100khz UCB0I2CSA UCB0I2CSA = 0x4e; 0x4e; // // Set Set slave slave address address UCB0CTL1 UCB0CTL1 &= &= ~UCSWRST; ~UCSWRST; // // Clear Clear SW SW reset reset IE2 IE2 = = UCB0RXIE; UCB0RXIE; // // Enable Enable RX RX interrupt interrupt RxByteCtr RxByteCtr = 2; 2; // // Load Load RX RX byte byte counter counter UCB0CTL1 UCB0CTL1 = = UCTXSTT; UCTXSTT; // // I2C I2C start start condition condition bis_sr_register(cpuoff + GIE); GIE); // // Enter Enter LPM0 LPM0 until until // // all all data data is is RX'd RX'd interrupt interrupt void void USCIAB0TX_ISR(void) { RxByteCtr--; RxByteCtr--; // // Decrement Decrement RX RX byte byte ctr ctr if if (RxByteCtr) (RxByteCtr) { RxByte RxByte = UCB0RXBUF; UCB0RXBUF; // // Get Get received received byte byte if if (RxByteCtr (RxByteCtr == == 1) 1) // // Only Only one one byte byte left? left? UCB0CTL1 UCB0CTL1 = = UCTXSTP; UCTXSTP; } // // I2C I2C stop stop condition condition else else { RxByte RxByte = UCB0RXBUF; UCB0RXBUF; // // Get Get final final RX RX byte byte bic_sr_register_on_exit(cpuoff); // // Exit Exit LPM0 LPM0 } } 2006 Texas Instruments Inc, Slide 35

USCI I2C Slave Transmitter UCB0CTL1 UCB0CTL1 = = UCSWRST; UCSWRST; // // Enable Enable SW SW reset reset UCB0CTL0 UCB0CTL0 = UCMODE_3 UCMODE_3 + UCSYNC; UCSYNC; // // I2C I2C Slave Slave UCB0I2COA UCB0I2COA = 0x48; 0x48; // // Own Own Address Address is is 048h 048h UCB0CTL1 UCB0CTL1 &= &= ~UCSWRST; ~UCSWRST; // // Clear Clear SW SW reset reset UCB0I2CIE UCB0I2CIE = = UCSTTIE; UCSTTIE; // // Enable Enable STT STT interrupt interrupt IE2 IE2 = = UCB0TXIE; UCB0TXIE; // // Enable Enable TX TX interrupt interrupt TXData TXData = 0xff; 0xff; // // Used Used to to hold hold TX TX data data bis_sr_register(cpuoff + GIE); GIE); // // Enter Enter LPM0 LPM0 interrupt interrupt void void USCIAB0TX_ISR(void) { UCB0TXBUF UCB0TXBUF = TXData; TXData; // // TX TX data data } interrupt interrupt void void USCIAB0RX_ISR(void) { UCB0STAT UCB0STAT &= &= ~UCSTTIFG; ~UCSTTIFG; // // Clear Clear start start cond. cond. int int flag flag TXData++; TXData++; // // Increment Increment data data } 2006 Texas Instruments Inc, Slide 36

USCI Interrupts USCI_A & USCI_B share TX & RX interrupt vectors USCI_A flags UART TXIFG, RXIFG SPI TXIFG, RXIFG USCI_B flags SPI TXIFG, RXIFG I2C State ALIFG, NACKIFG, STTIFG, STPIFG I2C Data TXIFG, RXIFG USCI_Ax: UART/SPI mode UCAxRXIFG USCI_Bx: SPI mode UCBxRXIFG USCI_Bx:I2C mode UCALIFG,UCNACKIFG UCSTTIFG,UCSTPIFG USCI_Ax: UART/SPI mode UCAxTXIFG USCI_Bx: SPI mode UCBxTXIFG USCI_Ax/USCI_Bx RX Vector USCI_Ax/USCI_Bx TX Vector USCI_Bx: I2C mode UCBxRXIFG,UCBxTXIFG 2006 Texas Instruments Inc, Slide 37

USCI SPI interrupts handling TX & RX ISR recommended flow USCI_A & USCI_B share TX vector & RX vector Software check detects the correct ISR handle 2006 Texas Instruments Inc, Slide 38

USCI I 2 C Interrupt Handling 2006 Texas Instruments Inc, Slide 39

Why Doesn't the USCI Work? SetupUSCIA mov.b mov.b #UCSWRST,&UCA0CTL1 ; module module reset reset bis.b bis.b #UCSSEL1,&UCA0CTL1 ; BRCLK=SMCLK mov.b mov.b #0x09,&UCA0BR0 ; 115k 115k at at 1048576Hz mov.b mov.b #0x00,&UCA0BR1 ; mov.b mov.b #0x08,&UCA0MCTL ; modulation values values bic.b bic.b #UCSWRST, &UCA0CTL1 ; clear clear module module reset reset bis.b bis.b #UCA0RXIE, &IE2 &IE2 ; enable enable RXinterrupt Proper USCI_A Configuration Procedure 1. Set SWRST 2. Configure USCI registers 3. Clear SWRST 4. Enable interrupts if desired 2006 Texas Instruments Inc, Slide 40

Agenda USCI vs. USI Introduction to USI USI communication modes Introduction to USCI USCI communication modes What bus for what purpose 2006 Texas Instruments Inc, Slide 41

USI System Benefits USI provides SPI & I2C support in hardware Protocol in user S/W: Timing in USI H/W SPI: up to 16MHz clocking & 16-bit data I/O I2C: interrupt-driven protocol, critical timing in H/W Provides flexibility of 100% S/W solution while maintaining timing in hardware Better than pure software implementations Faster communication speeds Lower CPU loading Smaller software USCI System Benefits Two independent blocks can operate simultaneously All modes capable of operating from any LPMx USCI is interrupt driven USCI is DMA enabled USCI_A supports SPI, UART, IrDA, auto-baud, LIN Bus USCI_A has integrated baud rate generator with modulator for fractional bit rate division support USCI_B supports SPI, I2C 2006 Texas Instruments Inc, Slide 42

Summary New devices typically implement either USI or USCI USI provides very basic communication means Timing in hardware, protocol in software In low-pin 2xx devices USCI provides complete feature in hardware High-end communication module In high-end 2xx and 4xx devices 2006 Texas Instruments Inc, Slide 43

IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Amplifiers amplifier.ti.com Audio www.ti.com/audio Data Converters dataconverter.ti.com Automotive www.ti.com/automotive DSP dsp.ti.com Broadband www.ti.com/broadband Interface interface.ti.com Digital Control www.ti.com/digitalcontrol Logic logic.ti.com Military www.ti.com/military Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork Microcontrollers microcontroller.ti.com Security www.ti.com/security RFID www.ti-rfid.com Telephony www.ti.com/telephony Low Power www.ti.com/lpw Video & Imaging www.ti.com/video Wireless Wireless www.ti.com/wireless Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright 2007, Texas Instruments Incorporated