Presentation is loading. Please wait.

Presentation is loading. Please wait.

UBI >> Contents Lecture 7 Communications Introduction & USCI Module UART mode MSP430 Teaching Materials Texas Instruments Incorporated University of Beira.

Similar presentations


Presentation on theme: "UBI >> Contents Lecture 7 Communications Introduction & USCI Module UART mode MSP430 Teaching Materials Texas Instruments Incorporated University of Beira."— Presentation transcript:

1 UBI >> Contents Lecture 7 Communications Introduction & USCI Module UART mode MSP430 Teaching Materials 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 www.msp430.ubi.pt Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt

2 UBI >> Contents 2 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Contents  Communication Introduction Communication Introduction  Communications system model Communications system model  Transmission mode Transmission mode  Serial communications Serial communications  Synchronous and asynchronous serial communications Synchronous and asynchronous serial communications  MSP430 communications interfaces MSP430 communications interfaces  USCI module introduction USCI module introduction  USCI operation: UART mode USCI operation: UART mode  USCI registers USCI registers

3 UBI >> Contents 3 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 4 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 5 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Communications system model (2/2)  Devices participating in a digital communication system:  DTE: Data Terminal Equipment;  DCE: Data Communications Equipment.

6 UBI >> Contents 6 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 7 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Transmission mode (2/5)  Parallel communications:  Example: Character ASCII “W” parallel transmission. Information flow

8 UBI >> Contents 8 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 9 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Transmission mode (4/5)  Serial communications:  Example: Character ASCII “W” serial transmission:

10 UBI >> Contents 10 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Transmission mode (5/5)  Advantages and disadvantages of parallel and serial communication: CharacteristicParallelSerial Bus lineOne line per bitOne line Sequence All bits of one word simultaneously Sequence of bits Transmission rate HighLow Bus lengthShort distancesShort and long distances CostHighLow Critical characteristics Synchronisation between the different bits is demanding Asynchronous transmission needs start and stop bits Synchronous transmission needs some other synchronisation

11 UBI >> Contents 11 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 12 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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.

13 UBI >> Contents 13 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 14 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 15 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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 UBI >> Contents 16 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 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).

17 UBI >> Contents 17 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt MSP430 communications interfaces (2/2)  Comparison between the communication modules: USARTUSCIUSI UART: - Only one modulator - n/a UART: - Two modulators support n/16 timings - Auto baud rate detection - IrDA encoder & decoder - Simultaneous USCI_A and USCI_B (2 channels) SPI: - Only one SPI available - Master and Slave Modes - 3 and 4 Wire Modes SPI: - Two SPI (one on each USCI_A and USCI_B) - Master and Slave Modes - 3 and 4 Wire Modes SPI: - Only one SPI available - Master and Slave Modes I 2 C: (on ‘15x/’16x only) - Master and Slave Modes - up to 400kbps I 2 C: - Simplified interrupt usage - Master and Slave Modes - up to 400kbps I 2 C: - SW state machine needed - Master and Slave Modes

18 UBI >> Contents 18 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI module introduction (1/3)  Although supporting UART, SPI and I 2 C, 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 for low-cost modules in cars e.g. door modules, alarms, rain-sensors;  IrDA (Infrared Data Association).  The USCI module is available in the following devices: MSP430F5xx; MSP430F4xx and MSP430FG41xx; MSP430F2xx.

19 UBI >> Contents 19 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI module introduction (2/3)  The USCI module supports:  Low power operating modes (with auto-start);  Two individual blocks: USCI_A: UART and SPI; USCI_B: SPI and I 2 C.  Double buffered TX/RX;  Baud rate/bit clock generator: With auto-baud rate detect; Flexible clock source.  RX glitch suppression;  DMA enabled;  Error detection.

20 UBI >> Contents 20 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI module introduction (3/3)  USCI block diagram:

21 UBI >> Contents 21 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (1/17)  In asynchronous mode, the USCI_Ax modules connect 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;

22 UBI >> Contents 22 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (2/17)  USCI operation in UART mode block diagram:

23 UBI >> Contents 23 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (3/17)  Recommended initialization/re-configuration process:  Set UCSWRST (BIS.B #UCSWRST,&UCAxCTL1); Initialize all USCI registers with UCSWRST = 1 (including UCAxCTL1);  Configure ports;  Clear UCSWRST via software: (BIC.B #UCSWRST,&UCAxCTL1);  Enable interrupts (optional) via UCAxRXIE and/or UCAxTXIE.

24 UBI >> Contents 24 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (4/17)  Character format specified as follows:  Start bit;  Seven or eight data bits;  Even/odd/no parity bit;  Address bit (address-bit mode);  One or two stop bits.  The UCMSB bit controls the direction of the transfer and selects LSB (usual in UART communication) or MSB first.

25 UBI >> Contents 25 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (5/17)  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; Can be programmed to receive only address characters.

26 UBI >> Contents 26 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (6/17)  Asynchronous communication formats (continued):  Address-bit multiprocessor communication protocol (minimum of three devices): An extra bit in the received character marks an address character; UART can be programmed to receive only address characters.

27 UBI >> Contents 27 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (7/17)  Automatic baud rate detection (UCMODEx = 11):  Data frame is preceded by a synchronization sequence: Break: Detected when 11 or more continuous zeros (spaces) are received; Synch field: Data 055h inside a byte field.

28 UBI >> Contents 28 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (8/17)  Automatic baud rate detection (UCMODEx = 11):  The baud rate is calculated from a valid SYNC;  Auto baud rate value stored in UxBR1, UxBR0 and UxMCTL (modulation pattern);  BREAK time-out detect in hardware;  Programmable delimiter time;

29 UBI >> Contents 29 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (9/17)  IrDA encoder and decoder (UCIREN = 1):

30 UBI >> Contents 30 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (10/17)  IrDA encoder and decoder (UCIREN = 1):  IrDA encoding: Encoder sends a pulse for every zero bit in the transmit bit stream coming from the UART; Pulse duration (defined by UCIRTXPLx bits) specifies the number of half clock periods of the clock (UCIRTXCLK); Oversampling baud rate generator allows selection of IrDA standard 3/16 bit length.

31 UBI >> Contents 31 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (11/17)  IrDA encoder and decoder (UCIREN = 1):  IrDA decoding:  Programmable low or high pulse detection (UCIRRXPL) by the decoder;  Programmable received pulse length filter adds noise filter capability as well as glitch detection.

32 UBI >> Contents 32 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (12/17)  Automatic error detection:  Glitch suppression prevents the USCI from being accidentally started;  Any pulse on UCAxRXD shorter than the deglitch time (approximately 150 ns) will be ignored.  Framing error UCFE: Set if the stop bit is missing from a received frame;  Parity error UCPE: Set if there is a parity mismatch in a received frame;  Receive overrun error UCOE: Set if UCAxRXBUF is overwritten;  Break condition UCBRK: Set if all bits in the received frame = 0; Set the UCAxRXIFG if UCBRKIE bit is set.

33 UBI >> Contents 33 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (13/17)  Enable the USCI receive enable bit URXEx:  Clear UCSWRST;  The falling edge of the start bit enables the baud rate generator;  If a valid start bit is detected, a character will be received.  USCI transmit enable:  Clear UCSWRST;  Transmission is initiated by writing data to UCAxTXBUF;  The baud rate generator is enabled;  The data value in UCAxTXBUF is moved to the transmit shift register on the next BITCLK after the transmit shift register is empty;  UCAxTXIFG is set when a new data value can be written into UCAxTXBUF.

34 UBI >> Contents  USCI baud rate generation:  Standard baud rates from non-standard source frequencies;  Two modes of operation (UCOS16 bit): Low-frequency baud rate; Oversampling baud rate. 34 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (14/17)

35 UBI >> Contents 35 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (15/17)  Transmit bit timing:  The timing for each character is the sum of the individual bit timings;  A modulation feature of the baud rate generator reduces the cumulative bit error.  Two error sources for receive bit timing:  Bit-to-bit timing error;  Error between a start edge occurring and the start edge being accepted by the USCI module.

36 UBI >> Contents 36 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (16/17)  USCI interrupts:  One interrupt vector for transmission and one interrupt vector for reception:  USCI transmit interrupt operation: UCAxTXIFG interrupt flag is set by the transmitter to indicate that UCAxTXBUF is ready to accept another character; An interrupt request is generated if UCAxTXIE and GIE are also set; UCAxTXIFG is automatically reset if a character is written to UCAxTXBUF.

37 UBI >> Contents 37 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI operation: UART mode (17/17)  USCI interrupts (continued):  USCI receive interrupt operation: UCAxRXIFG interrupt flag is set each time a character is received and loaded into UCAxRXBUF; An interrupt request is also generated if UCAxRXIE and GIE are set; UCAxRXIFG and UCAxRXIE are reset by a system reset PUC signal or when UCSWRST = 1; UCAxRXIFG is automatically reset when UCAxRXBUF is read.

38 UBI >> Contents 38 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (1/17)  UCAxCTL0, USCI_Ax Control Register 0 (UART, SPI)  UCBxCTL0, USCI_Bx Control Register 0 (SPI, I 2 C) Mode76543210 UART UCPENUCPARUCMSBUC7BITUCSPBUCMODExUCSYNC=0 SPI UCCKPHUCCKPLUCMSBUC7BITUCMSTUCMODExUCSYNC=1 I2C UCA10UCSLA10UCMMUnusedUCMSTUCMODEx=11UCSYNC=1 BitUART mode descriptionSPI mode descriptionI 2 C mode description 7UCPENParity enable when UCPEN = 1 UCCKPHClock phase select: UCCKPH = 0  Data is changed on the 1st UCLK edge and captured on the next one. UCCKPH = 1  Data is captured on the 1st UCLK edge and changed on the next one. UCA10Own addressing mode select: UCA10= 0  7-bit address UCA10= 1  10-bit address 6UCPARParity select: UCPAR = 0  Odd parity UCPAR = 1  Even parity UCCKPLClock polarity select. UCCKPL = 0  Inactive state: low. UCCKPL = 1  Inactive state: high. UCSLA10Slave addressing mode select: UCSLA10= 0  7-bit address UCSLA10= 1  10-bit address 5UCMSBMSB first select: UCMSB = 0  LSB first UCMSB = 1  MSB first UCMSBAs UART modeUCMMMulti-master environment select: UCMM= 0  Single master UCMM= 1  Multi master

39 UBI >> Contents 39 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (2/17)  UCAxCTL0, USCI_Ax Control Register 0 (UART, SPI)  UCBxCTL0, USCI_Bx Control Register 0 (SPI, I 2 C) Mode76543210 UART UCPENUCPARUCMSBUC7BITUCSPBUCMODExUCSYNC=0 SPI UCCKPHUCCKPLUCMSBUC7BITUCMSTUCMODExUCSYNC=1 I2CI2C UCA10UCSLA10UCMMUnusedUCMSTUCMODEx=11UCSYNC=1 BitUART mode descriptionSPI mode descriptionI 2 C mode description 4UC7BITCharacter length: = 0  8-bit data = 1  7-bit data UC7BITAs UART modeUnused 3UCSPBStop bit select: = 0  One stop bit = 1  Two stop bits UCMSTMaster mode: = 0  USART is slave = 1  USART is master UCMSTMaster mode select. = 0  Slave mode = 1  Master mode 2-1UCMODExUSCI asynchronous mode: = 00  UART = 01  Idle-Line Multiproc. = 10  Address-Bit Multiproc. = 11  UART with ABR. UCMODExUSCI synchronous mode: = 00  3-Pin SPI = 01  4-Pin SPI (slave enabled when UCxSTE=1) = 10  4-Pin SPI (slave enabled when UCxSTE=0) = 11  I 2 C UCMODEx=11USCI Mode: = 00  3-Pin SPI = 01  4-Pin SPI (master/slave enabled if STE = 1) = 10  4-Pin SPI (master/slave enabled if STE = 0) = 11  I 2 C 0UCSYNC=0Synchronous mode enable: = 0  Asynchronous = 1  Synchronous UCSYNC=1As UART modeUCSYNC=1As UART mode

40 UBI >> Contents 40 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (3/17)  UCAxCTL1, USCI_Ax Control Register 1 (UART, SPI)  UCBxCTL1, USCI_Bx Control Register 1 (SPI, I 2 C) Mode76543210 UARTUCSSELxUCRXEIEUCBRKIEUCDORMUCTXADDRUCTXBRKUCSWRST SPIUCSSELxUnused UCSWRST I2CI2CUCSSELxUnusedUCTRUCTXNACKUCTXSTPUCTXSTTUCSWRST BitUART mode descriptionSPI mode descriptionI 2 C mode description 7-6UCSSELxBRCLK source clock: = 00  UCLK = 01  ACLK = 10  SMCLK = 11  SMCLK UCSSELxBRCLK source clock: = 00  N/A = 01  ACLK = 10  SMCLK = 11  SMCLK UCSSELxBRCLK source clock: = 00  UCLKI = 01  ACLK = 10  SMCLK = 11  SMCLK 5UCRXEIEReceive erroneous-character IE: = 0  Rejected (UCAxRXIFG not set) = 1  Received (UCAxRXIFG set) Unused 4UCBRKIEReceive break character IE: = 0  Not set UCAxRXIFG. = 1  Set UCAxRXIFG. UnusedUCTRTransmitter/Receiver select: = 0  Receiver = 1  Transmitter

41 UBI >> Contents 41 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (4/17)  UCAxCTL1, USCI_Ax Control Register 1 (UART, SPI)  UCBxCTL1, USCI_Bx Control Register 1 (SPI, I 2 C) Mode76543210 UARTUCSSELxUCRXEIEUCBRKIEUCDORMUCTXADDRUCTXBRKUCSWRST SPIUCSSELxUnused UCSWRST I2CI2CUCSSELxUnusedUCTRUCTXNACKUCTXSTPUCTXSTTUCSWRST BitUART mode descriptionSPI mode description I 2 C mode description 3UCDORMDormant. Puts USCI into sleep mode: = 0  Not dormant = 1  Dormant UnusedUCTXNACKTransmit a NACK: = 0  Acknowledge normally = 1  Generate NACK 2UCTXADDRTransmit address: = 0  Next frame transmitted is data = 1  Next frame transmitted is address UnusedUCTXSTPTransmit STOP condition in master mode: = 0  No STOP generated = 1  Generate STOP 1UCTXBRKTransmit break: = 0  Next frame transmitted is not a break = 1  Next frame transmitted is a break or a break/synch UnusedUCTXSTTTransmit START condition in master mode: = 0  No START generated = 1  Generate START 0UCSWRSTSoftware reset enable =0  Disabled. USCI reset released for operation 1  Enabled. USCI logic held in reset state UCSWRSTAs UART modeUCSWRSTAs UART mode

42 UBI >> Contents 42 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (5/17)  UCAxBR0, USCI_Ax Baud Rate Control Register 0 (UART, SPI)  UCBxBR0, USCI_Bx Bit Rate Control Register 0 (SPI, I 2 C)  UCAxBR1, USCI_Ax Baud Rate Control Register 1 (UART, SPI)  UCBxBR1, USCI_Bx Bit Rate Control Register 1 (SPI, I 2 C) Mode76543210 UART / SPI / I 2 C UCBRx – low byte Mode76543210 UART / SPI / I 2 C UCBRx – high byte BitUART mode descriptionSPI mode descriptionI 2 C mode description 7-6UCBRxClock prescaler setting of the baud rate generator: Prescaler value (16-bit value) = {UCAxBR0+UCAxBR1x256} UCBRxBit clock prescaler setting: Prescaler value (16-bit value) = {UCAxBR0+UCAxBR1×256} UCBRxAs SPI mode

43 UBI >> Contents 43 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (6/17)  UCAxSTAT, USCI_Ax Status Register (UART, SPI)  UCBxSTAT, USCI_Bx Status Register (SPI, I 2 C) Mode76543210 UARTUCLISTENUCFEUCOEUCPEUCBRKUCRXERR UCADDR UCIDLE UCBUSY SPIUCLISTENUCFEUCOEUnused UCBUSY I2CI2CUnusedUCSCLLOWUCGCUCBBUSYUCNACKIFGUCSTPIFGUCSTTIFGUCALIFG BitUART mode descriptionSPI mode descriptionI 2 C mode description 7UCLISTENListen enable: = 0  Disabled = 1  UCAxTXD is internally fed back to receiver UCLISTENListen enable: = 0  Disabled = 1  The transmitter output is internally fed back to receiver Unused 6UCFEFraming error flag: = 0  No error = 1  Character with low stop bit UCFEFraming error flag: = 0  No error = 1  Bus conflict (4w master) UCSCLLOWSCL low: = 0  SCL is not held low = 1  SCL is held low 5UCOEOverrun error flag: = 0  No error = 1  Overrun error UCOEAs UART modeUCGCGeneral call address received: = 0  No general call address = 1  General call address

44 UBI >> Contents 44 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (7/17)  UCAxSTAT, USCI_Ax Status Register (UART, SPI)  UCBxSTAT, USCI_Bx Status Register (SPI, I 2 C) Mode76543210 UARTUCLISTENUCFEUCOEUCPEUCBRKUCRXERR UCADDR UCIDLE UCBUSY SPIUCLISTENUCFEUCOEUnused UCBUSY I2CI2CUnusedUCSCLLOWUCGCUCBBUSYUCNACKIFGUCSTPIFGUCSTTIFGUCALIFG BitUART mode descriptionSPI mode descriptionI 2 C mode description 4UCPEParity error flag: = 0  No error = 1  Character with parity error UnusedUCBBUSYBus busy: = 0  Bus inactive = 1  Bus busy 3UCBRKBreak detect flag: = 0  No break condition = 1  Break condition occurred UnusedUCNACKIFGNACK received interrupt flag: = 0  No interrupt pending = 1  Interrupt pending 2UCRXERRReceive error flag. = 0  No receive errors detected = 1  Receive error detected UnusedUCSTPIFGStop condition interrupt flag: = 0  No interrupt pending = 1  Interrupt pending 1UCADDR UCIDLE Address-bit multiproc. mode: = 0  Received character is data = 1  Received character is an address Idle-line multiproc. mode: = 0  No idle line detected = 1  Idle line detected UnusedUCSTTIFGStart condition interrupt flag: = 0  No interrupt pending = 1  Interrupt pending 0UCBUSYUSCI busy: = 0  USCI inactive = 1  USCI transmit/receive UCBUSYUCALIFGArbitration lost interrupt flag: = 0  No interrupt pending = 1  Interrupt pending

45 UBI >> Contents 45 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (8/17)  UCAxRXBUF, USCI_Ax Receive Buffer Register (UART, SPI)  UCBxRXBUF, USCI_Bx Receive Buffer Register (SPI, I 2 C) Mode76543210 UART / SPI / I 2 C UCRXBUFx BitUART mode description SPI mode description I 2 C mode description 7-0UCRXBUFxThe receive-data buffer is user accessible and contains the last received character from the receive shift register. Reading UCxRXBUF resets receive-error bits, UCADDR/UCIDLE bit and UCAxRXIFG. In 7-bit data mode, UCAxRXBUF is LSB justified and the MSB is always cleared. UCRXBUFxAs UART mode Reading UCxRXBUF resets the receive-error bits, and UCxRXIFG UCRXBUFxAs SPI mode

46 UBI >> Contents 46 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (9/17)  UCAxTXBUF, USCI_Ax Transmit Buffer Register (UART, SPI)  UCBxTXBUF, USCI_Bx Transmit Buffer Register (SPI, I 2 C) Mode76543210 UART / SPI / I 2 C UCTXBUFx BitUART mode description SPI mode description I 2 C mode description 7-0UCTXBUFxThe transmit data buffer is user accessible and holds the data waiting to be moved into the transmit shift register and transmitted on UCAxTXD. Writing to the transmit data buffer clears UCAxTXIFG. UCTXBUFxThe transmit data buffer is user accessible and holds the data waiting to be moved into the transmit shift register and transmitted. Writing to the transmit data buffer clears UCxTXIFG. UCTXBUFxAs SPI mode

47 UBI >> Contents 47 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (10/17)  IE2, Interrupt Enable Register 2 (UART, SPI, I 2 C) Mode76543210 UARTUCA0TXIEUCA0RXIE SPIUCB0TXIEUCB0RXIEUCA0TXIEUCA0RXIE I2CI2CUCB0TXIEUCB0RXIE BitUART mode description SPI mode description I 2 C mode description 3UCB0TXIEUSCI_B0 transmit interrupt enable: = 0  Disabled = 1  Enabled UCB0TXIEAs SPI mode 2UCB0RXIEUSCI_B0 receive interrupt enable: = 0  Disabled = 1  Enabled UCB0RXIEAs SPI mode 1UCA0TXIEUSCI_A0 transmit interrupt enable: = 0  Disabled = 1  Enabled UCA0TXIEAs UART mode 0UCA0RXIEUSCI_A0 receive interrupt enable: = 0  Disabled = 1  Enabled UCA0RXIEAs UART mode

48 UBI >> Contents 48 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (11/17)  IFG2, Interrupt Flag Register 2 (UART, SPI, I 2 C) Mode76543210 UARTUCA0TXIFGUCA0RXIFG SPIUCB0TXIFGUCB0RXIFGUCA0TXIFGUCA0RXIFG I2CI2CUCB0TXIFGUCB0RXIFG BitUART mode descriptionSPI mode descriptionI 2 C mode description 3UCB0TXIFGUSCI_B0 transmit interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCB0TXIFGAs SPI mode 2UCB0RXIFGUSCI_B0 receive interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCB0RXIFGAs SPI mode 1UCA0TXIFGUSCI_A0 transmit interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCA0TXIFGAs UART mode 0UCA0RXIFGUSCI_A0 receive interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCA0RXIFGAs UART mode

49 UBI >> Contents 49 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (12/17)  UC1IE, USCI_A1 Interrupt Enable Register (UART, SPI)  UC1IE, USCI_B1 Interrupt Enable Register (SPI, I 2 C) Mode76543210 UARTUnused UCA1TXIEUCA1RXIE SPIUnused UCB1TXIEUCB1RXIEUCA1TXIEUCA1RXIE I2CI2CUnused UCB1TXIEUCB1RXIE BitUART mode descriptionSPI mode descriptionI 2 C mode description 3UCB1TXIEUSCI_B1 transmit interrupt enable: UTXIE1 = 0  Disabled UTXIE1 = 1  Enabled UCB1TXIEAs SPI mode 2UCB1RXIEUSCI_B1 receive interrupt enable: URXIE1 = 0  Disabled URXIE1 = 1  Enabled UCB1RXIEAs SPI mode 1UCA1TXIEUSCI_A1 transmit interrupt enable: UTXIE1 = 0  Disabled UTXIE1 = 1  Enabled UCA1TXIEAs UART mode 0UCA1RXIEUSCI_A1 receive interrupt enable: URXIE1 = 0  Disabled URXIE1 = 1  Enabled UCA1RXIEAs UART mode

50 UBI >> Contents 50 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (13/17)  UC1IFG, USCI_A1 Interrupt Flag Register (UART, SPI)  UC1IFG, USCI_B1 Interrupt Flag Register (SPI, I 2 C) Mode76543210 UARTUCA1TXIFGUCA1RXIFG SPIUCB1TXIFGUCB1RXIFGUCA1TXIFGUCA1RXIFG I2CI2CUCB1TXIFGUCB1RXIFG BitUART mode descriptionSPI mode descriptionI 2 C mode description 3UCB1TXIFGUSCI_B1 transmit interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCB1TXIFGAs SPI mode 2UCB1RXIFGUSCI_B1 receive interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCB1RXIFGAs SPI mode 1UCA1TXIFGUSCI_A1 transmit interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCA1TXIFGAs UART mode 0UCA1RXIFGUSCI_A1 receive interrupt flag: = 0  No interrupt pending = 1  Interrupt pending UCA1RXIFGAs UART mode

51 UBI >> Contents 51 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (14/17)  UCAxMCTL, USCI_Ax Modulation Control Register (UART) 76543210 UCBRFxUCBRSxUCOS16 BitUART mode description 7-4UCBRFxFirst modulation pattern for BITCLK16 when UCOS16 = 1 (See Table 19-3 of the MSP430x4xx User’s Guide) 3-1UCBRSxSecond modulation pattern for BITCLK (See Table 19-2 of the MSP430x4xx User’s Guide) 0UCOS16Oversampling mode enabled when UCOS16 = 1

52 UBI >> Contents 52 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (15/17)  UCAxIRTCTL, USCI_Ax IrDA Transmit Control Register (UART) 76543210 UCIRTXPLxUCIRTXCLKUCIREN BitUART mode description 7-2UCIRTXPLxTransmit pulse length: t PULSE = (UCIRTXPLx + 1) / (2 x f IRTXCLK ) 1UCIRTXCLKIrDA transmit pulse clock select: UCIRTXCLK = 0  BRCLK UCIRTXCLK = 1  BITCLK16,when UCOS16 = 1  BRCLK,otherwise 0UCIRENIrDA encoder/decoder enable: UCIREN = 0  IrDA encoder/decoder disabled UCIREN = 1  IrDA encoder/decoder enabled

53 UBI >> Contents 53 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (16/17)  UCAxIRRCTL, USCI_Ax IrDA Receive Control Register (UART) 76543210 UCIRRXFLxUCIRRXPLUCIRRXFE BitUART mode description 7-2UCIRRXFLxReceive filter length (minimum pulse length): t MIN = (UCIRRXFLx + 4) / (2 × f IRTXCLK ) 1UCIRRXPLIrDA receive input UCAxRXD polarity. When a light pulse is seen: UCIRRXPL = 0  IrDA transceiver delivers a high pulse UCIRRXPL = 1  IrDA transceiver delivers a low pulse 0UCIRRXFEIrDA receive filter enabled: UCIRRXFE = 0  Disabled UCIRRXFE = 1  Enabled

54 UBI >> Contents 54 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt USCI registers (UART, SPI and I 2 C modes) (17/17)  UCAxABCTL, USCI_Ax Auto Baud Rate Control Register (UART) 76543210 ReservedUCDELIMxUCSTOEUCBTOEReservedUCABDEN BitUART mode description 5-4UCDELIMxBreak/synch delimiter length: UCDELIM1 UCDELIM0 = 00  1 bit time UCDELIM1 UCDELIM0 = 01  2 bit times UCDELIM1 UCDELIM0 = 10  3 bit times UCDELIM1 UCDELIM0 = 11  4 bit times 3UCSTOESynch field time out error: UCSTOE = 0  No error UCSTOE = 1  Length of synch field exceeded measurable time 2UCBTOEBreak time out error: UCBTOE = 0  No error UCBTOE = 1  Length of break field exceeded 22 bit times. 0UCABDENAutomatic baud rate detect enable: UCABDEN = 0  Baud rate detection disabled UCABDEN = 1  Baud rate detection enabled


Download ppt "UBI >> Contents Lecture 7 Communications Introduction & USCI Module UART mode MSP430 Teaching Materials Texas Instruments Incorporated University of Beira."

Similar presentations


Ads by Google