Introduction: SparkFun ESP8266 Thing With CCS811and BME280, I2C Timing Issue Setting of Watchdog WDT

About: Im new here will update soon

This is a very quick instruct-able to show how to get an ESP8266, specifically the Sparkfun Things to work with I2C devices like the Sparkfun Environmental Combo, that contains CCS811 and the BME280.

I had a problem keeping the ESP from failing due to it's watchdog timer getting set. I believed their to be a timing problem with how the ESP communicates with the I2C Device based on the default I2C timing settings in the ESP8266 core files. The steps here should help you if you are getting the Soft WDT error when you are using an EP8266 to communicate to a I2C device.

Step 1: Change the Your I2C Timing in the Arduino IDE by Editing a CORE File

  1. LOCATE THE core_esp8266_si2c.c FILE

On MAC here is the PATH, for other systems, see if you can find it in your arduino files specific to your operating Arduino IDE.

PATH TO THE core_esp8266_si2c.c:

/Users/username/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266

Step 2: EDIT THE Core_esp8266_si2c.c File

  1. Open the core_esp8266_si2c.c file and find the line (line 74 in my file) with the following:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color: #f4f4f4; background-color: #000000; background-color: rgba(0, 0, 0, 0.85)}
span.s1 {font-variant-ligatures: no-common-ligatures}

  1. twi_setClockStretchLimit(230); // default value is 230 uS

Step 3: CHANGE THE STRETCH LIMIT

CHANGE p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color: #f4f4f4; background-color: #000000; background-color: rgba(0, 0, 0, 0.85)}

span.s1 {font-variant-ligatures: no-common-ligatures}

twi_setClockStretchLimit(230); // default value is 230 uS

and double the size of the limit to 460:

twi_setClockStretchLimit(460); // default value is 230 uS

This value worked for me, and now I have no issues with communicating with my I2C devices on my ESP8266. Unfortunately I cant really tell you why this works, I just doubled the time. You can tweak this to see where your issues happen and change the value accordingly. My application didn't need fast I2C comm.

Step 4: Restart Your IDE

Im not sure if this step is needed, but you may beed to restart your IDE. Unfortunately I couldn't find a way to view the stretch value.