Wire doesn't work with ESP32 / 8266

mattlogue
Posts: 4
Joined: Sat Mar 02, 2019 1:54 am

Wire doesn't work with ESP32 / 8266

Postby mattlogue » Sat Mar 02, 2019 3:14 am

For the life of me I can't get wire to work on between Uno and ESP8266 and ESP32...

On the Uno I had them connected like
SDA via Uno SDA -> ESP32 GPIO21
SCL via Uno SCL -> ESP32 GPIO22

I also tried flipping them like this:
SDA via Uno SDA -> ESP32 GPIO22
SCL via Uno SCL -> ESP32 GPIO21

Connections are as follows:
SDA via ESP32 GPIO21 -> ESP8266 GPIO4
SCL via ESP32 GPIO22 -> ESP8266 GPIO5

I also tried flipping them, as follows:
SDA via ESP32 GPIO21 -> ESP8266 GPIO5
SCL via ESP32 GPIO22 -> ESP8266 GPIO4

I have present a 4.7kOhm pull-up resistor from SDA&SCL to +3.3V

All these combinations led to nil result on I2C bus scanners. I tried 5 scanners and 3 Wire libs. Here is output from one of the more comprehensive scanners:

Code: Select all

21:58:06.078 -> I2C Scanner to scan for devices on each port pair D0 to D7
21:58:06.078 -> Scanning (SDA : SCL) - GPIO4 : GPIO5 - No I2C devices found
21:58:06.112 -> Scanning (SDA : SCL) - GPIO4 : GPIO21 - No I2C devices found
21:58:06.180 -> Scanning (SDA : SCL) - GPIO4 : GPIO22 - No I2C devices found
21:58:06.249 -> Scanning (SDA : SCL) - GPIO4 : GPIO2 - No I2C devices found
21:58:06.385 -> Scanning (SDA : SCL) - GPIO4 : GPIO14 - No I2C devices found
21:58:06.520 -> Scanning (SDA : SCL) - GPIO4 : GPIO12 - No I2C devices found
21:58:06.724 -> Scanning (SDA : SCL) - GPIO4 : GPIO13 - No I2C devices found
21:58:06.928 ->  - No I2C devices found
21:58:07.165 -> Scanning (SDA : SCL) - GPIO5 : GPIO4 - No I2C devices found
21:58:07.437 -> Scanning (SDA : SCL) - GPIO5 : GPIO21 - No I2C devices found
21:58:07.743 -> Scanning (SDA : SCL) - GPIO5 : GPIO22 - No I2C devices found
21:58:08.050 -> Scanning (SDA : SCL) - GPIO5 : GPIO2 - No I2C devices found
21:58:08.418 -> Scanning (SDA : SCL) - GPIO5 : GPIO14 - No I2C devices found
21:58:08.822 -> Scanning (SDA : SCL) - GPIO5 : GPIO12 - No I2C devices found
21:58:09.230 -> Scanning (SDA : SCL) - GPIO5 : GPIO13 - No I2C devices found
21:58:09.670 ->  - No I2C devices found
21:58:10.143 -> Scanning (SDA : SCL) - GPIO21 : GPIO4 - No I2C devices found
21:58:10.654 -> Scanning (SDA : SCL) - GPIO21 : GPIO5 - No I2C devices found
21:58:11.193 -> Scanning (SDA : SCL) - GPIO21 : GPIO22 - No I2C devices found
21:58:14.312 -> Scanning (SDA : SCL) - GPIO21 : GPIO2 - No I2C devices found
21:58:14.888 -> Scanning (SDA : SCL) - GPIO21 : GPIO14 - No I2C devices found
21:58:15.530 -> Scanning (SDA : SCL) - GPIO21 : GPIO12 - No I2C devices found
21:58:16.174 -> Scanning (SDA : SCL) - GPIO21 : GPIO13 - No I2C devices found
21:58:16.850 ->  - No I2C devices found
21:58:17.555 -> Scanning (SDA : SCL) - GPIO22 : GPIO4 - No I2C devices found
21:58:18.292 -> Scanning (SDA : SCL) - GPIO22 : GPIO5 - No I2C devices found
21:58:19.071 -> Scanning (SDA : SCL) - GPIO22 : GPIO21 - Unknow error at address 0x09
21:58:19.139 -> Unknow error at address 0x0B
21:58:19.173 -> Unknow error at address 0x0F
21:58:19.173 -> Unknow error at address 0x12
21:58:19.173 -> Unknow error at address 0x13
21:58:19.207 -> Unknow error at address 0x15
21:58:19.207 -> Unknow error at address 0x16
21:58:19.207 -> Unknow error at address 0x17
21:58:19.241 -> Unknow error at address 0x19
21:58:19.241 -> Unknow error at address 0x1C
21:58:19.241 -> Unknow error at address 0x1D
21:58:19.241 -> Unknow error at address 0x1E
21:58:19.275 -> Unknow error at address 0x1F
21:58:19.275 -> Unknow error at address 0x23
21:58:19.309 -> Unknow error at address 0x25
21:58:19.309 -> Unknow error at address 0x26
21:58:19.309 -> Unknow error at address 0x27
21:58:19.309 -> Unknow error at address 0x29
21:58:19.342 -> Unknow error at address 0x2B
21:58:19.342 -> Unknow error at address 0x2F
21:58:19.376 -> Unknow error at address 0x31
21:58:19.376 -> Unknow error at address 0x32
21:58:19.376 -> Unknow error at address 0x33
21:58:19.376 -> Unknow error at address 0x34
21:58:19.376 -> Unknow error at address 0x35
21:58:19.410 -> Unknow error at address 0x36
21:58:19.410 -> Unknow error at address 0x37
21:58:19.410 -> Unknow error at address 0x38
21:58:19.410 -> Unknow error at address 0x39
21:58:19.410 -> Unknow error at address 0x3A
21:58:19.410 -> Unknow error at address 0x3B
21:58:19.444 -> Unknow error at address 0x3D
21:58:19.444 -> Unknow error at address 0x3E
21:58:19.444 -> Unknow error at address 0x3F
21:58:19.444 -> Unknow error at address 0x41
21:58:19.478 -> Unknow error at address 0x45
21:58:19.478 -> Unknow error at address 0x46
21:58:19.512 -> Unknow error at address 0x48
21:58:19.512 -> Unknow error at address 0x4C
21:58:19.546 -> Unknow error at address 0x4D
21:58:19.546 -> Unknow error at address 0x4F
21:58:19.580 -> Unknow error at address 0x54
21:58:19.580 -> Unknow error at address 0x55
21:58:19.580 -> Unknow error at address 0x56
21:58:19.580 -> Unknow error at address 0x57
21:58:19.614 -> Unknow error at address 0x5A
21:58:19.614 -> Unknow error at address 0x5B
21:58:19.648 -> Unknow error at address 0x5F
21:58:19.682 -> Unknow error at address 0x63
21:58:19.682 -> Unknow error at address 0x65
21:58:19.682 -> Unknow error at address 0x66
21:58:19.682 -> Unknow error at address 0x67
21:58:19.682 -> Unknow error at address 0x68
21:58:19.716 -> Unknow error at address 0x69
21:58:19.716 -> Unknow error at address 0x6A
21:58:19.716 -> Unknow error at address 0x6B
21:58:19.716 -> Unknow error at address 0x6C
21:58:19.716 -> Unknow error at address 0x6E
21:58:19.750 -> Unknow error at address 0x70
21:58:19.750 -> Unknow error at address 0x73
21:58:19.783 -> Unknow error at address 0x74
21:58:19.783 -> Unknow error at address 0x75
21:58:19.783 -> Unknow error at address 0x76
21:58:19.783 -> Unknow error at address 0x77
21:58:19.783 -> Unknow error at address 0x78
21:58:19.783 -> Unknow error at address 0x79
21:58:19.817 -> Unknow error at address 0x7B
21:58:19.817 -> Unknow error at address 0x7C
21:58:19.817 -> Unknow error at address 0x7D
21:58:19.817 -> No I2C devices found
21:58:19.817 -> Scanning (SDA : SCL) - GPIO22 : GPIO2 - No I2C devices found
21:58:20.662 -> Scanning (SDA : SCL) - GPIO22 : GPIO14 - No I2C devices found
21:58:21.507 -> Scanning (SDA : SCL) - GPIO22 : GPIO12 - No I2C devices found
21:58:22.391 -> Scanning (SDA : SCL) - GPIO22 : GPIO13 - No I2C devices found
21:58:23.342 ->  - No I2C devices found
21:58:24.258 -> Scanning (SDA : SCL) - GPIO2 : GPIO4 - No I2C devices found
21:58:25.241 -> Scanning (SDA : SCL) - GPIO2 : GPIO5 - No I2C devices found
21:58:26.258 -> Scanning (SDA : SCL) - GPIO2 : GPIO21 - No I2C devices found
21:58:27.310 -> Scanning (SDA : SCL) - GPIO2 : GPIO22 - No I2C devices found
21:58:28.360 -> Scanning (SDA : SCL) - GPIO2 : GPIO14 - No I2C devices found
21:58:29.447 -> Scanning (SDA : SCL) - GPIO2 : GPIO12 - No I2C devices found
21:58:30.569 -> Scanning (SDA : SCL) - GPIO2 : GPIO13 - No I2C devices found
21:58:31.722 ->  - No I2C devices found
21:58:32.911 -> Scanning (SDA : SCL) - GPIO14 : GPIO4 - No I2C devices found
21:58:34.133 -> Scanning (SDA : SCL) - GPIO14 : GPIO5 - No I2C devices found
21:58:35.360 -> Scanning (SDA : SCL) - GPIO14 : GPIO21 - No I2C devices found
21:58:36.649 -> Scanning (SDA : SCL) - GPIO14 : GPIO22 - No I2C devices found
21:58:37.933 -> Scanning (SDA : SCL) - GPIO14 : GPIO2 - No I2C devices found
21:58:39.254 -> Scanning (SDA : SCL) - GPIO14 : GPIO12 - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO14 : GPIO13 - No I2C devices found
21:58:39.491 ->  - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO12 : GPIO4 - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO12 : GPIO5 - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO12 : GPIO21 - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO12 : GPIO22 - No I2C devices found
21:58:39.491 -> Scanning (SDA : SCL) - GPIO12 : GPIO2 - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO12 : GPIO14 - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO12 : GPIO13 - No I2C devices found
21:58:39.525 ->  - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO13 : GPIO4 - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO13 : GPIO5 - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO13 : GPIO21 - No I2C devices found
21:58:39.525 -> Scanning (SDA : SCL) - GPIO13 : GPIO22 - No I2C devices found
21:58:39.559 -> Scanning (SDA : SCL) - GPIO13 : GPIO2 - No I2C devices found
21:58:39.559 -> Scanning (SDA : SCL) - GPIO13 : GPIO14 - No I2C devices found
21:58:39.559 -> Scanning (SDA : SCL) - GPIO13 : GPIO12 - No I2C devices found

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

Re: Wire doesn't work with ESP32 / 8266

Postby boarchuz » Sat Mar 02, 2019 12:45 pm

I think default is typically 5/4 for ESP32, but it's configurable on this chip so you may want to dig in to the library to see which pins it's using.

That output suggests that it's changing pin configuration very quickly, far too quickly for you to physically switch the wires to match. Obviously you will have no results if nothing is connected to the pins.

At this stage I would suggest testing using pins IO4 and IO5 on the ESP32. Use a known good i2c slave device and make sure it shows up on the scanner, switching pins if it doesn't show up the first time. Then double check your slave/master firmwares, make sure they share a common ground, and test using the now-known pin configuration.

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: Wire doesn't work with ESP32 / 8266

Postby idahowalker » Mon Mar 04, 2019 4:51 pm

Uno 5V to ESP32 3.3V.

I know that ESP32's blow as fast as fuses when subject to over voltage.

mattlogue
Posts: 4
Joined: Sat Mar 02, 2019 1:54 am

Re: Wire doesn't work with ESP32 / 8266

Postby mattlogue » Wed Mar 06, 2019 3:56 am

"Blow fast as fuses"... no kidding. I thought it would be safe to hook one up to a project designed for an Arduino, with one 5V PIR and another 5V input. I thought worst case scenario it would burn out the pins. No, the whole thing is a brick now.

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: Wire doesn't work with ESP32 / 8266

Postby idahowalker » Wed Mar 06, 2019 4:34 pm

mattlogue wrote:
Wed Mar 06, 2019 3:56 am
"Blow fast as fuses"... no kidding. I thought it would be safe to hook one up to a project designed for an Arduino, with one 5V PIR and another 5V input. I thought worst case scenario it would burn out the pins. No, the whole thing is a brick now.
WIth my 3rd ESP32 brick, I built a fused crowbar circuit to power the ESP32 projects I do. I buy a bulk of 7805's and test them for voltage output of less than 5.1V. I use a 5.1V Zener and a 89 ohm resistor in series to the gate of an SCR, The SCR is across the input voltage to the 7805 and when the voltage on the 5V line reaches 5.1 volts the fuse blows. My favorite set up is the 7805 is outputting 5.082 Volts. Whiles I have still blown a few fuses on that circuit, I have not blown another ESP32. Oh, the start up current on that circuit, by measure, is 265mA. I use a 300mA fuse.

I have bought a few logic translators to hook between a Mega and a ESP32 but found that discrete component level shifters to work better with the ESP32's
Image

I had got a lot of logic 'jitter' with the logic translators, even after applying electrolyte and ceramic cap filtering.

Edje11
Posts: 18
Joined: Thu May 17, 2018 10:33 am
Contact:

Re: Wire doesn't work with ESP32 / 8266

Postby Edje11 » Thu Mar 07, 2019 9:15 am

2N7000 is not suitable for level shifting. The required gate voltage is to high.
https://forum.arduino.cc/index.php?topic=564390.15

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: Wire doesn't work with ESP32 / 8266

Postby idahowalker » Thu Mar 07, 2019 6:59 pm

Edje11 wrote:
Thu Mar 07, 2019 9:15 am
2N7000 is not suitable for level shifting. The required gate voltage is to high.
https://forum.arduino.cc/index.php?topic=564390.15
Thanks for that info. I best not let my level 2N7000 level shifters know about this or they may quit working.

Who is online

Users browsing this forum: Bing [Bot] and 29 guests