Home > Forum > IEC 61131 Programming (LogicLab) > Synchronization with NTP server
- This topic has 1 replies, 2 participants and was last updated 4 years, 7 months ago da Sergio Bertana.
-
AuthorPost
-
June 13, 2019 at 8: 56 am #48136Enrico VivianiParticipant
Hi I'm trying to sync a Mps046_XTarget_12_0 Runtime system: 1.10.3 with an NTP server but I can't get results. I have tried all the servers it.ntp.pool.org inrim.it europe.pool.ntp.org without success, here is the code I use.
SNTPReq(NTPServer:=ADR(server),Query:=LookFor AND EnableNTP,SpyOn:=TRUE); IF (SNTPReq.Done) THEN IF (SNTPReq.Ok) THEN i:=SysSetUTCDateTime(SNTPReq.UTCTime); LookFor:=FALSE; bFound:=TRUE; END_IF; IF (SNTPReq.Fault) THEN LookFor:=FALSE; changeserver:=TRUE; END_IF; END_IF;
Here is the result of the Spy:
10:25:24(9999)|Lg|-------------------------------------------[Start NTP request]- 10:25:39(9999)|Er|UDP Client error:09943135 10:25:39(0014)|Er|Error:10052110
September 25, 2019 at 7: 22 am #49998Sergio BertanaAdministrator ForumI reply late because the post was finished in SPAM, but the question may be useful to others.
9943135 Address resolution error, indicating that the UDP client is unable to resolve the IP address to connect to. In fact from what you write it seems you are passing the URL of the server, but on ARM systems such as the MPS046 the operating system does not have the DNS management and cannot resolve the URLs.
DNS server management was introduced on the systems CortexM7, on ARM systems it is necessary to pass the IP address, it is possible by program to use the FB DNSRequest to execute the request to the DNS URL resolution server and then switch to the FB SNTPRequest the IP address returned.
-
AuthorPost
- You must be logged in to reply to this topic.