-->
Page 1 of 1

Reboots when combining <ESP8266WiFi.h> and <Wire.h>

PostPosted: Tue Apr 14, 2015 10:32 am
by Ronald L
Hi I am working on a simple system that pulls data from a website and displays it on a 128x64 Oled display.
I am using Mike Rankin's Oled code, which runs fine. The Web code is pretty much standard and works fine if the display code is not present (and thus reporting through Serial). When I combine the Oled code and the Wifi code, I get WDT reboots and the code does not seem to run at all.

Here is the minimal code (only including Wire.h is enough to cause the WDT resets). Uncommenting all oled code (and incorporating all support functions produces the same result).

#include <ESP8266WiFi.h>
const char* ssid = "....";
const char* password = ".......";
#include <Wire.h>
//---------------FONT + GRAPHIC-----------------------------//
#include "data.h"
//==========================================================//

// OLED I2C bus address
#define OLED_address 0x3c

void setup()
{
// Wire.pins(0, 2); //0=SDA, 2=SCL, 2 also =LED

// Initialize I2C and OLED Display
// Wire.begin();

// init_OLED();
// reset_display(); // Clear logo and load saved mode

// We start by connecting to a WiFi network

Serial.println();
Serial.println();
Serial.print("Connecting to ");
// sendStrXY("Connecting to ",0,0);
Serial.println(ssid);
//sendStr(ssid);
WiFi.begin(ssid, password);

// sendStrXY(".",0,1);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
// sendStr(".");
}
//
Serial.print("Wifi connected");
//sendStrXY("WiFi connected ",0,0);
}

void loop() {
delay(500);
}

----
this is what the module sends through Serial
wdt reset
load 0x40100000, len 28036, room 16
tail 4
chksum 0x8a
load 0x3ffe8000, len 4364, room 4
tail 8
chksum 0x2f
load 0x3ffe9110, len 1948, room 0
tail 12
chksum 0xec
csum 0xec
-----

Am I doing anything wrong, or is this a bug?

BTW code is loaded into two segments in memory:
Uploading 34384 bytes from /../test.cpp_00000.bin to flash at 0x00000000
Uploading 165736 bytes from /..../test.cpp_40000.bin to flash at 0x00040000

Re: Reboots when combining <ESP8266WiFi.h> and <Wire.h>

PostPosted: Tue Apr 14, 2015 2:44 pm
by reaper7
I see that You do not initialize serial,
try to add
Code: Select all  Serial.begin(115200);
  delay(10);

as a first setup instructions

Re: Reboots when combining <ESP8266WiFi.h> and <Wire.h>

PostPosted: Wed Apr 15, 2015 12:38 am
by Ronald L
Thanks,

That does it. (Stupid I missed this). I still do get occassional WDT resets, but the code more or less works.