DS1307RTC icon indicating copy to clipboard operation
DS1307RTC copied to clipboard

ESP8266 keeps rebooting due to multiple calls of Wire.begin()

Open morres83 opened this issue 5 years ago • 1 comments

The ESP8266 keeps rebooting when setSyncProvider(RTC.get); is called. This behavior is caused by multiple calls of Wire.begin() in setup().

I am using the DS1307 and a BMP280 temperature sensor connected via I2C. The BMP280 gets initiated first and calls Wire.begin(). Afterwards the RTC.get() calls Wire.begin() again (automatically). This causes the reboot. As soon as I remove Wire.begin() in the DS1307RTC() constructor, everything works fine.

So I am wondering if it is good to automatically call Wire.begin() without the knowledge if the bus might has been initialized already. Maybe we could pass a parameter to tell the constructor if Wire.begin() is necessary...? But in this case I think the automatic instance creation by DS1307RTC RTC = DS1307RTC(); // create an instance for the user must be deleted.

morres83 avatar Jan 13 '20 19:01 morres83

The ESP8266 keeps rebooting when setSyncProvider(RTC.get); is called. This behavior is caused by multiple calls of Wire.begin() in setup().

I am using the DS1307 and a BMP280 temperature sensor connected via I2C. The BMP280 gets initiated first and calls Wire.begin(). Afterwards the RTC.get() calls Wire.begin() again (automatically). This causes the reboot. As soon as I remove Wire.begin() in the DS1307RTC() constructor, everything works fine.

So I am wondering if it is good to automatically call Wire.begin() without the knowledge if the bus might has been initialized already. Maybe we could pass a parameter to tell the constructor if Wire.begin() is necessary...? But in this case I think the automatic instance creation by DS1307RTC RTC = DS1307RTC(); // create an instance for the user must be deleted.

Thanks for posting this. I was troubleshooting why my Wemos D1 mini keeps restarting since last week, and I would never have guessed its the mutliple calls to Wire.begin().

The libraries I am using is this library together with adafruit INA219 library

bennchong avatar May 17 '21 07:05 bennchong