EasyManuals Logo
Home>Texas Instruments>Microcontrollers>Tiva TM4C123GH6PM

Texas Instruments Tiva TM4C123GH6PM User Manual

Texas Instruments Tiva TM4C123GH6PM
352 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #123 background imageLoading...
Page #123 background image
Inter-Integrated Circuit (I2C)
12 Inter-Integrated Circuit (I2C)
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
12.1 Introduction
The Inter-Integrated Circuit (I2C) API provides a set of functions for using the I2C master and slave
modules. Functions are provided to initialize the I2C modules, to send and receive data, obtain
status, and to manage interrupts for the I2C modules.
The I2C master and slave modules provide the ability to communicate to other IC devices over an
I2C bus. The I2C bus is specified to support devices that can both transmit and receive (write and
read) data. Also, devices on the I2C bus can be designated as either a master or a slave. The I2C
modules support both sending and receiving data as either a master or a slave, and also support
the simultaneous operation as both a master and a slave. Finally, the I2C modules can operate at
two speeds: Standard (100 kb/s) and Fast (400 kb/s).
Both the master and slave I2C modules can generate interrupts. The I2C master module will
generate interrupts when a transmit or receive operation is completed (or aborted due to an error).
The I2C slave module will generate interrupts when data has been sent or requested by a master.
12.1.1 Master Operations
When using this API to drive the I2C master module, the user must first initialize the I2C master
module with a call to ROM_I2CMasterInitExpClk(). That function will set the bus speed and enable
the master module.
The user may transmit or receive data after the successful initialization of the I2C master module.
Data is transferred by first setting the slave address using ROM_I2CMasterSlaveAddrSet(). That
function is also used to define whether the transfer is a send (a write to the slave from the master) or
a receive (a read from the slave by the master). Then, if connected to an I2C bus that has multiple
masters, the I2C master must first call ROM_I2CMasterBusBusy() before attempting to initiate the
desired transaction. After determining that the bus is not busy, if trying to send data, the user must
call the ROM_I2CMasterDataPut() function. The transaction can then be initiated on the bus by
calling the ROM_I2CMasterControl() function with any of the following commands:
I2C_MASTER_CMD_SINGLE_SEND
I2C_MASTER_CMD_SINGLE_RECEIVE
I2C_MASTER_CMD_BURST_SEND_START
I2C_MASTER_CMD_BURST_RECEIVE_START
Any of those commands will result in the master arbitrating for the bus, driving the start sequence
onto the bus, and sending the slave address and direction bit across the bus. The remainder of the
transaction can then be driven using either a polling or interrupt-driven method.
For the single send and receive cases, the polling method will involve looping on the re-
turn from ROM_I2CMasterBusy(). Once that function indicates that the I2C master is
no longer busy, the bus transaction has been completed and can be checked for errors
April 8, 2013 123

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments Tiva TM4C123GH6PM and is the answer not in the manual?

Texas Instruments Tiva TM4C123GH6PM Specifications

General IconGeneral
BrandTexas Instruments
ModelTiva TM4C123GH6PM
CategoryMicrocontrollers
LanguageEnglish

Related product manuals