<?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>Kinetis Microcontrollers中的主题 Switch to RTC on first power on with K60</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611695#M36210</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have four custom K60 designs where I need to switch to the RTC as my main input clock relatively early in the boot process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I attempt to switch, and then monitor the loss of clock bit. If it goes high I clear it and retry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the first time that both prime and battery power are applied, the K60 can never seem to successfully switch to the RTC. After prime power is cycled, and battery remains, the switch occurs without any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the reason why the clock monitor has issues with the RTC the first power on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Dec 2016 13:45:35 GMT</pubDate>
    <dc:creator>norton256</dc:creator>
    <dc:date>2016-12-14T13:45:35Z</dc:date>
    <item>
      <title>Switch to RTC on first power on with K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611695#M36210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have four custom K60 designs where I need to switch to the RTC as my main input clock relatively early in the boot process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I attempt to switch, and then monitor the loss of clock bit. If it goes high I clear it and retry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the first time that both prime and battery power are applied, the K60 can never seem to successfully switch to the RTC. After prime power is cycled, and battery remains, the switch occurs without any problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the reason why the clock monitor has issues with the RTC the first power on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2016 13:45:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611695#M36210</guid>
      <dc:creator>norton256</dc:creator>
      <dc:date>2016-12-14T13:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to RTC on first power on with K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611696#M36211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Nick,&lt;/P&gt;&lt;P&gt;What is the part number you are using now?&lt;/P&gt;&lt;P&gt;Do you want to route the external clock or crystal signal from Extal32/Xtal32 to the FLL so that you can use FEE mode for MCG module? If it is the case, can you past the code here so that we can have a review?&lt;/P&gt;&lt;P&gt;Do you use crystal or clock source for the Extal32/Xtal32?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 06:03:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611696#M36211</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-12-15T06:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to RTC on first power on with K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611697#M36212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the MK60FN1M0VMD12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code for the full clock transition module is pretty big. I use many of the MCG modes in our application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The particular mode where this gets stuck is a switch from FEI (default) mode to FBE (yes, I am trying to run at 32 kHz).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a crystal connected to Extal32/Xtal32.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The location where my clock switch code gets stuck is here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (nextClockSource == Clocking_RTC)&lt;BR /&gt; {&lt;BR /&gt; // disable OSC0 monitor&lt;BR /&gt; MCG_C6 &amp;amp;= ~MCG_C6_CME_MASK;&lt;BR /&gt; // disable OCS1 monitor&lt;BR /&gt; MCG_C12 &amp;amp;= ~MCG_C12_CME2_MASK;&lt;BR /&gt; // enable RTC monitor&lt;BR /&gt; MCG_C8 |= MCG_C8_CME3_MASK;&lt;/P&gt;&lt;P&gt;while(1) &amp;lt;----------------- stuck in this loop!!!!!&lt;BR /&gt; {&lt;BR /&gt; if ((MCG_C8 &amp;amp; MCG_C8_LOCS3_MASK) == 0)&lt;BR /&gt; {&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; MCG_C8 |= MCG_C8_LOCS3_MASK;&lt;BR /&gt; for(j = 0; j &amp;lt; 1000000; ++j); // delay&lt;BR /&gt; i++;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before this I set the clock monitor to interrupt instead of reset, and I disable the Monitor Interrupt Vector so that I can poll. At this point I have only enabled the RTC, the MCU is still in FEI mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:58:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611697#M36212</guid>
      <dc:creator>norton256</dc:creator>
      <dc:date>2016-12-15T13:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to RTC on first power on with K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611698#M36213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Although I do not have a test, I think you can try the following code.&lt;/P&gt;&lt;P&gt;If you use FBE mode with 32K crystal with Extal32/Xtal32 pins, you have to set the OSCE bit in RTC_CR reg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RTC_CR|=0x100;&lt;/P&gt;&lt;P&gt;MCG_C8 |= MCG_C8_CME3_MASK;&lt;/P&gt;&lt;P&gt;while(1) &amp;lt;----------------- stuck in this loop!!!!!&lt;BR /&gt; {&lt;BR /&gt; if ((MCG_C8 &amp;amp; MCG_C8_LOCS3_MASK) == 0)&lt;BR /&gt; {&lt;BR /&gt; break;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;Pls have a try.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Dec 2016 03:59:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611698#M36213</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-12-16T03:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Switch to RTC on first power on with K60</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611699#M36214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is already done before the code I pasted before:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;switch(clockSwitchParams.ClockSource)&lt;BR /&gt; {&lt;BR /&gt; case Clocking_RTC:&lt;BR /&gt; {&lt;BR /&gt; SIM_SCGC6 |= SIM_SCGC6_RTC_MASK;&lt;/P&gt;&lt;P&gt;RTC_CR |= RTC_CR_OSCE_MASK;&lt;BR /&gt; RTC_CR &amp;amp;= ~RTC_CR_CLKO_MASK;&lt;/P&gt;&lt;P&gt;break;&lt;BR /&gt; }&lt;BR /&gt; case Clocking_Osc0External:&lt;BR /&gt; {&lt;BR /&gt; if (!module-&amp;gt;Osc0Initialized)&lt;BR /&gt; {&lt;BR /&gt; // configure the MCG_C2 register&lt;BR /&gt; // the RANGE value is determined by the external frequency. Since the RANGE parameter affects the FRDIV divide value&lt;BR /&gt; // it still needs to be set correctly even if the oscillator is not being used&lt;BR /&gt; &lt;BR /&gt; temp_reg = MCG_C2;&lt;BR /&gt; temp_reg &amp;amp;= ~(MCG_C2_RANGE_MASK | MCG_C2_HGO_MASK | MCG_C2_EREFS_MASK); // clear fields before writing new values&lt;BR /&gt; &lt;BR /&gt; temp_reg |= MCG_C2_RANGE(1);&lt;/P&gt;&lt;P&gt;MCG_C2 = temp_reg;&lt;/P&gt;&lt;P&gt;// Enable the external reference sourced from OSC0&lt;BR /&gt; OSC0_CR |= 0x80;&lt;/P&gt;&lt;P&gt;module-&amp;gt;Osc0Initialized = TRUE;&lt;BR /&gt; }&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence my confusion. Is there something odd about the startup time requirement? If the clock is monitored before that expires it is forever wacky?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Dec 2016 14:21:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Switch-to-RTC-on-first-power-on-with-K60/m-p/611699#M36214</guid>
      <dc:creator>norton256</dc:creator>
      <dc:date>2016-12-16T14:21:24Z</dc:date>
    </item>
  </channel>
</rss>

