-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetIsRunning() returns 0 after SetDateTime from NTP event #37
Comments
In the NTP sync event handler might be the problem. In most callbacks from the network, you need to avoid calling anything of any length (like serial or wire classes). Try storing the time and a flag that states you need to set the date/time, and then in your loop check for this flag, set date time, and clear the flag. Also, Is the battery in good condition? A battery that is on the edge causes problems also. |
Thanks for instant response :) |
I've removed all Serial calls from NTP event handler but problem still persists (though I have to wait few or more hours). After GetIsRunning() and IsDateTimeValid() functions start to consequently return false statuses I restart the controller and just after boot function 'printDateTime()' taken from the example prints '85/165/2009 37:165:':
Part of my code is attached. |
What is the debug output of your date time from NTP before you call setdatetime? Setting an incorrect date and time will also cause this. |
With NTP DEBUG flag enabled.
|
Hello, Do you have any solution or workaround? Thanks. |
Can you provide a minimum sketch that reproduced the problem? I will try to debug it. One work around could be if GetIsRunning() returns false, then call begin() again and see if that resets it. |
Thank you for the suggestion will try it and replace the battery also. |
Okay so the issue seems to be resolved: No change after
After some googling I found the following issue: So I always restarted the NodeMCU and after the restart the error occurred (NTP was called on boot as well). Applying the fix: http://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/index.html As I understand the I2C lines were left in a wrong state and couldn't recover from it after a reset. Thanks for the help! |
I've also ran across a similar issue while trying to switch between multiple I2C buses, tried a couple of the I2C recovery methods and a modified Wire library with no success. It appears that doing Wire.begin() with a new set of pin also leaves the previous ones in a wrong state (using multiple Wire objects didn't help). changing my program from
to
Solved the issue, hope this can help others. |
I've had the same issue with it running by itself, when i ran checking routines in loop without a delay. Once i put second device on I2C it seems to have helped a lot. I will check code but, i think i inadvertently came across that same soln as loadletter. |
This seems to be esp8266 specific and may have been fixed with the latest Esp8266 Arduino release (2.4.2). |
Same issue on ESP32. It's hard to debug, cause you need to wait a few hours after device boot to get false on IsDateTimeValid. I'll write my solution if I'll solve this. |
Something to try, can put another device on the bus. Some of the 3231 have a eeprom on the module and thus bus, some don't. |
Already tried three modules of two different types. One of this: https://ebay.to/2OLqUd0, and two of this: https://ebay.to/2I1UfNX. Same behaviour. They works perfectly if don't set time initially by NTP. |
@nikuz How you set the time isn't really the issue, the problem is more than likely that WiFi is effecting the I2C communications (Wire) that are used to communicate with the RTC. Have you brought this up on the Esp32-Arduino group? I do see lots of issues with i2C, but nothing specific to this problem yet. |
Esp32 seems to still have issues espressif/arduino-esp32#1998 |
closing due to being stale (and related bugs in esp32 have also either been fixed or gone stale). NOTE: The error handling has been improved since this issue was created and calling |
Hi,
I'm periodically calling
RTCDS3231.SetDateTime(RtcDateTime(year(), month(), day(), hour(), minute(), second()));
in NTP time sync event handler to update RTC time from internet.The problem is after such operation
RTCDS3231.GetIsRunning()
and 'RTCDS3231.IsDateTimeValid()' functions are starting to return FALSE status.I've even tried to call
RTCDS3231.SetIsRunning(true)
after that but without any result.RTC seems to initialize succesfully and returns right time just after boot.
What can be wrong?
Greetings,
robert
ESP8266 ESP-12F / Arduino IDE 1.6.12
The text was updated successfully, but these errors were encountered: