DS1302 not running during ESP8266 deep sleep #195
-
Dear members of the forum, Thank you, Makuna, for creating the Rtc Library! I am reaching out to you as I have encountered an issue and I am in need of your help and expertise. I am using Makuna's Rtc Library for my project. The problem is that my DS1302 real-time clock module is not functioning as expected when the ESP8266 enters deep sleep mode. The clock time stored on an SD card keeps resetting to the same value (time of compilation). I have already investigated several possible causes and conducted relevant tests:
rtc.SetIsRunning(true); It is my understanding, that this instruction should correctly set the "clock halt" flag, allowing the clock to continue running during deep sleep. If I have made any mistakes here or if there are other potential reasons for the issue, I would greatly appreciate your input. I would be very grateful for any brief feedback or assistance you can provide. Thank you in advance for your support! Best regards, Tobias |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are correct, calling Do you know if the battery you are using is a rechargeable? LIR vs CR? If it's a rechargeable (often used with the DS1302) then make sure the correct charging setup is used. Make a simple sketch (use an example) to set the clock within your circuit to the compile time. Make another sketch that ONLY reads the time the RTC and upload it. Disconnect from power for some time (at least a few minutes). Then connect back to power and then serial output the date time and that should tell you if the RTC is keeping time when unpowered. |
Beta Was this translation helpful? Give feedback.
You are correct, calling
rtc.SetIsRunning(true)
will turn ON the oscillator, and thus the RTC will run even when not powered by VCC, but must have a valid battery. It sounds like you checked the battery already.Do you know if the battery you are using is a rechargeable? LIR vs CR? If it's a rechargeable (often used with the DS1302) then make sure the correct charging setup is used.
You can check by calling
rtc.GetTrickleChargeSettings()
.If it's not a rechargeable, call
rtc.SetTrickleChargeSettings(DS1302Tcr_Disabled)
.Make a simple sketch (use an example) to set the clock within your circuit to the compile time. Make another sketch that ONLY reads the time the RTC and upload it. Disconn…