Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By dayzman
#18266 Hi

I'm trying to drive a BMP180 using this driver https://github.com/reaper7/esp8266_i2c_bmp180 It defines SDA to be pin 2 and SCK to be pin 0 in i2c.h. Could these pins be changed to other pins arbitrarily? Are there limitations on what certain GPIO pins are allowed to do?

Thanks
User avatar
By GeorgeIoak
#18269 Somebody can correct me if I'm wrong but I believe that the ESP8266 has hardware I2C defined as SCL on GPIO14 and SDA defined on GPIO2. That means that if you want to use the built-in I2C driver you must use those pins to communicate with I2C devices. BUT, it is easy to bit bang the I2C protocol and the link you provided appears to just use that method. You should be able to use any GPIO pins except GPIO15 since it needs to be low at boot and your I2C pullup will make it high.
User avatar
By GeorgeIoak
#18423 That's what I thought but since the "datasheet" has section 3.4 dedicated to I2C and even "defining" 2 pins to use I thought maybe it did. But re-reading this section I find the following statement:

Both I2C-Master and I2C-Slave are supported. I2C interface functionality can be realized via software programming, the clock frequency can be up to around 100KHz at most. It should be noted that I2C clock frequency should be higher than the slowest clock frequency of the slave device.


So there's no way that a hardware implementation would only support less than 100kHz. But now that bothers me a bit because with a 80MHz CPU clock why would you be limited to "100kHz at most"?

To be honest, it seems to me that there is a lot of "marketing" type information entered into what should be a techincal document.