There it says "The time is retrieved from the WiFi module which periodically fetches the NTP time from an NTP server." But what does periodically mean? From which servers? Which accuracy will be reached? It is hard to get the information from looking at the code which is why I want to ask here if anybody does already know the answers
Why do I need this information? I want to provide timestamps for measuring values and would like to call WiFi.getTime() every second. Thereore I would like to better understand whats going on under the hood. A more precise documentation would have been great for non-native developers like me
There was a similar question in the forum just a day ago. I have done a little experiment with Wireshark and Arduino Nano 33 IoT. I observed the following sequence:
Because WiFi needs an accurate clock, I suspect the internal time is stable and therefore the NTP calls likely do not happen very often. So, simply tracing all traffic with Wireshark to figure out the schedule will likely not work. The first call happens in the first 30 seconds or minute after starting WiFi.
There was a similar question in the forum just a day ago. I have done a little experiment with Wireshark and Arduino Nano 33 IoT. I observed the following sequence:
Because WiFi needs an accurate clock, I suspect the internal time is stable and therefore the NTP calls likely do not happen very often. So, simply tracing all traffic with Wireshark to figure out the schedule will likely not work. The first call happens in the first 30 seconds or minute after starting WiFi.
Hi Klaus, thank you for sharing. Smart solution at least for some questions But reading documentation would be nicer than reengineering Indeed, I didn't stumble over the similar question. Seems to me that google did not know this one yet. Sorry for that.
Juraj:
do you ask for the WiF101 library?
the library gets the time from the firmware in the ATMEL WINC1500.
Hi Juraj, that is exactly the case yes. I am using a WINC1500 module. I will have a closer look. Or do you already know the internals of the firmware and can tell me more?
Thanks
stev-e:
But reading documentation would be nicer than reengineering
I like documentation too, but documentation for software is much harder to maintain then for hardware. That is why hardware documentation is often of much higher quality.
Anyway, I repeated my experiment with an ATWINC1500 board. The result is slightly different.
Synchronous function to enable/disable the native Simple Network Time Protocol(SNTP) client in the WINC1500 firmware.
The SNTP is enabled by default at start-up.The SNTP client at firmware is used to synchronize the system clock to the UTC time from the well known time servers (e.g. "time-c.nist.gov"). The SNTP client uses a default update cycle of 1 day.
I looked at the firmware for the module and the name of the time server is hard coded into the firmware binary. So, if you do not want your module to use this time server you must disable the function and set the system time to the firmware yourself.
Hi Klaus, thanks again. I don't know yet if I would want to change the server. I will need to experiment a little bit to see what the standard behaviour is if e.g. there was no connection on controller startup time or the server couldn't be reached etc. My bigger concern was/is how precise the clock will be in the meantime until the next sync is scheduled. I found that the WINC1500 comes with a extra oscillator (https://ww1.microchip.com/downloads/en/DeviceDoc/ATWINC15x0B-MU-IEEE-802.11-b-g-n-Network-Controller-DS70005374B.pdf). I will have a look how much drift there is throughout the day.