PaulStoffregen / DS1307RTC

Use a DS1307 Real Time Clock chip with the Time library
http://www.pjrc.com/teensy/td_libs_DS1307RTC.html
143 stars 86 forks source link

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

Open morres83 opened 4 years ago

morres83 commented 4 years ago

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.

bennchong commented 3 years ago

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