<?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 Re: TPM0 Timerinterrupt on MKL27Z in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660244#M40510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not clear what EnableIRQ does, but I don't see where the interrupt is enabled and the interrupt priority is set in the NVIC.&amp;nbsp; The TPM0 for KL27 uses NVIC_IPR4 bits 14:15, and it would be bit 17 in the NVIC_ISER to enable it.&amp;nbsp; You should probably also add the attribute tag __attribute__((interrupt("IRQ"))) to your function to declare that it's an interrupt handler.&amp;nbsp; I'm assuming that TPM0_IRQHandler is already weakly defined in the vector table so that it's latching on to the handler you've made. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Oct 2016 00:13:53 GMT</pubDate>
    <dc:creator>dsherman</dc:creator>
    <dc:date>2016-10-22T00:13:53Z</dc:date>
    <item>
      <title>TPM0 Timerinterrupt on MKL27Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660243#M40509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using FRDM-KL27Z with Kinetis Design Studio&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somehow i dont get the Interrupt working.&amp;nbsp;I'm sure to oversee something.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#include "board.h"&lt;BR /&gt;#include "pin_mux.h"&lt;BR /&gt;#include "clock_config.h"&lt;BR /&gt;#include "fsl_device_registers.h"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void TPM0_IRQHandler(void){&lt;BR /&gt; GPIOB-&amp;gt;PTOR = 1 &amp;lt;&amp;lt; 18;&lt;BR /&gt; TPM2-&amp;gt;SC |= TPM_SC_TOF_MASK;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;volatile int count;&lt;BR /&gt;int main(void) {&lt;/P&gt;&lt;P&gt;// Init board hardware.&lt;BR /&gt; BOARD_InitPins();&lt;BR /&gt; BOARD_BootClockRUN();&lt;BR /&gt; BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;MCG-&amp;gt;C1 = MCG_C1_IREFSTEN_MASK | MCG_C1_IRCLKEN_MASK;&lt;BR /&gt;MCG-&amp;gt;C2 = MCG_C2_IRCS_MASK;&lt;BR /&gt;SIM-&amp;gt;SCGC6 |= SIM_SCGC6_TPM0_MASK;&lt;BR /&gt;SIM-&amp;gt;SOPT2 |= SIM_SOPT2_TPMSRC(3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPM0-&amp;gt;SC = TPM_SC_CMOD(0) | TPM_SC_PS(7);&lt;BR /&gt;TPM0-&amp;gt;MOD = 0xFF;&lt;/P&gt;&lt;P&gt;TPM0-&amp;gt;SC |= TPM_SC_TOIE_MASK;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;EnableIRQ(TPM0_IRQn);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;SIM-&amp;gt;SCGC5 |= SIM_SCGC5_PORTB_MASK;&lt;BR /&gt;PORTB-&amp;gt;PCR[18] = PORT_PCR_MUX(1);&lt;/P&gt;&lt;P&gt;GPIOB-&amp;gt;PDDR = 1 &amp;lt;&amp;lt; 18;&lt;/P&gt;&lt;P&gt;TPM0-&amp;gt;SC |= TPM_SC_TOF(1);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; for(;;) {&amp;nbsp;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;count = TPM0-&amp;gt;CNT;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It compiles and the timer (cnt) is increasing.&lt;/P&gt;&lt;P&gt;TOF gets set too. Setting it to 0 (in debugtools) didnt help. its just 0 until it changes again to 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 21:24:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660243#M40509</guid>
      <dc:creator>paultargo</dc:creator>
      <dc:date>2016-10-21T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: TPM0 Timerinterrupt on MKL27Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660244#M40510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not clear what EnableIRQ does, but I don't see where the interrupt is enabled and the interrupt priority is set in the NVIC.&amp;nbsp; The TPM0 for KL27 uses NVIC_IPR4 bits 14:15, and it would be bit 17 in the NVIC_ISER to enable it.&amp;nbsp; You should probably also add the attribute tag __attribute__((interrupt("IRQ"))) to your function to declare that it's an interrupt handler.&amp;nbsp; I'm assuming that TPM0_IRQHandler is already weakly defined in the vector table so that it's latching on to the handler you've made. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Oct 2016 00:13:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660244#M40510</guid>
      <dc:creator>dsherman</dc:creator>
      <dc:date>2016-10-22T00:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: TPM0 Timerinterrupt on MKL27Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660245#M40511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;Please add below code to start the TPM counter.&lt;/P&gt;&lt;P&gt;TPM0-&amp;gt;SC |= TPM_SC_CMOD(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code below should be used to clear the Timer Overflow Flag of TPM0 In TPM0_IRQHandler.&lt;/P&gt;&lt;P&gt;TPM0-&amp;gt;SC |= TPM_SC_TOF_MASK;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2016 08:31:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/TPM0-Timerinterrupt-on-MKL27Z/m-p/660245#M40511</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2016-10-25T08:31:42Z</dc:date>
    </item>
  </channel>
</rss>

