Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
SNTP Client
SNTP service is a Simple Network Time Protocol, a simplified version of NTP protocol for embedded
devices. Using this feature, Flyport can download from the internet network very precise time
information from dedicated time servers.
Using this feature, Flyport can always be in sync with “real world” time. Every embedded system has
it's own timers and counters, but they are usually related to a unspecific starting time. In addition,
the Flyport Real Time Clock Calendar (RTCC) must be set to a starting point, and this setting should be
done by a user task.
With SNTP, Flyport can synchronize the RTCC with real time, or send emails at defined actual times,
with “timestamps, or display a webpage with a constantly updated clock value.
NOTE: SNTPClient service is not enabled by default project configuration. Please use IDE wizard to
enable it, or compilatiling process will fail.
SNTP Functionalities
The result of a SNTP request will be a 32 bit (DWORD) that is the count of seconds from January 1
st
1970 to the current time. So 0 is the value related tot January 1
st
, 1970 00h:00min:00sec, 3 is the
value at 1st January 1970 00h:00min:03sec, and so on.
Converting functions are used to extract the actual time from the 32-bit value obtained from an SNTP
request. To convert the DWORD value to a user friendly structure in the openPicus framework, 3
processing steps are needed:
DWORD → Tme_t → struct tm
Using this 3 step conversion, all the timing values become easy to access and are formatted as
minutes, seconds, days, months, etc...
An external file called “heap.s” is needed to perform the conversion. The contents of heap.s is:
.section my_heap,heap
.space 0x0080
The heap.s function contains just a few commands, but they are necessary for correct compilation of
the SNTP helper functions.
This file should be included or created in a project using theExternal Libs” tool.
NOTE: If theexternal lib” tool is used, the “heap.s” file should be placed outside the project folder!
66