Serial Communication Buses

download Serial Communication Buses

of 16

description

communication buses

Transcript of Serial Communication Buses

  • Serial Communication Buses: I2C and SPIBy Brody Dunn

  • GoalsRevisit Readings of I2C and SPINot Insult YouRealize Level of UnderstandingTake Next StepImplementation

  • Inter-Integrated Circuit (I2C)2-Wire Serial Communication BusIntroduced By Philips In 1992Communication Protocol Between Microcontroller And PeripheralsReal Time Clocks (RTCs)Analog to Digital Converters (ADCs)Various SensorsMany, many, more

  • I2C CharacteristicsOnly 2 Wires Needed On BusSerial Data (SDA)Serial Clock (SCL)Multiple Devices Connected On BusTypically Limited (i.e. 8, 20, 27, 210,...?)Similar Code For All I2C PeripheralsSupports Various Data Transfer Rates

  • Development of I2CVersion 1.0 Introduced in 1992Standard 100 Kbits/sFast 400 Kbits/sVersion 2.0 Released in 1998High-Speed 3.4 Mbits/sVersion 2.1 Released in 2000Clock StretchedHigh-Speed Timings Relaxed

  • How Does It Work?

  • Further ReadingI2C-Bus Specification Version 2.1http://www.semiconductors.philips.com/acrobat_download/literature/9398/39340011.pdfDS1631 Datasheethttp://pdfserv.maxim-ic.com/en/ds/DS1631-DS1731.pdf

  • Serial Peripheral Interface (SPI)Synchronous Communication Protocol3-Wire (Plus 1 Chip-Select Pin/Device)Hardware On MicrocontrollerDeveloped By Motorola Loose StandardBroad Range of Devices SupportedMemory (i.e. EEPROM, RAM, Etc.)Sensors

  • SPI Characteristics3 Wires (Plus Chip Select Pin/Device)Master Out Slave In (MOSI)Master In Slave Out (MISO)Master/Slave Clock Output/Input (SCK)Chip/Slave Select (SS)Multiple Devices Connected On BusLimited Only By Number Of uC PinsSupports Various Data Transfer Rates

  • How Does It Work?

  • Configurations (AT89S53)SPI Control Register (SPCR)Sets Modes of OperationSPI Status Register (SPSR)Checks FlagsSPI Data Register (SPDR)8-Bit Shift Register Storing Data

  • 4 Modes of SPISet In SPI Control Register (SPCR)Clock PolarityActive LowActive HighClock PhaseData Shifted On Rising EdgeData Shifted On Falling Edge

  • 4 Modes of SPI (CPHA = 0)

  • 4 Modes of SPI (CPHA = 1)

  • Further ReadingAT89S53 Datasheet (Pg. 8, 14-16) http://www.atmel.com/dyn/resources/prod_documents/DOC0787.PDFPont Ch. 24

  • SPI Summary3-Wire (+ SS/Device)1.5 MHz Bit Frequency (AT89S53)Microcontroller HardwareSupports Many Devices