Skip to content

WiFi and I2C interfere #1331

@Nurgak

Description

@Nurgak

I need WiFi and I2C/Wire in the same project, but it seems when the Wire library is included and initialised the WiFi stops behaving as expected. I've been trying to debug this issue for 3 days and now I'm stuck.

It seems that WiFi and I2C interfere somehow. Let me explain: I open the SDWebServer example file, run it vanilla and get the following output:

Connecting to 4a82dd
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt 

connected with 4a82dd, channel 11
dhcp client start...
chg_B1:-40
chg_B1:-80
ip:192.168.0.20,mask:255.255.255.0,gw:192.168.0.1
Connected! IP address: 192.168.0.20
MDNS responder started
You can now connect to http://esp8266sd.local
HTTP server started
SD Card initialized.
pm open,type:2 0

This is expected, it has always run this way for me. For some reason it loses connection (state 5), but then it connects to my access point and everything is good.

Now when the Wire library is included and Wire.begin(4, 2) called inside setup() (doesn't matter at which point) I get the following output from the ESP:

Connecting to 4a82dd
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt 
chg_B1:-40

connected with 4a82dd, channel 11
dhcp client start...
chg_B1:-80
Could not connect to4a82dd
pm open,type:2 0

As you can see it fails to connect, simply because I included and initialised the Wire library. This happens pretty much systematically, sometimes it succeeds in connecting, which is really worrisome. I tried different pin combinations for SDA and SCL signals, but it doesn't seem to improve the situation.

Can anybody try to recreate and confirm this? Open the SDWebServer example, include the Wire library and initialise it inside setup(). Here's a link to Pastebin with the modified version of SDWebServer code.

It could be that my flash chip is busted as well, I should test that somehow...

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions