<?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 iMX28 RTC clock and 32kHz oscillator in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX28-RTC-clock-and-32kHz-oscillator/m-p/247083#M21667</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a custom design where I want to run the RTC from an external 32.768kHz crystal&lt;/P&gt;&lt;P&gt;So I modified the mxs-rtc driver this way:&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;@@ -246,6 +246,11 @@ static int mxs_rtc_probe(struct platform_device *pdev)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (hwversion &amp;gt;&amp;gt; 16) &amp;amp; 0xFF,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hwversion &amp;amp; 0xFFFF);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable 32kHz oscillator in power off mode, source RTC with 32kHz clock&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; __raw_writel(BM_RTC_PERSISTENT0_XTAL32KHZ_PWRUP |&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BM_RTC_PERSISTENT0_CLOCKSOURCE,&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtc_data-&amp;gt;base + HW_RTC_PERSISTENT0_SET);&lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtc_data-&amp;gt;rtc = rtc_device_register(pdev-&amp;gt;name, &amp;amp;pdev-&amp;gt;dev,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;mxs_rtc_ops, THIS_MODULE);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (IS_ERR(rtc_data-&amp;gt;rtc)) {&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;This apparently worked on another custom design we made. I could see the 32kHz oscillation on a scope even after poweroff and measured roughly 11uA consumption from the battery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this is acting strangely on a similar custom design. Sometimes I can't see any oscillation with a scope, but I can tell the oscillator has been turned on, because I see a positive DC level on the XTAL pins roughly at 500mV. Sometimes the probe seems to help the oscillation, which starts slowly but it's not stable. Sometimes it seems the opposite: as soon as I connect the probe the oscillation seems to shut off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The weird fact is that the "date" command still works in all scenarios, whatever clock source I set in the RTC and whether or not the external crystal is populated. How can this happen?&lt;/P&gt;&lt;P&gt;Running "date" in a loop with 1 second delay shows that time is correclty updated.&lt;/P&gt;&lt;P&gt;Where does the "date" command get the current time of day? Does the RTC automatically fall back to the 24MHz clock source if the 32kHz is not found oscillating?&lt;/P&gt;&lt;P&gt;Any clues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Oct 2013 15:28:52 GMT</pubDate>
    <dc:creator>RoboTech</dc:creator>
    <dc:date>2013-10-30T15:28:52Z</dc:date>
    <item>
      <title>iMX28 RTC clock and 32kHz oscillator</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX28-RTC-clock-and-32kHz-oscillator/m-p/247083#M21667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a custom design where I want to run the RTC from an external 32.768kHz crystal&lt;/P&gt;&lt;P&gt;So I modified the mxs-rtc driver this way:&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;@@ -246,6 +246,11 @@ static int mxs_rtc_probe(struct platform_device *pdev)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (hwversion &amp;gt;&amp;gt; 16) &amp;amp; 0xFF,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hwversion &amp;amp; 0xFFFF);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable 32kHz oscillator in power off mode, source RTC with 32kHz clock&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp; __raw_writel(BM_RTC_PERSISTENT0_XTAL32KHZ_PWRUP |&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BM_RTC_PERSISTENT0_CLOCKSOURCE,&lt;/P&gt;
&lt;P&gt;+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtc_data-&amp;gt;base + HW_RTC_PERSISTENT0_SET);&lt;/P&gt;
&lt;P&gt;+&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtc_data-&amp;gt;rtc = rtc_device_register(pdev-&amp;gt;name, &amp;amp;pdev-&amp;gt;dev,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;mxs_rtc_ops, THIS_MODULE);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (IS_ERR(rtc_data-&amp;gt;rtc)) {&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;This apparently worked on another custom design we made. I could see the 32kHz oscillation on a scope even after poweroff and measured roughly 11uA consumption from the battery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this is acting strangely on a similar custom design. Sometimes I can't see any oscillation with a scope, but I can tell the oscillator has been turned on, because I see a positive DC level on the XTAL pins roughly at 500mV. Sometimes the probe seems to help the oscillation, which starts slowly but it's not stable. Sometimes it seems the opposite: as soon as I connect the probe the oscillation seems to shut off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The weird fact is that the "date" command still works in all scenarios, whatever clock source I set in the RTC and whether or not the external crystal is populated. How can this happen?&lt;/P&gt;&lt;P&gt;Running "date" in a loop with 1 second delay shows that time is correclty updated.&lt;/P&gt;&lt;P&gt;Where does the "date" command get the current time of day? Does the RTC automatically fall back to the 24MHz clock source if the 32kHz is not found oscillating?&lt;/P&gt;&lt;P&gt;Any clues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 15:28:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX28-RTC-clock-and-32kHz-oscillator/m-p/247083#M21667</guid>
      <dc:creator>RoboTech</dc:creator>
      <dc:date>2013-10-30T15:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: iMX28 RTC clock and 32kHz oscillator</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX28-RTC-clock-and-32kHz-oscillator/m-p/247084#M21668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will answer my own questions. Little bit of research showed that the "date" command does not use the RTC clock. The system time is updated independently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The command to use is "hwclock". This showed indeed that the 32kHz oscillator was running. The time/date is preserved after poweroff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scope probe causes problems to the oscillator. The time displayed by "hwclock" stops when I connect the probe. This is somewhat expected, even if I rarely had this kind of problems by simply probing crystal pins. I suspect something wrong with the design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting note: using the "memtool" command to switch the RTC clock source does not work and it leads to severe issues at next boot. I tried switching back to the 24MHz clock with: "memtool 80056060=100", but this only stopped the RTC count and turned off the 32kHz oscillator (I read a 0V on crystal pins). So I issued a "reboot" command, but the boot process stopped just after the bootlets give control to the kernel. The device does not seem to draw more current than usual boots, but it is stuck. I have to remove battery power to recover, external "RESET" pin does not help either (it does power down the device, but the next boot still hangs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps somebody else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 16:18:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX28-RTC-clock-and-32kHz-oscillator/m-p/247084#M21668</guid>
      <dc:creator>RoboTech</dc:creator>
      <dc:date>2013-10-30T16:18:29Z</dc:date>
    </item>
  </channel>
</rss>

