Sinapse-Energia / talking-fiber

Firmware for optic fiber activity detection. Based on M3 MCU
0 stars 1 forks source link

[Time Synchronization][NTP] To synchronize with NTP only when needed #17

Open ralcaide opened 5 years ago

ralcaide commented 5 years ago

The time to be used in TF should be always provide the RTC. The RTC is synchronized with NTP only first time of connection and each N hours (set in Definitions.h). If NTP is not available, time will be set with command 127;

ralcaide commented 5 years ago

@fpgamcu, how is now done the time management? Please provide feedback and check if working as expected

ralcaide commented 5 years ago

We need feedback about that also ASAP. We are observing strange behaviors in testing environment

ghost commented 5 years ago

Currently the RTC is used. It is synchronized with TIME server at first connection. Each N hours synchronization is not implemented. 127; command was removed in #10

ghost commented 5 years ago

As I understand need to bring back 127; and add Each N hours synchronization.

ralcaide commented 5 years ago

Ok, by the moment is not necessary to add 127; but will be necessary to perform synchronization once per day.

The implemented behavior is almost the required one but in our tests seems is not working great. Several times, the published hour is 00:00:XX, it is like the hour is reset or the RTC is not counting well. Any idea?

Also, with periodic publications each 720 min (12h), the device is publishing several times:

Any idea?.

We need the device manages well the time and publish only once when is needed

ralcaide commented 5 years ago

We need more feedback about this question:

ralcaide commented 5 years ago

@fpgamcu , could you please answer the above questions?. And also, could we use a period of 1440 min or we will have problems related RTC missbehaviour?

ghost commented 5 years ago

We are using internal MCU RTC

ghost commented 5 years ago

As from tests results it is managed ok, we are using mode in that RTC is working (STOP mode). RTC is initialized by TIME server. Maximum period is 1439 according to current realization of scheduler.

ralcaide commented 5 years ago

Is initialized during first connection but was not refreshed. Is already refreshed each N hours? We want to refresh it each 24 hours. How is managed the "first time" connection?

ghost commented 5 years ago

At start of the device it is connecting to TIME server and getting time, than M95 is powering off. Refresh code is not added, I will add it.