I2C Protocol and RTC Interfacing

Slides:



Advertisements
Similar presentations
I2C bus Inter Integrated Circuits bus by Philips Semiconductors
Advertisements

Serial Communications (Chapter 10)
MSP430G2553 launchpad and MPU6050 Introduction
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Two Wire Interface Another popular serial peripheral interface bus -More flexible than SPI -Master and slave modes supported -7-bit slave address -400khz.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
UBI >> Contents Chapter 14 Communications USI Module MSP430 Teaching Materials Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis.
Lecture 27: LM3S9B96 Microcontroller – Inter- Integrated Circuit (I 2 C) Interface.
Lecture 13: TI MSP430 Watchdog Timer and Real-Time Clock
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
7/23 Inter-chip Serial Communication: SPI and I 2 C Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
AT91 Embedded Peripherals
Universal Asynchronous Receiver/Transmitter (UART)
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
IO Subsystem IV Ports and peripherals. IO Subsystem (1) All devices connected to the system buses, other than memory and CPU – Input and output ports.
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
UBI >> Contents Lecture 11 Communications Introduction & USI Module MSP430 Teaching Materials Texas Instruments Incorporated University of Beira Interior.
Chapter 4 UART Serial Port Programming 1. Serial vs. Parallel Data Transfer 2.
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
Introduction to MSP430G2553 and MPU6050
Serial mode of data transfer
ECE 382 Lesson 15 Lesson Outline S/W Delays Wrap up
EMBEDDED SYSTEMS UNIT 4.
Serial Communication Buses: I2C and SPI
Two Wire Interface Another popular serial peripheral interface bus
Source: Serial Port Source:
MGITER,NAVSARI. AVR MICROCONTROLLER AND INTERFACING
Inter-IC Bus (I C) 2.
Chapter 11: Inter-Integrated Circuit (I2C) Interface
I/O Memory Interface Topics:
Timer Source: under
Serial I/O and Data Communication.
Programmable Interval Timer
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Two Wire Interface (TWI)
SPI Protocol and DAC Interfacing
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
I2C Protocol and RTC Interfacing
I2C PROTOCOL SPECIFICATION
Communication Lines Fundamentals.
SPI Protocol and DAC Interfacing
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
EEPROM Comparison – Parallel or Serial
Computer Organization and Design
SPI Protocol and DAC Interfacing
Source: Serial Port Source:
SPI Protocol and DAC Interfacing
Timer.
Serial Communication Interface: Using 8251
SPI Protocol and DAC Interfacing
UART Protocol Chapter 11 Sepehr Naimi
I2C and RTC Chapter 18 Sepehr Naimi
I2C Protocol and RTC Interfacing
Interrupt and Exception Programming
Timer Source: under
Interrupt Source: under
Lecture 8 USCI Module SPI & I2C Modes
Programmable Data Communication Blocks
Interrupt Source: under
I2C Protocol and RTC Interfacing
Paul MacDougal Triembed.org Dec 11, 2017
Source: Serial Port Source:
Timer Source: under
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Serial Communication 19th Han Seung Uk.
Source: Serial Port Source:
Serial Peripheral Interface Bus
Presentation transcript:

I2C Protocol and RTC Interfacing Chapter9 I2C Protocol and RTC Interfacing

I2C Bus Characteristics

I2C Bit Format

START and STOP Conditions

REPEATED START Condition

Byte Format in I2C

Address Byte Format in I2C

Typical Data Transmission

Clock Stretching

Multi-byte Burst Write

Multi-byte Burst Read

I2C Module Base Address for MSP432 (shared with SPI) I2C Module(UCBx) Base Address UCB0(eUSCI0) 0x4000_2000 UCB1(eUSCI1) 0x4000_2400 UCB2(eUSCI2) 0x4000_2800 UCB3(eUSCI3) 0x4000_2C00

Some I2C Registers Register Name Register Function Register Address UCB0 Control Word 0 Control 0 4000_1000 UCB0 Baud Rate Control Word Baud Rate 4000_1006 UCB0 Status Status 4000_1008 UCB0 RXBUF Receive Buffer 4000_100C UCB0 TXBUF Transmit Buffer 4000_100E UCB0 I2CSA I2C Slave Address 4000_1020 UCB0 IE Interrupt Enable 4000_102A UCB0 IFG Interrupt Flag 4000_102C

I2C Control Word 0 (UCBxCTLW0) Registers in MSP432

UCBxCTLW0 (UCBx Control Word 0) register bit description Bits Name Function Description UCSWRST Software reset enable 0b = Disabled. eUSCI_B released for operation. 1b = Enabled. eUSCI_B logic held in reset state. 1 UCTXSTT Transmit START condition 0b = Do not generate START condition 1b = Generate START condition 2 UCTXSTP Transmit STOP condition 0b = No STOP generated 1b = Generate STOP 3 UCTXNACK Transmit a NACK 0b = Acknowledge normally 1b = Generate NACK 4 UCTR Transmitter/receiver 0b = Receiver 1b = Transmitter 5 UCTXACK Transmit ACK condition 0b = Do not acknowledge the slave address 1b = Acknowledge the slave address 7-6 UCSSELx eUSCI clock source select 00b = Reserved 01b = ACLK 10b = SMCLK 11b = SMCLK

UCBxCTLW0 (UCBx Control Word 0) register bit description (Cont.) Bits Name Function Description 8 UCSYNC Synchronous mode enable Always 1b 1b = Synchronous mode 10-9 UCMODEx eUSCI mode. 00b = 3-pin SPI 01b = 4-pin SPI with UCxSTE active high: Slave enabled when UCxSTE = 1 10b = 4-pin SPI with UCxSTE active low: Slave enabled when UCxSTE = 0 11b = I2C mode 11 UCMST Master mode select 0b = Slave mode 1b = Master mode 13 UCMM Multi-master environment select. 0b = Single master environment. There is no other master in the system. The address compare unit is disabled. 1b = Multi-master environment 14 UCSLA10 Slave addressing mode select 0b = Address slave with 7-bit address 1b = Address slave with 10-bit address 15 UCA10 Own addressing mode select. 0b = Own address is a 7-bit address. 1b = Own address is a 10-bit address.

UCBxBRW Register to Set I2C Baud Rate

UCBxBRW Register Bits Description 15-0 Bit clock prescaler. Modify only when UCSWRST = 1

UCBx I2C slave address registerData Register

UCBxTXBUF Transmit Buffer Register

UCBxSTATW Status Word Register

UCBxSTATW Status Word Register bit description Field Description 15-8 UCBCNTx Returns the number of bytes received or transmitted on the I2C-Bus since the last START or RESTART. 7 Reserved 6 UCSCLLOW 0b = SCL is not held low 1b = SCL is held low 5 UCGC General call address received. UCGC is automatically cleared when a START condition is received. 0b = No general call address received 1b = General call address received 4 UCBBUSY 0b = Bus inactive 1b = Bus busy 3-0

IO Pin Assignment for all 4 I2C UCBx Modules I2C Module Pin IO Pin SCL(UCB0) P1.5 SCL(UCB1) P6.3 SDA(UCB0) P1.6 SDA(UCB1) P6.4 SCL(UCB2) P3.5 SCL(UCB3) P10.1 SDA(UCB2) P3.6 SDA(UCB3) P10.2

Pins available for I2C I/O pin Function PxSEL1=0 PxSEL0=1 P1.5 SCL(UCB0) P1SEL1=00000000 P1SEL0=00100000 P1.6 SDA(UCB0) P1SEL0=01000000   P6.3 SCL(UCB1) P6SEL1=00000000 P6SEL0=00001000 P6.4 SDA(UCB1) P6SEL0=00010000 P3.5 SCL(UCB2) P3SEL1=00000000 P3SEL0=00100000 P3.6 SDA(UCB2) P3SEL0=01000000 P10.1 SCL(UCB3) P10SEL1=00000000 P10SEL0=00000010 P10.2 SDA(UCB3) P10SEL0=00000100

DS1337 Pins

MSP432 Connections

DS1337 Address Map Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Function Range 00H 10 Seconds Seconds 00-59 01H 10 Minutes Minutes 02H 12/24 10 hour PM/AM 10hour Hours 1-12 0-23 03H Day 0-7 04H 10 Date Date 01-31 05H Century 10Mnt Month 1-12+ 06H 10 Year Year 00-99 07H A1M1 Alarm 1 Seconds 08H A1M2 Alarm 1 Minutes

DS1337 Address Map (Cont.) Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Function Range 09H A1M3 12/24 AM/PM 10 Hour Hour Alarm 1 Hours 1-12 00-23 0AH A1M4 DY/DT 10 Date Day Alarm 1 Day 1-7 Date Alarm 1 Date 01-31 0BH A2M2 10 Minutes Minutes Alarm 2 Minutes 00-59 0CH A2M3 Alarm 2 Hours 0DH A2M4 Alarm 2 Day Alarm 2 Date 0EH EOSC RS2 RS1 INTCN A2IE A1IE Control - 0FH OSF A2F A1F Status

Simplified Structure of SQW/INTB Pin

RS bits RS2 RS1 Output Frequency 1 Hz 1 4.096 kHz 8.192 kHz 32.768 kHz

Alarm 2 Register Mask Bits DY/DT A2M4 A2M3 A2M2 Alarm Rate X 1 Alarm once per minute Alarm when minutes match Alarm when hours and minutes match Alarm when date, hours, and minutes match Alarm when day, hours, and minutes match