I2C bus possible problem.
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
I2C bus possible problem.
Build: ESP_Easy_mega 20210820_custom_ESP8266_4M1M
I have two sensors connected to the I2C bus, BMP180 and BME680. BMP180 is installed in a winter garden (together with whole esp based unit) and BME680 outside the building. The wall in the garden is thin, hence the length of the wires 15 cm max.
Sometimes the sensors (either one or the other) give nonsensical measurements like a temperature of 250 C and/or a pressure of 2500 hPa.
I applied a rule which, if 5 consecutive measurements are senseless, performs a hard reset by shorting the RESET pin via transistor to ground using free GPIO.
Most cases it helps, but sometimes only the power cycle helps.
I try simply soft reset instead hard reset but the result is similar.
I set the max speed of the I2C bus equal to the min speed and now both speeds are 100kHz.
As far as I know there is a problem with I2C in this FW realese.
Is it possible to know if there is any planned bug fixing of the software sources in this regard?
Of course, I realize all we have some other activities besides ESP, so I'm just asking.
I have two sensors connected to the I2C bus, BMP180 and BME680. BMP180 is installed in a winter garden (together with whole esp based unit) and BME680 outside the building. The wall in the garden is thin, hence the length of the wires 15 cm max.
Sometimes the sensors (either one or the other) give nonsensical measurements like a temperature of 250 C and/or a pressure of 2500 hPa.
I applied a rule which, if 5 consecutive measurements are senseless, performs a hard reset by shorting the RESET pin via transistor to ground using free GPIO.
Most cases it helps, but sometimes only the power cycle helps.
I try simply soft reset instead hard reset but the result is similar.
I set the max speed of the I2C bus equal to the min speed and now both speeds are 100kHz.
As far as I know there is a problem with I2C in this FW realese.
Is it possible to know if there is any planned bug fixing of the software sources in this regard?
Of course, I realize all we have some other activities besides ESP, so I'm just asking.
Re: I2C bus possible problem.
When this happens, do you see errors on all I2C addresses when performing an I2C scan?
About the planned fix for this issue (if it is what I think it is): https://github.com/letscontrolit/ESPEasy/pull/3678
I added some more code to it only a few days ago.
But it is really hard to test.
About the planned fix for this issue (if it is what I think it is): https://github.com/letscontrolit/ESPEasy/pull/3678
I added some more code to it only a few days ago.
But it is really hard to test.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
in 95% cases, wrong measurements gives BMP180, in 5% - BME680. I did not notice the case of both wrong measurement results.When this happens, do you see errors on all I2C addresses when performing an I2C scan?
Yes. Such situation occur several times per day and then during next two weeks no issue.But it is really hard to test.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
Seams to work better since ESP_Easy_mega_20211005_custom_ESP8266_4M1M. No I2C malfunctions so far.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
Still no I2C issues/errors. Look nice !!!
Re: I2C bus possible problem.
Great, so the reproduction of the issue has been made even harder
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
First I2C hangs after install FW ESP_Easy_mega_20211005_custom_ESP8266_4M1M.
Soft reboot does not help. Hardware reset via RST pin - too.
What helps, power cycle with 30 sec of power off.
Soft reboot does not help. Hardware reset via RST pin - too.
What helps, power cycle with 30 sec of power off.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
Today after 5 days of using ESPEasy_ESP82xx_mega-20211224 (custom compilation), the I2C bus "lost" one of the two connected sensors.
Interestingly, one was working properly all the time.
Interestingly, one was working properly all the time.
Re: I2C bus possible problem.
Interesting to know: Which sensors, which one 'survived' and which one failed, and what is the read-interval for both? And what did you do to 'revive' it, assuming it didn't revive itself with help from the 'Try clear I2C bus when stuck' setting?
/Ton (PayPal.me)
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
BMP085/180 'survived' (I2C addr - 0x77). read-interval - 120 sec
BME680 (I2C addr - 0x76) - no. read-interval - 120 sec
"Try clear I2C bus when stuck:: - checked
Soft reboot from console did not help.
Hard reset via GPIO5 connected to RST - also not.
Turning off the power for 4-5 minutes helped. It's a long time, but from the same power supply I power 3 other, completely different devices and, just in case, I waited for all electrolytic capacitors to discharge.
BME680 (I2C addr - 0x76) - no. read-interval - 120 sec
"Try clear I2C bus when stuck:: - checked
Soft reboot from console did not help.
Hard reset via GPIO5 connected to RST - also not.
Turning off the power for 4-5 minutes helped. It's a long time, but from the same power supply I power 3 other, completely different devices and, just in case, I waited for all electrolytic capacitors to discharge.
Re: I2C bus possible problem.
Another test you could have done is to swap in software the SDA and SCL pin and then swap them back.
If that fixes it, then it could be another clue on what is happening.
If that fixes it, then it could be another clue on what is happening.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
OK, will try if it happens next time.
But if so, is it possible to done this procedure from rule?
But if so, is it possible to done this procedure from rule?
Re: I2C bus possible problem.
More like the procedure to get out of a stuck I2C bus now does this as last resort.
But maybe it should be the first to try.
But maybe it should be the first to try.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
OK, there's a problem with I2C again. I swapped SCL and SDA, saved it and changed it again (as You suggested). Unfortunately it didn't help.
As usual, it was helpful to turn off the power for a while, wait about 30 seconds for the electrolytic capacitors to discharge (there are lots of them "on the way"). And the unit start working properly.
As usual, it was helpful to turn off the power for a while, wait about 30 seconds for the electrolytic capacitors to discharge (there are lots of them "on the way"). And the unit start working properly.
Re: I2C bus possible problem.
Was there any I2C communication with the pins swapped?
That's needed to make this fix work, as it does start sending data which will be considered as clock pulses by the I2C slave devices.
One of the options to trigger some I2C communication is to perform an I2C scan.
But there has to be some communication. or else this will not "fix" anything.
That's needed to make this fix work, as it does start sending data which will be considered as clock pulses by the I2C slave devices.
One of the options to trigger some I2C communication is to perform an I2C scan.
But there has to be some communication. or else this will not "fix" anything.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
Yes, there was communication. After swapping the SDA / SCL, I did a scan of the I2C devices and of course it showed no existence of any.
After restoring the previous settings, I did the I2C scan again and only the BMP180 was detected.
It is strange that one of the connected sensors is usually "lost". That is, either the BMP180 or (most often) the BME680.
After restoring the previous settings, I did the I2C scan again and only the BMP180 was detected.
It is strange that one of the connected sensors is usually "lost". That is, either the BMP180 or (most often) the BME680.
Re: I2C bus possible problem.
OK, so one was found?
That means the high state of one of the sensors was resolved, or else the entire I2C bus would have still been hanging.
This means the fix does work, but still strange that the other sensor remains in some limbo state.
That means the high state of one of the sensors was resolved, or else the entire I2C bus would have still been hanging.
This means the fix does work, but still strange that the other sensor remains in some limbo state.
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
Yes, one found.
The fact is that in previous versions of the FW the entire bus was hanging and there was no WiFi access to the device.
I don't know if it has anything to do with it, but it did.
The device, however, "lived" because the LED that I connected specially was blinking and turned on/off (via rule) when the value from the sensor connected via UART was read.
The fact is that in previous versions of the FW the entire bus was hanging and there was no WiFi access to the device.
I don't know if it has anything to do with it, but it did.
The device, however, "lived" because the LED that I connected specially was blinking and turned on/off (via rule) when the value from the sensor connected via UART was read.
Re: I2C bus possible problem.
Hmm strange that it also affected WiFi
Maybe the plugin for the failing device doesn't have proper timeout checks implemented.
Or maybe the I2C related read code has improved since the last SDK update?
Maybe the plugin for the failing device doesn't have proper timeout checks implemented.
Or maybe the I2C related read code has improved since the last SDK update?
-
- Normal user
- Posts: 531
- Joined: 07 Jun 2018, 06:47
- Location: Gdynia/Poland
Re: I2C bus possible problem.
In my case that it also affected WiFi in very old versions of FW.
Or strange readouts form sensors like 2500 hPa or so.
Now - i sensor is visible by ESP - readouts are correct.
Or strange readouts form sensors like 2500 hPa or so.
Now - i sensor is visible by ESP - readouts are correct.
Who is online
Users browsing this forum: No registered users and 2 guests