Home
Spring 2013 Lecture #18: Introduction to Serial Interfaces Reading
Contents
1. 1 are used for SPI UCLK SOMI and SIMO P3SEL BIT3 BIT2 BIT1 set bits to Function mode UOCTL CHAR SYNC MM USARTO module control CHAR 1 gt 8 bit data SYNC 1 gt SPI mode MM 1 gt master mode UOTCTL SSELO SSEL1 STC CKPL USARTO xmit control SSELO 1 amp SSEL1 1 use SMCLK for baud rate gen STC 1 gt 3 pin SPI mode CKPL 1 set Clock polarity UOBRO 0x02 Divide SMCLK by 4 gt SCLK 262KHz UOBR1 0x00 a reasonable CLK value for temp sensor UOMCTL 0x00 Modulation control not used Ensure all these bits are reset to 0 UOTXBUF 0x00 Clear the transmit buffer Then programmer must 4 Select peripheral using its chip select CS First what is the function of a CS gt gt Likely to be multiple peripherals using SPI bus gt gt Only 1 Slave device and Master MSP430 can use SPI bus at a time gt gt CS is typically ACTIVE LOW digital signal CS 0 Device is Enabled will read and write to SPI data lines CS 1 Device is Disabled outputs are high impedence gt gt On our lab boards the MSP430 Interface Board has 2 peripherals that are SPI devices the external temperature sensor and the digital to analog converter Configuring the CS for the External Temperature Sensor gt Check schematic to see how the temperature sensor s CS is connected 3 3 V MSP43 F 449 P3 3 P3 2 Configure a Chip Sel
2. ECE2049 Embedded Computing in Engineering Design C Term Spring 2013 Lecture 18 Introduction to Serial Interfaces Reading for Today Articles User s Manual Ch 15 Reading for Next Class User s Manual Ch 15 External Temp Sensor information Lab 3 on web Report due 2 19 2013 HW 5 coming soon Due Thursday 2 28 2013 Lab 4 on web Due Friday 3 1 2013 by 4 pm to box in ECE office Serial Interfaces USART and SPI Parallel Interfaces Each bit has its own electrical connection interconnect trace wire gt gt Advantages Fast easier to synchronize 1 clock edge transfers all bits together gt gt Used almost exclusively inside a CPU or other chip gt gt Disadvantage Each bit must have its own electrical connection Serial Interfaces Bits sent one after another along a single connection gt gt Used almost exclusively to make connections off chip and off computer through the Internet out to the Mars Rover etc gt gt Advantages Simpler fewer connections between CPU and peripheral 2 4 lines Device Select CS Sychronizing CLK SCLK Data Line s SDI and SDO Common ground GND gt gt Connection PCB trace wire RF acoustic optical etc gt gt Disadvantages Slower more complicated synchronization potential timing issues Universal Synchronous Asynchronous Receive Transmitter USART gt gt Basically acts as a parallel to serial and serial to parallel conv
3. bit period Table 14 2 Commonily Used Baud Rates Baud Rate Data and Errors A BRCLK 32 768 Hz B BRCLK 1 048 576 Hz Max yehe UxBRt UxBRO UxMCTL enor enor Ener UxBR1 UxBRO UxMCTL Emer o zajma o f mef e f af meal oz os ee f ee T ona Example How long would it take to transmit C TERM IS HALF OVER at 9600 baud with 1 start bit 1 stop bit and even parity assume 8 bit ASCII encoding Serial Peripheral Interface Bus SPI gt gt Used primarily for synchronous serial comms between a CPU and peripherals within the box Synchronous shared clock supplied by Master gt gt Usually a 4 wire connection some times 3 wire SIMO Slave In Master Out data line SOMI Slave Out Master In data SCLK Serial Clock UCLK in MSP430 USART documentation CS Chip Select gt gt SPI Loose standard close to Microwire but not quite gt Different from I C How will you know what to use gt SPI C asynchronous serial RS 232 other Sensors or other peripheral devices will specify the interfaces with which they are compatible gt MSP430F449 does not support I C gt gt To use SPI the programmer must 1 Enable USART for SPI mode gt Including SELecting data and clock pins for Function mode 2 Select data format 3 Setup synchronous clock void setupSPI void ME1 USPIEO Enable USARTO SPI mode UOCTL amp SWRST Make sure SW RESET bit is off Bits 3 2 amp
4. ect signal active low for temp sensor define tempCs 0x10 Temp sensor Chip Select on Pin 4 P1SEL amp tempCS Select P1 4 digital IO for TC77 CS but leave other bits alone P1DIR tempCS Set CS bit as an output P10UT tempCS De assert CS set CS 1
5. erter gt gt Most modern microprocessors microcontrollers will have built in USART MSP430F449 has two gt gt Role of USART has grown with growing sophistication and speed of serial interfaces SPI and C to USB and others gt gt MSP430F449 USARTs have 2 modes UART and SPI UART Mode User s Guide Ch 14 gt gt UART mode configures basic 2 wire asynchronous serial comms gt gt 2 external pins URXD and UTXD gt gt Not synchronous no shared clock Asynchronous gt gt To use serial communications both devices must know data format and baud rate These are set using USARTs control registers Implies make data format amp baud rate decisions at design time Data Formats Serial Communications Start Bit 1 bit low Data Bits 7 or 8 bits Parity Even Odd or None gt gt Even Parity 1 when number of 1 s including parity is even gt gt Odd Parity 1 when number of 1 s including parity is odd Stop bit s 1 or 2 bits high RS 232 Old standby for serial format gt Data sent Least Significant Bit LSB first Typical Baud Rates and Errors Standard baud rate frequency data for UxBRx and UxMCTL are listed in Table 14 2 for a 32 768 Hz watch crystal ACLK and a typical 1 048 576 Hz SMCLK The receive error is the accumulated time versus the ideal scanning time in the middle of each bit The transmit error is the accumulated timing error versus the ideal time of the
Download Pdf Manuals
Related Search
Related Contents
CB 600 Hornet Manual 2006 A POOL TECH3 fd - Piscine et Loisirs Dataram 8GB DDR3-1600 メーカー資料 Manuel d`utilisation/installation Operating Instructions PTB 01 ATEX 2064 U Example ECON LD SERIES Sony XS-LB12S Instruction Guide Prosignia Desktop 325シリーズ 製品仕様 Samsung SC4130 Manual de utilizare Copyright © All rights reserved.
Failed to retrieve file