English
Language : 

LM3S5P3B Datasheet, PDF (741/1170 Pages) Texas Instruments – Stellaris® LM3S5P3B Microcontroller
Figure 15-13. Slave Command Sequence
Idle
Stellaris® LM3S5P3B Microcontroller
Write OWN Slave
Address to
I2CSOAR
Write -------1
to I2CSCSR
Read I2CSCSR
NO TREQ bit=1?
YES
Write data to
I2CSDR
NO RREQ bit=1?
FBR is
also valid YES
Read data from
I2CSDR
15.4
Initialization and Configuration
The following example shows how to configure the I2C module to transmit a single byte as a master.
This assumes the system clock is 20 MHz.
1. Enable the I2C clock by writing a value of 0x0000.1000 to the RCGC1 register in the System
Control module (see page 269).
2. Enable the clock to the appropriate GPIO module via the RCGC2 register in the System Control
module (see page 278). To find out which GPIO port to enable, refer to Table 23-5 on page 1059.
3. In the GPIO module, enable the appropriate pins for their alternate function using the
GPIOAFSEL register (see page 437). To determine which GPIOs to configure, see Table
23-4 on page 1052.
4. Enable the I2C pins for open-drain operation. See page 442.
5. Configure the PMCn fields in the GPIOPCTL register to assign the I2C signals to the appropriate
pins. See page 455 and Table 23-5 on page 1059.
6. Initialize the I2C Master by writing the I2CMCR register with a value of 0x0000.0010.
January 20, 2012
741
Texas Instruments-Production Data