8C-ESP8266 Interface I2C en v1.0
8C-ESP8266 Interface I2C en v1.0
I2C
User Guide
Version 0.2
Espressif Systems IOT Team
http://bbs.espressif.com
Copyright
2015
Table of Contents
1.
Overview ...........................................................................................................................................................................................1
2.
3.
Initialisation ...........................................................................................................................................................2
Start the I2C ..........................................................................................................................................................2
Stop the I2C ..........................................................................................................................................................3
I2C masters response to ACK ...........................................................................................................................3
I2C masters response to NACK ........................................................................................................................4
Check the I2C slave response ...........................................................................................................................4
Write data into the I2C bus line........................................................................................................................4
Read data from the I2C bus line .......................................................................................................................5
Example ............................................................................................................................................................................................6
Overview
1.
Overview
As an interface of I2C master, ESP8266 can control and read the I2C slave (e.g., most of the digital sensors).
Each GPIO pin could be configured as open-drain . In this way, GPIO interface could function as I2C data or
clock.
Meanwhile, there are pull-up resistors within the chip.
The wave forms of SDA and SCL lines used in I2C are created by GPIO simulation. SDA accesses data with SCL
high. Both the high and low level of SCL are kept at 5us and the clock rate of I2C is about 100KHz.
Espressif Systems
1/6
2015.08
2.
2.1.
(2)
(3)
(4)
2.2.
Espressif Systems
2/6
2015.08
2.3.
2.4.
Espressif Systems
3/6
2015.08
2.5.
2.6.
2.7.
2.
Espressif Systems
4/6
2015.08
2.8.
Espressif Systems
5/6
2015.08
Example
3.
Example
Espressif Systems
6/6
2015.08