<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software SolutionsのトピックRTCS SNTP Always Timeout</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177866#M2482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use SNTP_oneshot to fetch the time on system start , but i always get timeout , i do not understand what is wrong ,I have initilized my network before using sntp_oneshot, i tried using the same code and tested with my local ip just to see wheather ntp request reach the destination or not.It does reach the destination , attached is the image showing packets captured using wireshark.It timeouts even with any public ntp server.Could anyone suggest what might be wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In attached image : &lt;/P&gt;&lt;P&gt;IP OF MQX : 192.168.10.6&lt;/P&gt;&lt;P&gt;IP OF WINDOWS MACHINE : 192.168.10.19&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set The time using SNTP&amp;nbsp; // 192.168.10.19 ip of windows machine which possibly has ntp server &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("Fetching Time\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; error = SNTP_oneshot(inet_addr("192.168.10.19"),20000);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (error!=RTCS_OK){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IF some error print it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(error==RTCSERR_TIMEOUT) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("SNTP Timeout\n"); &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ntp.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/11019iBA0C7BC7B3400C3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="ntp.JPG" alt="ntp.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Nov 2012 04:44:04 GMT</pubDate>
    <dc:creator>mohwaqas12</dc:creator>
    <dc:date>2012-11-16T04:44:04Z</dc:date>
    <item>
      <title>RTCS SNTP Always Timeout</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177866#M2482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use SNTP_oneshot to fetch the time on system start , but i always get timeout , i do not understand what is wrong ,I have initilized my network before using sntp_oneshot, i tried using the same code and tested with my local ip just to see wheather ntp request reach the destination or not.It does reach the destination , attached is the image showing packets captured using wireshark.It timeouts even with any public ntp server.Could anyone suggest what might be wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In attached image : &lt;/P&gt;&lt;P&gt;IP OF MQX : 192.168.10.6&lt;/P&gt;&lt;P&gt;IP OF WINDOWS MACHINE : 192.168.10.19&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set The time using SNTP&amp;nbsp; // 192.168.10.19 ip of windows machine which possibly has ntp server &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf("Fetching Time\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp; error = SNTP_oneshot(inet_addr("192.168.10.19"),20000);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (error!=RTCS_OK){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IF some error print it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(error==RTCSERR_TIMEOUT) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("SNTP Timeout\n"); &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ntp.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/11019iBA0C7BC7B3400C3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="ntp.JPG" alt="ntp.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 04:44:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177866#M2482</guid>
      <dc:creator>mohwaqas12</dc:creator>
      <dc:date>2012-11-16T04:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: RTCS SNTP Always Timeout</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177867#M2483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This problem seemed to be solved. I used public ntp server this time , and i got the reply and time was set, but i dont understand why did it get timeout before so many times. Do i have to give some delay to let rtcs initialization to complete before i run sntp_oneshot. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now working on setting time to correct timezone , i think i have to plus or minus ticks from the the time struct and set mqx time again with _time_set . &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 06:56:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177867#M2483</guid>
      <dc:creator>mohwaqas12</dc:creator>
      <dc:date>2012-11-16T06:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: RTCS SNTP Always Timeout</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177868#M2484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are watching on the reply from server NTP I believe you used windows w32tm service the server respond to yours ntp request with server 3 version ! If you go deeper in the sntp request when you receive the packet form the server you will make a comparation with the&amp;nbsp; transmitted message and watch to see if the received header is validated in function "SNTP_valid_header" and another problem is if you watch on the flags you will have set the Unsyncronized alarm set so this means your clock source is not valid! &lt;/P&gt;&lt;P&gt;In the flags field you have :&lt;/P&gt;&lt;P&gt;b7--- b6, b5---b3, b2--b0&lt;/P&gt;&lt;P&gt;Alarm, NTP ver, Mode (serv/client)&lt;/P&gt;&lt;P&gt;So in your send packet you have 0xdc that means 11 for alarm (Unsync), 011,NTP Server ver3, and 100 mode Server&lt;/P&gt;&lt;P&gt;The alarm don't let you to set the correct time and give you timeout error form SNTp_oneshot !&lt;/P&gt;&lt;P&gt;I hope I fully clarify yours problem !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 14:33:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/RTCS-SNTP-Always-Timeout/m-p/177868#M2484</guid>
      <dc:creator>Nana</dc:creator>
      <dc:date>2012-12-19T14:33:17Z</dc:date>
    </item>
  </channel>
</rss>

