Broken I2C communication while using wifi!
Broken I2C communication while using wifi!
Dear community,
I have ESP-WROOM-32 modules. Today I found that even I2C communication is broken while using WIFI. I use I2C to tranfer values from MCP3221 (12bit ADC) with GPIO21 and GPIO22 pins. If I not use WIFI in my code, I get stable values from MCL3221. If I use WIFI I get random unreal values (but some values are correct). I thought that ESP32 will not influence I2C communication on these pins. Why it happens? Does it have a solution?
Thank you.
UK
I have ESP-WROOM-32 modules. Today I found that even I2C communication is broken while using WIFI. I use I2C to tranfer values from MCP3221 (12bit ADC) with GPIO21 and GPIO22 pins. If I not use WIFI in my code, I get stable values from MCL3221. If I use WIFI I get random unreal values (but some values are correct). I thought that ESP32 will not influence I2C communication on these pins. Why it happens? Does it have a solution?
Thank you.
UK
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: Broken I2C communication while using wifi!
Are you sure you don't have power supply issues? Power use when WiFi is in use can be really spiky, and if you have a somewhat janky setup (read: breadboard, long jumper wires, no decoupling) that can lead to issues.
-
- Posts: 9
- Joined: Tue Feb 19, 2019 4:45 pm
Re: Broken I2C communication while using wifi!
Other issues might be pullup resistors (SDA and SCL should be tied to + via a , say, 2.2k resistor, else, it gets noise sensitive -and as ESP_Sprite wrote, wifi can generate noise).
Is there a way to put pictures of your hardware in this forum -on both sides, so that nothing gets hidden: "smart" "phones" can take pictures, and I saw an "insert image icon" -Img
Is there a way to put pictures of your hardware in this forum -on both sides, so that nothing gets hidden: "smart" "phones" can take pictures, and I saw an "insert image icon" -Img
Re: Broken I2C communication while using wifi!
So do you think that GPIO21 and GPIO22 are right?
Because DPS is quite small (90 x 45 mm) and doubleside, it is hard to see the paths. But I can show you circuit instead:
https://imgur.com/a/yy6Vp2N
MCP3221 (12bit ADC) and AD8226 (Instr. Amplifier) are near the ESP32. All is powered by BUCK switching converters (I use two, one for 5V and 3.3V) with maximal current drain of 2A. If there is a problem in voltage spikes that are generated by WIFI, how can I remove them? I can not have a half meter big DPS for separating ESP32 from other components...
Thank you.
UK
Because DPS is quite small (90 x 45 mm) and doubleside, it is hard to see the paths. But I can show you circuit instead:
https://imgur.com/a/yy6Vp2N
MCP3221 (12bit ADC) and AD8226 (Instr. Amplifier) are near the ESP32. All is powered by BUCK switching converters (I use two, one for 5V and 3.3V) with maximal current drain of 2A. If there is a problem in voltage spikes that are generated by WIFI, how can I remove them? I can not have a half meter big DPS for separating ESP32 from other components...
Thank you.
UK
-
- Posts: 9
- Joined: Tue Feb 19, 2019 4:45 pm
Re: Broken I2C communication while using wifi!
Well, your ADC has a 100 n decoupling;OK
I2C legs are pulled up with 10k ;OK
EPS32 has ... two 100 nF decoupling (200 nF)
From https://www.espressif.com/sites/defaul ... nes_en.pdf, fig.2 -maybe 3- seems it lacks >= 1uF decoupling capacitors .
from the same document, :
10uF tantalum capacitors can be tiny, and are warmly recommended...
You do not avoid spikes by having long wires (wires should be kept as short as possible), but by using decoupling capacitors.... That may be annoying on an already existing PCB.
I2C legs are pulled up with 10k ;OK
EPS32 has ... two 100 nF decoupling (200 nF)
From https://www.espressif.com/sites/defaul ... nes_en.pdf, fig.2 -maybe 3- seems it lacks >= 1uF decoupling capacitors .
from the same document, :
:. It should be noted that the sudden increase
in current draw, when ESP32 is in transmission mode, may cause a power rail collapse. Therefore, it is highly
recommended to add another 10uF capacitor to the power trace, which can work in conjunction with the 0.1uF capacitor.
10uF tantalum capacitors can be tiny, and are warmly recommended...
You do not avoid spikes by having long wires (wires should be kept as short as possible), but by using decoupling capacitors.... That may be annoying on an already existing PCB.
Re: Broken I2C communication while using wifi!
I have tantalum 10uF capacitor just right next to VCC ESP32 pin (as close as possible) on PCB. This capacitor is drawn in power supply part. I do not know what other capacitors should I add ...
-
- Posts: 9
- Joined: Tue Feb 19, 2019 4:45 pm
Re: Broken I2C communication while using wifi!
Two things keep on worrying me (searching for powwer supply trouble):
a) you have an analog circuit before the analog to I2C converter. Is it decoupled? How is it powered?
b) ESP have separated flash (another chip), with a separate decoupling (say, 1uF).
c) Is your ESP32 tied to an antenna?
a) you have an analog circuit before the analog to I2C converter. Is it decoupled? How is it powered?
b) ESP have separated flash (another chip), with a separate decoupling (say, 1uF).
c) Is your ESP32 tied to an antenna?
Re: Broken I2C communication while using wifi!
This is the weirdest part!
I have two separate power source lines from one 12V power input - first 3.3V used directly ONLY for ESP32 - and second 5V for all other components. So the ESP32 is connected only by ground and I2C and ISP communication wires with other components. So the 5V power should not be affected by ESP32 voltage spikes. I have no level shifters atm., but ESP32 work even with communication in 5V level on some pins. I will complete this later...
All components have decoupling capacitors. ESP32 have its own antena (ESP-WROOM-32 module).
All day I read the articles about ESP power and the elimination of voltage spikes. I will try to add some extra capacitors with 1000uF. I belive this is not good situation and ESP32 must have something broken inside.
Thank you.
UK
I have two separate power source lines from one 12V power input - first 3.3V used directly ONLY for ESP32 - and second 5V for all other components. So the ESP32 is connected only by ground and I2C and ISP communication wires with other components. So the 5V power should not be affected by ESP32 voltage spikes. I have no level shifters atm., but ESP32 work even with communication in 5V level on some pins. I will complete this later...
All components have decoupling capacitors. ESP32 have its own antena (ESP-WROOM-32 module).
All day I read the articles about ESP power and the elimination of voltage spikes. I will try to add some extra capacitors with 1000uF. I belive this is not good situation and ESP32 must have something broken inside.
Thank you.
UK
Re: Broken I2C communication while using wifi!
So I tryed to add some capacitors but it did not help. One weird behaviour is, when I put my hands closer to the DPS, the number of wrong values are greatly reduced. Maybe this is the reason of my problems, but I do not know what to do ... Any ideas?
Thanks.
UK
Thanks.
UK
-
- Posts: 9
- Joined: Tue Feb 19, 2019 4:45 pm
Re: Broken I2C communication while using wifi!
Seems a symptom of your problems.One weird behaviour is, when I put my hands closer to the DPS, the number of wrong values are greatly reduced. Maybe this is the reason of my problems, but I do not know what to do ...
You really should post a (link to a) photo of the circuit as it is:
a)Are each and every ground connections OK?
b) Is the overall schematic like this
(something) -> instrumentation amplifier -> Analog to I2C conversion -> EPS32 module .
c) Does the part " Analog to I2C conversion -> EPS32 module " work OK (ie without AD 8266: maybe you can separate it and test with some fixed voltages)?
I had a look at https://www.analog.com/media/en/technic ... AD8226.pdf and noticed it had a very high input impedance ca 1GO, lookin at https://www.analog.com/en/products/ad82 ... luationkit, I noticed there were big copper areas for ground (maybe they are meant to replace hands when there are interferences)
Who is online
Users browsing this forum: No registered users and 39 guests