title: LPC17xx: Check if RTC is running
body: <p>I am using NXP LPC17xx family microcontrollers (LPC1759 and LPC1768).</p>
  
  <p>How can I determine if RTC is running for sure?</p>
  
  <p>I am doing a test on</p>
  
  <pre><code>LPC_RTC-&gt;CCR &amp; RTC_CCR_CLKEN
  </code></pre>
  
  <p>but it seems no much reliable.
  I have seen values in year 3197 or so when turning on my device.</p>
  
  <p>How can I tell if RTC is running and its value is not corrupt?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>I ended up adding a simple sanity check in RTC values:</p>
  
  <pre><code>bool        DateTime::validate( const RTC_TIME_Type &amp;time_info )
  {
         if ( time_info.YEAR &gt; 2100
                 || time_info.DOY &gt; 366
                 || time_info.MONTH &gt; 12
                 || time_info.DOM &gt; 31
                 || time_info.HOUR &gt; 23
                 || time_info.MIN &gt; 59
                 || time_info.SEC &gt; 59 )
                 return        false;
  
         return        true;
  }
  </code></pre>
  
  <p>It is run during my POST, as suggested bellow.</p>