<?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 I get stuck programming a timer register in DefaultISR loop with kl46z in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611801#M36215</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody.&lt;/P&gt;&lt;P&gt;I'am developing with a freedom-kl46z board. I have been to the forum but I didn't find something which could help me.&lt;/P&gt;&lt;P&gt;In fact I'am programming the TPM0 but when the debugger arrive to this line :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;TPM0_SC |= TPM_SC_PS(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The program go to the startup_MKL46Z4.S and stay to this loop :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;DefaultISR:&lt;BR /&gt; ldr r0, =DefaultISR&lt;BR /&gt; bx r0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I really don't know what to do. I've read this post :&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/534876"&gt;https://community.nxp.com/message/534876&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'am sure I use the right component.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If somebody have the same problem, could you help me ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I use to program my Tpm0 :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;//ENable clk for timer 0&lt;BR /&gt; SIM_SOPT4 |= 01000000;&lt;BR /&gt; //Enable MCGIRCLK p126&lt;BR /&gt; MCG_C1 |= 0x2;&lt;BR /&gt; //CHoose MCGIRCLK for TPM p132&lt;BR /&gt; SIM_SOPT2 = 0x03000000;&lt;/P&gt;&lt;P&gt;//32 prescaler 4MHZ/32 = 125 khz&lt;BR /&gt; TPM0_SC |= TPM_SC_PS(5);&lt;BR /&gt; //125KHz/125 = 1 Khz&lt;BR /&gt; TPM0_MOD = 125;&lt;/P&gt;&lt;P&gt;//Enable interrupt&lt;BR /&gt; TPM0_SC |= 1&amp;lt;&amp;lt;6;&lt;BR /&gt; NVIC_EnableIRQ(17);&lt;/P&gt;&lt;P&gt;//Module clock for timer 0&lt;BR /&gt; TPM0_SC |= 0x08;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Oct 2016 11:00:53 GMT</pubDate>
    <dc:creator>floridjam</dc:creator>
    <dc:date>2016-10-28T11:00:53Z</dc:date>
    <item>
      <title>I get stuck programming a timer register in DefaultISR loop with kl46z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611801#M36215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody.&lt;/P&gt;&lt;P&gt;I'am developing with a freedom-kl46z board. I have been to the forum but I didn't find something which could help me.&lt;/P&gt;&lt;P&gt;In fact I'am programming the TPM0 but when the debugger arrive to this line :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;TPM0_SC |= TPM_SC_PS(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The program go to the startup_MKL46Z4.S and stay to this loop :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;DefaultISR:&lt;BR /&gt; ldr r0, =DefaultISR&lt;BR /&gt; bx r0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I really don't know what to do. I've read this post :&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/534876"&gt;https://community.nxp.com/message/534876&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'am sure I use the right component.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If somebody have the same problem, could you help me ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code I use to program my Tpm0 :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;//ENable clk for timer 0&lt;BR /&gt; SIM_SOPT4 |= 01000000;&lt;BR /&gt; //Enable MCGIRCLK p126&lt;BR /&gt; MCG_C1 |= 0x2;&lt;BR /&gt; //CHoose MCGIRCLK for TPM p132&lt;BR /&gt; SIM_SOPT2 = 0x03000000;&lt;/P&gt;&lt;P&gt;//32 prescaler 4MHZ/32 = 125 khz&lt;BR /&gt; TPM0_SC |= TPM_SC_PS(5);&lt;BR /&gt; //125KHz/125 = 1 Khz&lt;BR /&gt; TPM0_MOD = 125;&lt;/P&gt;&lt;P&gt;//Enable interrupt&lt;BR /&gt; TPM0_SC |= 1&amp;lt;&amp;lt;6;&lt;BR /&gt; NVIC_EnableIRQ(17);&lt;/P&gt;&lt;P&gt;//Module clock for timer 0&lt;BR /&gt; TPM0_SC |= 0x08;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 11:00:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611801#M36215</guid>
      <dc:creator>floridjam</dc:creator>
      <dc:date>2016-10-28T11:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: I get stuck programming a timer register in DefaultISR loop with kl46z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611802#M36216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have forgotten to enable the TMP module before access.&lt;BR /&gt;You need to add something like&lt;BR /&gt;&lt;STRONG&gt;POWER_UP(6, SIM_SCGC6_FTM0);&lt;/STRONG&gt;&lt;BR /&gt;This equates to&lt;BR /&gt;&lt;STRONG&gt;SIM_SCGC6 |= 0x01000000;&lt;/STRONG&gt;&lt;BR /&gt;for TMP0 in the KL46 if you don't require portability.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;BR /&gt;&lt;SPAN&gt;Kinetis for professionals: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;HW Timer guide: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fdocs%2FuTasker%2FuTaskerHWTimers.PDF" rel="nofollow" target="_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Full KL46 solution to accelerate project developments: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FFRDM-KL46Z.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL46Z.html&lt;/A&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FTWR-KL46Z48M.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/TWR-KL46Z48M.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 18:30:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611802#M36216</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-10-28T18:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: I get stuck programming a timer register in DefaultISR loop with kl46z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611803#M36217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Florian,&lt;/P&gt;&lt;P&gt;As Mark said that you should set the TPM0 bit in the SIM_SCGC6 register so that you can write TPM0 register.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SIM_SCGC6 |= 0x01000000;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use internal clock MCGIRCLK as tick to drive TPM0&amp;nbsp; module, Pls follow up the procedure:&lt;/P&gt;&lt;P&gt;1)set CMOD bits in TPM0_SC as 2b"01&lt;/P&gt;&lt;P&gt;TPM0_SC |= 1&amp;lt;&amp;lt;3;&amp;nbsp;&amp;nbsp; //01 TPM counter increments on every TPM counter clock&lt;/P&gt;&lt;P&gt;2)select the MCGIRCLK as clock source for the TPM0 module&lt;/P&gt;&lt;P&gt;//Enable MCGIRCLK p126&lt;BR /&gt; MCG_C1 |= 0x2;&lt;/P&gt;&lt;P&gt;SIM_SOPT2 = 0x03000000;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you&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>Sun, 30 Oct 2016 05:25:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611803#M36217</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2016-10-30T05:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: I get stuck programming a timer register in DefaultISR loop with kl46z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611804#M36218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for both of you. It come from there I forget to enable the TMP module clock before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Oct 2016 10:00:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-get-stuck-programming-a-timer-register-in-DefaultISR-loop-with/m-p/611804#M36218</guid>
      <dc:creator>floridjam</dc:creator>
      <dc:date>2016-10-30T10:00:32Z</dc:date>
    </item>
  </channel>
</rss>

