EasyManua.ls Logo

Texas Instruments CC3235 SimpleLink Series - Page 221

Texas Instruments CC3235 SimpleLink Series
799 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
www.ti.com
Functional Description
221
SWRU543January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
Inter-Integrated Circuit (I
2
C) Interface
7.2.7 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 80 MHz.
1. Enable the I
2
C clock using the I2CLCKEN register in the system control module.
2. The CONFMODE bits in the GPIO_PAD_CONFIG register should be set to choose the I
2
C function.
3. Enable the I2CSCL pin for open-drain operation using the IODEN bits of the GPIO_PAD_CONFIG
register.
4. Initialize the I
2
C master by writing the I2CMCR register with a value of 0x0000.0010.
5. Set the desired SCL clock speed of 100 kbps by writing the I2CMTPR register with the correct value.
The value written to the I2CMTPR register represents the number of system clock periods in one SCL
clock period. The TPR value is determined by Equation 6.
TPR = (System Clock/(2*(SCL_LP + SCL_HP)*SCL_CLK))-1; (6)
For example:
TPR = (80 MHz/(2*(6+4)*100000))-1;
TPR = 39
Write the I2CMTPR register with the value of 0x0000.0039.
6. Specify the slave address of the master, and that the next operation is a transmit by writing the
I2CMSA register with a value of 0x0000.0076. This sets the slave address to 0x3B.
7. Place data (byte) to be transmitted in the data register by writing the I2CMDR register with the desired
data.
8. Initiate a single byte transmit of the data from master to slave by writing the I2CMCS register with a
value of 0x0000.0007 (STOP, START, RUN).
9. Wait until the transmission completes by polling the BUSBSY bit of the I2CMCS register until the bit
has been cleared.
10. Check the ERROR bit in the I2CMCS register to confirm the transmit was acknowledged.

Table of Contents

Related product manuals