<?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>topic Re: Question about _rtc_get_time in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333562#M10747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On the contrary, it is guaranteed to go through the loop at least twice, because at the end of the first iteration *time will be zero and tmp will be the result of reading the registers (presumably non-zero). Thus the condition evaluates as true and it loops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Oct 2014 21:33:52 GMT</pubDate>
    <dc:creator>matthewkendall</dc:creator>
    <dc:date>2014-10-17T21:33:52Z</dc:date>
    <item>
      <title>Question about _rtc_get_time</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333561#M10746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking at the _rtc_get_time source code in srtc.c for MQX 4.1.0 (I'm using it in a VF65GS10 project) and believe I may have found a bug. Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t tmp = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *time = tmp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp&amp;nbsp;&amp;nbsp; = (snvs-&amp;gt;LPSRTCMR &amp;lt;&amp;lt; 17) | (snvs-&amp;gt;LPSRTCLR &amp;gt;&amp;gt; 15) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } while (tmp != *time);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is apparently trying to achieve a coherent read of the two RTC registers by continually reading them until it obtains two consecutive identical values. However, this code will always go through the do/while only one time, because of the way the tmp variable is initialized. To operate correctly the first line should instead be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t tmp = (snvs-&amp;gt;LPSRTCMR &amp;lt;&amp;lt; 17) | (snvs-&amp;gt;LPSRTCLR &amp;gt;&amp;gt; 15) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 17:55:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333561#M10746</guid>
      <dc:creator>rogerchaplin</dc:creator>
      <dc:date>2014-10-17T17:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question about _rtc_get_time</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333562#M10747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On the contrary, it is guaranteed to go through the loop at least twice, because at the end of the first iteration *time will be zero and tmp will be the result of reading the registers (presumably non-zero). Thus the condition evaluates as true and it loops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 21:33:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333562#M10747</guid>
      <dc:creator>matthewkendall</dc:creator>
      <dc:date>2014-10-17T21:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question about _rtc_get_time</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333563#M10748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply. I must have been having a bad logic day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2014 02:02:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Question-about-rtc-get-time/m-p/333563#M10748</guid>
      <dc:creator>rogerchaplin</dc:creator>
      <dc:date>2014-10-21T02:02:56Z</dc:date>
    </item>
  </channel>
</rss>

