<?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 MKE04Z8VTG4 problem with using internal clock source in FEI mode in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220033#M59417</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I am trying to develop embedded software for my new design. I used&amp;nbsp;MKE04Z8VTG4&amp;nbsp; microcontroller in this project. And you can find the schematic of&amp;nbsp;microcontroller's pins below to see the connections. I dont use crystal as a external clock source. I want to use internal reference clock with FLL.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135626iD354434869633200/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke.png" alt="mke.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;While I was trying to start up the system. I realized that code is stopping somewhere. By trying to set a output pin to high after line by line in code, and observing this output pin, I found the line where program&amp;nbsp;hangs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke2.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135628i4EAF159A5E3279A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke2.png" alt="mke2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke3.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135627i35CA8812DC4C71D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke3.png" alt="mke3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried two different code to initialize clock source, actually they are almost same. The upper one is from sdk library, the bottom one is taken from&amp;nbsp;&amp;nbsp;"&lt;SPAN class="fontstyle0"&gt;KE04 Sub-Family Reference Manual&lt;/SPAN&gt;".&amp;nbsp;&lt;/P&gt;&lt;P&gt;MCUXpresso(MCUXpressoIDE_11.3.0_5222),&lt;BR /&gt;SDK(SDK_2.9.0_MKE04Z8xxx4) and&lt;BR /&gt;MCUXpresso Config tools(MCUXpresso_Config_Tools_v9_x64) are latest versions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realized that, in debug mode everything works good. But If I program the MCU in release mode, it hangs.&lt;/P&gt;&lt;P&gt;In Release mode program cannot pass the FLL lock check line. Has anyone any idea? Thank you,&lt;/P&gt;&lt;P&gt;Okan,&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jan 2021 17:46:37 GMT</pubDate>
    <dc:creator>okaner</dc:creator>
    <dc:date>2021-01-24T17:46:37Z</dc:date>
    <item>
      <title>MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220033#M59417</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I am trying to develop embedded software for my new design. I used&amp;nbsp;MKE04Z8VTG4&amp;nbsp; microcontroller in this project. And you can find the schematic of&amp;nbsp;microcontroller's pins below to see the connections. I dont use crystal as a external clock source. I want to use internal reference clock with FLL.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135626iD354434869633200/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke.png" alt="mke.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;While I was trying to start up the system. I realized that code is stopping somewhere. By trying to set a output pin to high after line by line in code, and observing this output pin, I found the line where program&amp;nbsp;hangs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke2.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135628i4EAF159A5E3279A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke2.png" alt="mke2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke3.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135627i35CA8812DC4C71D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke3.png" alt="mke3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried two different code to initialize clock source, actually they are almost same. The upper one is from sdk library, the bottom one is taken from&amp;nbsp;&amp;nbsp;"&lt;SPAN class="fontstyle0"&gt;KE04 Sub-Family Reference Manual&lt;/SPAN&gt;".&amp;nbsp;&lt;/P&gt;&lt;P&gt;MCUXpresso(MCUXpressoIDE_11.3.0_5222),&lt;BR /&gt;SDK(SDK_2.9.0_MKE04Z8xxx4) and&lt;BR /&gt;MCUXpresso Config tools(MCUXpresso_Config_Tools_v9_x64) are latest versions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realized that, in debug mode everything works good. But If I program the MCU in release mode, it hangs.&lt;/P&gt;&lt;P&gt;In Release mode program cannot pass the FLL lock check line. Has anyone any idea? Thank you,&lt;/P&gt;&lt;P&gt;Okan,&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2021 17:46:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220033#M59417</guid>
      <dc:creator>okaner</dc:creator>
      <dc:date>2021-01-24T17:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220546#M59423</link>
      <description>&lt;P&gt;I solved problem. It was related with NMI pin used as MISO. It was working in debug mode, but it was crashing in release mode.&lt;/P&gt;&lt;P&gt;I insert "SIM-&amp;gt;SOPT &amp;amp;= ~SIM_SOPT_NMIE_MASK;" this line at the begining of the program. Now it works but I have problem when I enable "Enable link-time optimization" in c compiler settings.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke4.png" style="width: 956px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135699i73CA2808DE6BD017/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke4.png" alt="mke4.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 13:10:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220546#M59423</guid>
      <dc:creator>okaner</dc:creator>
      <dc:date>2021-01-25T13:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220760#M59428</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;1. Since the processor's default is the same as the code is setting you could in fact just remove the code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mjbcswitzerland_0-1611598971804.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135741iED968405C21D55D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mjbcswitzerland_0-1611598971804.png" alt="mjbcswitzerland_0-1611598971804.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. Changing BDIV can be performed at any time after the configuration since it has nothing to do with the FLL.&lt;BR /&gt;&lt;BR /&gt;3. I don't see any reason why the FLL lock bit would not always be set high since it never had to re-lock (unless it never locked in the first place due to an issue with the power supply). The processor is operating (to run the code), already clocked by the FLL's output clock - even if it is not actually in the "looked" state (if the reference source is missing for some reason and can't be locked to the FLL will tend to still oscillate at its natural frequency - unlike a PLL that will fail)&lt;/P&gt;&lt;P&gt;4. If running in debug mode (maybe no optimisation) but not in release mode (maybe optimised) check that the status register is declared as volatile to be sure it is really being read.&lt;BR /&gt;&lt;BR /&gt;5. Since your start up code is not in fact doing anything (just writing the default register values again) I would either temporarily remove the line that hangs or the complete initialisation (you can still set BDIV, DIV1 and DIV2 is you want slower core/bus/flash clocks but their defaults are also safe) and provisionally continue working with the board. When running you can also do some more analysis of the register states by reading and displaying them to get a feel for whether there is something wrong with the FLL lock flag behavior or performing other experiments&amp;nbsp; also test the loss of lock status to see whether it does lose lock generally - which again would point to an issue with the HW which is only really the power supply that could be externally influenced (whereby there is not a lot to experiment with if the FLL is to be used in its default state anyway).&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;BR /&gt;&lt;EM&gt;[uTasker project developer for Kinetis and i.MX RT]&lt;/EM&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or rapid product development requirements&lt;BR /&gt;&lt;BR /&gt;For professionals searching for faster, problem-free Kinetis and i.MX RT 10xx developments the uTasker project holds the key: &lt;A href="https://www.utasker.com/kinetis/FRDM-KE04Z.html" target="_blank"&gt;https://www.utasker.com/kinetis/FRDM-KE04Z.html&lt;/A&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 18:37:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1220760#M59428</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2021-01-25T18:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221597#M59448</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Thanks for &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1431"&gt;@mjbcswitzerland&lt;/a&gt;,I have debug this ,but the issue did not occur.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nxf58904_0-1611715732641.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135851i86C3984C1B4D306F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nxf58904_0-1611715732641.png" alt="nxf58904_0-1611715732641.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nxf58904_1-1611715767229.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135852i76425A06F0DB6DFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nxf58904_1-1611715767229.png" alt="nxf58904_1-1611715767229.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;"Now it works but I have problem when I enable "Enable link-time optimization" in c compiler settings."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;What is this issue? Will it optimize your code ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 02:57:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221597#M59448</guid>
      <dc:creator>nxf58904</dc:creator>
      <dc:date>2021-01-27T02:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221768#M59452</link>
      <description>&lt;P&gt;What is the actual problem you are facing with link time optimization?&lt;/P&gt;&lt;P&gt;And yes, it will aggressively optimize your code, and if it is not careful written for time sensitive parts your application might not work, so you need to be careful about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 08:03:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221768#M59452</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2021-01-27T08:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221921#M59455</link>
      <description>&lt;P&gt;First of all thank you for your answers.&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/1431"&gt;@mjbcswitzerland&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/85570"&gt;@nxf58904&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;. The first problem was as I explained related with NMI pin. Probably by chance or somehow it was always hanging at the FLL lock line. after I insert&amp;nbsp;&lt;SPAN&gt;"SIM-&amp;gt;SOPT &amp;amp;= ~SIM_SOPT_NMIE_MASK;" this line at startup, problem is solved. I can repeat same problem when I remove that line.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Since my uController just have 8k flash, I am trying to enable all optimization options. I saw that if I enable -link time optimization(no matter what level of optimization I selected in linker settings), the PIT interrupt does not work. "PIT_CH0_IRQHandler" function is not called.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke5.png" style="width: 992px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135914iAF04FF28DE76B4EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke5.png" alt="mke5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw somewhere that they have said, linker may remove if the attribute weak is defined. Probably linker cannot find the usage of these functions so they are removed. I tried to use "used" attribute but it did not helped.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mke6.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135918i51BE7DDBCA559081/image-size/large?v=v2&amp;amp;px=999" role="button" title="mke6.png" alt="mke6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you have any suggestion, I can try.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Okan,&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 11:16:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221921#M59455</guid>
      <dc:creator>okaner</dc:creator>
      <dc:date>2021-01-27T11:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221991#M59456</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Another possibility is to use the free Open Source uTasker project on GITHUB &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt; which supports the KE04 and was developed for small code size with full optimisation in all IDE environments.&lt;/P&gt;&lt;P&gt;It also simulates the KE04, which further helps distinguish between effects due to HW, lack of RAM resources or compiler/optimiser issues.&lt;/P&gt;&lt;P&gt;Regrds&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 14:29:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1221991#M59456</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2021-01-27T14:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: MKE04Z8VTG4 problem with using internal clock source in FEI mode</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1222374#M59462</link>
      <description>&lt;P&gt;I will try it later. Thank you...&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 05:09:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MKE04Z8VTG4-problem-with-using-internal-clock-source-in-FEI-mode/m-p/1222374#M59462</guid>
      <dc:creator>okaner</dc:creator>
      <dc:date>2021-01-28T05:09:07Z</dc:date>
    </item>
  </channel>
</rss>

