I2C on GPIO 0 + 2

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

I2C on GPIO 0 + 2

#1 Post by chrille » 21 Nov 2015, 22:45

Have anyone success with using GPIO 0 and 2 for I2C?
I have tried configuring GPIO 0 for SCL and GPIO 2 for SDA. This results on the module hanging in the I2C INIT during reboot. I can't even enter any commands and I need to overwrite flash to recover the module. The same pin usage for I2C works with the russian software from www.wifi-iot.ru so it's not a hardware limitation (currently I am testing without any sensors on the I2C bus - just needed to change the default I2C values and decided to go with the values from my wifi-iot modules)

- Jan
Jan Chrillesen, Denmark

NietGiftig
Normal user
Posts: 103
Joined: 16 Sep 2015, 20:32

Re: I2C on GPIO 0 + 2

#2 Post by NietGiftig » 22 Nov 2015, 07:49

I have tried it once but I had the same problem.

I use an E12 so no lack on pins and I decided to go back to the default for ESP Easy.

I tried it because of this forum
http://www.esp8266.com/viewtopic.php?p=24793#p24793
Forumpost over Flash, GPIO2, 0 and 15 rehash.

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: I2C on GPIO 0 + 2

#3 Post by chrille » 22 Nov 2015, 09:14

NietGiftig wrote:I have tried it once but I had the same problem.

I use an E12 so no lack on pins and I decided to go back to the default for ESP Easy.

I tried it because of this forum
http://www.esp8266.com/viewtopic.php?p=24793#p24793
Forumpost over Flash, GPIO2, 0 and 15 rehash.
I am aware that 0, 2 and 15 should be avoided if possible - however I am building a lab/test setup, where I need to add as many different sensors as possible and I need all usable GPIO pins for this. I think I'll go search the Arduino forums to see if there's a generic issue with I2C and GPIO 0/2 - thanks for confirming that I'm not alone on this issue!

- Jan
Jan Chrillesen, Denmark

Martinus

Re: I2C on GPIO 0 + 2

#4 Post by Martinus » 22 Nov 2015, 09:55

My development lab has switched to NodeMCU V1 a while ago. But when we started on the first ESP firmware (wasn't even ESP Easy) we used ESP-01 with I2C on GPIO-0 and GPIO-2. So it has worked before and probably could still work on ESP Easy.

Have to get one of those classic modules running again in the testlab and see if we have broken something here...

Martinus

Re: I2C on GPIO 0 + 2

#5 Post by Martinus » 22 Nov 2015, 10:33

Just connected an ESP-01 onto the I2C bus and it seems to work without issues here:
I2C_GPIO0-2.png
I2C_GPIO0-2.png (3.59 KiB) Viewed 29867 times
Attachments
I2C_Scan.png
I2C_Scan.png (5.29 KiB) Viewed 29867 times

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: I2C on GPIO 0 + 2

#6 Post by chrille » 22 Nov 2015, 15:19

Martinus wrote:Just connected an ESP-01 onto the I2C bus and it seems to work without issues here:
That's weird - I repeated the test today, with a PCF8591 board connected to the bus and it worked fine. After removing the board the board still boots. Sorry for the false alarm.

- Jan
Jan Chrillesen, Denmark

fluppie
Normal user
Posts: 89
Joined: 09 Oct 2015, 13:23

Re: I2C on GPIO 0 + 2

#7 Post by fluppie » 28 Nov 2015, 21:40

Also working here on a ESP8266 Dev Board :).
R46.PNG
R46.PNG (23.3 KiB) Viewed 29812 times

WZab
New user
Posts: 1
Joined: 19 Dec 2015, 11:22

Re: I2C on GPIO 0 + 2

#8 Post by WZab » 19 Dec 2015, 11:28

Hi,

I think, that the problem may be related to the fact, that during RESET the GPIO0 has a special function - it causes ESP8266 to enter the flashing mode.
If you have an I2C CLK line with relatively high capacitance connected to it, I'm afraid that during power-up the ESP8266 may go into the flashing mode.
Even if you connect the I2C bus after the module started, there is still a risk that reset occurs when a peripheral holds CLK down (due to clock stretching).

Regards,
Wojtek

BerndJ
Normal user
Posts: 86
Joined: 28 Sep 2015, 06:57

Re: I2C on GPIO 0 + 2

#9 Post by BerndJ » 19 Dec 2015, 14:19

Hi,

what is the best solution to use I2C on the ESP-01 Module??

GPIO0 SDA and GPIO2 SCL

or

GPIO0 SCL and GPIO2 SDA

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: I2C on GPIO 0 + 2

#10 Post by costo » 19 Dec 2015, 16:33

Like WZab says, if you use I2C on pin GPIO-0 there is always the risk that a device that can talk to the ESP will pull this line down.
I never had problems when connecting a listening-only device like an OLED or LCD on GPIO-0 but when using a device that can pull down this pin you can expect problems. After an ESP reset, a I2C talking-device may pull down any of the 2 lines if it was busy talking to the ESP when the reset occurred. You can only overcome this by resetting the I2C device at the same time as resetting the ESP

edit: In my setup with a display on GPIO-0/2 I used pullups of 3k3 and the lines were shorter that 20 cm. So capacitance was never a problem.

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: I2C on GPIO 0 + 2

#11 Post by BertB » 19 Dec 2015, 20:00

Even listening-only devices can pull down the SDA line, when signalling ACK to the master.

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests