<?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 Software Development KitのトピックKV30 interrupt issue</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440176#M2776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm new here and, of course, I need your help. &lt;/P&gt;&lt;P&gt;I'm starting a new project using a MKV30F64VFM10. I'm using Kinetis Design Studio to develop code with Processor expert. After a while (!!!) I understand how to configure Clock, I/O, ... ("hardware" in one word) and it seems to work. In particular I tested an ADC input with different input values and their corrisponding digital values: good. After I developed the "Uart0 part" and checked it with a PC and this is working too. But all the Uart is developed in "polling mode", when I tried to do it in interrupt mode I started have problems. I think my mistake is in interrupt configuration, so I started a new project only to configurate a timer (PIT channel 0) to have interrupt every 10 secs; but it doesn't work... Now I try to explain the configuration I did, assuming MCG configuration is ok (I tested with an oscilloscope the bit duration on a 115200 baudrate Tx on uart0 and it is ok).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Components_Init() of Cpu.c (generated by processor expert I suppose) I have this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_SetPriority(PIT0_IRQn, 7U);&lt;/P&gt;&lt;P&gt;&amp;nbsp; OSA_InstallIntHandler(PIT0_IRQn,&amp;nbsp; pitTimer1_IRQHandler);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_Init(FSL_PITTIMER1,true);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_InitChannel(FSL_PITTIMER1,FSL_PITTIMER1_CHANNEL,&amp;amp;pitTimer1_InitConfig0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_StartTimer(FSL_PITTIMER1,FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In main.c, after PE_low_level_init();, I added this line:&lt;/P&gt;&lt;P&gt;__enable_irq();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //"cpsie i" to enable general interrupt&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in Events.c I have:&lt;/P&gt;&lt;P&gt;void pitTimer1_IRQHandler(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Clear interrupt flag.*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_HAL_ClearIntFlag(g_pitBase[FSL_PITTIMER1], FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Write your code here ... */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which is my Timer interrupt handler added by OSA_InstallIntHandler() (I always suppose) but when I debug the code this function is never executed!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I added in my main this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t MCR;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t LDVAL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t CVAL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t TCTRL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t TFLG;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t ISER;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t IABR;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t CLRENA;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for(;;) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; MCR = PIT_MCR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LDVAL = PIT_LDVAL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CVAL = PIT_CVAL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; TCTRL = PIT_TCTRL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; TFLG = PIT_TFLG0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ISER = NVIC-&amp;gt;ISER[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IABR = NVIC-&amp;gt;IABR[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CLRENA = NVIC-&amp;gt;ICER[1];&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;To control PIT values and NVIC settings.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;What I saw is that PIT_CVAL0 starts from a value (a conversion of my 10 seconds I believe) and it rolls down to 0 value (after 10 secs).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;When it reaches 0 PIT_TFLG0 goes from 0 to 1 (TIF bit means Timer Interrupt Flag set)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;NVIC-&amp;gt;ISER[1] and NVIC-&amp;gt;ICER[1] are both 0x10000 (This seems good for PIT channel 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;But NVIC-&amp;gt;IABR[1] is always 0 and interrupt doesn't come :-(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Finally I added these 3 lines inside the same loop (for(;;){...}):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if (TFLG &amp;amp; 0x01) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIT_HAL_ClearIntFlag(g_pitBase[FSL_PITTIMER1], FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to reset pending bit of PIT channel 0 and I saw that TIF bit goes to 0 and goes one more time to 1 after 10 secs...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me please, like you can see I'm not the one who ask for everything (all this I did by myself, without help) but now I don't know what else to do, please hele me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need more info please ask me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jul 2015 08:20:46 GMT</pubDate>
    <dc:creator>nicolag</dc:creator>
    <dc:date>2015-07-23T08:20:46Z</dc:date>
    <item>
      <title>KV30 interrupt issue</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440176#M2776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm new here and, of course, I need your help. &lt;/P&gt;&lt;P&gt;I'm starting a new project using a MKV30F64VFM10. I'm using Kinetis Design Studio to develop code with Processor expert. After a while (!!!) I understand how to configure Clock, I/O, ... ("hardware" in one word) and it seems to work. In particular I tested an ADC input with different input values and their corrisponding digital values: good. After I developed the "Uart0 part" and checked it with a PC and this is working too. But all the Uart is developed in "polling mode", when I tried to do it in interrupt mode I started have problems. I think my mistake is in interrupt configuration, so I started a new project only to configurate a timer (PIT channel 0) to have interrupt every 10 secs; but it doesn't work... Now I try to explain the configuration I did, assuming MCG configuration is ok (I tested with an oscilloscope the bit duration on a 115200 baudrate Tx on uart0 and it is ok).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Components_Init() of Cpu.c (generated by processor expert I suppose) I have this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_SetPriority(PIT0_IRQn, 7U);&lt;/P&gt;&lt;P&gt;&amp;nbsp; OSA_InstallIntHandler(PIT0_IRQn,&amp;nbsp; pitTimer1_IRQHandler);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_Init(FSL_PITTIMER1,true);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_InitChannel(FSL_PITTIMER1,FSL_PITTIMER1_CHANNEL,&amp;amp;pitTimer1_InitConfig0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_DRV_StartTimer(FSL_PITTIMER1,FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In main.c, after PE_low_level_init();, I added this line:&lt;/P&gt;&lt;P&gt;__enable_irq();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //"cpsie i" to enable general interrupt&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in Events.c I have:&lt;/P&gt;&lt;P&gt;void pitTimer1_IRQHandler(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Clear interrupt flag.*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; PIT_HAL_ClearIntFlag(g_pitBase[FSL_PITTIMER1], FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Write your code here ... */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which is my Timer interrupt handler added by OSA_InstallIntHandler() (I always suppose) but when I debug the code this function is never executed!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I added in my main this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t MCR;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t LDVAL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t CVAL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t TCTRL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t TFLG;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t ISER;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t IABR;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint32_t CLRENA;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for(;;) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; MCR = PIT_MCR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LDVAL = PIT_LDVAL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CVAL = PIT_CVAL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; TCTRL = PIT_TCTRL0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; TFLG = PIT_TFLG0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ISER = NVIC-&amp;gt;ISER[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IABR = NVIC-&amp;gt;IABR[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CLRENA = NVIC-&amp;gt;ICER[1];&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;To control PIT values and NVIC settings.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;What I saw is that PIT_CVAL0 starts from a value (a conversion of my 10 seconds I believe) and it rolls down to 0 value (after 10 secs).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;When it reaches 0 PIT_TFLG0 goes from 0 to 1 (TIF bit means Timer Interrupt Flag set)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;NVIC-&amp;gt;ISER[1] and NVIC-&amp;gt;ICER[1] are both 0x10000 (This seems good for PIT channel 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;But NVIC-&amp;gt;IABR[1] is always 0 and interrupt doesn't come :-(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Finally I added these 3 lines inside the same loop (for(;;){...}):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if (TFLG &amp;amp; 0x01) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIT_HAL_ClearIntFlag(g_pitBase[FSL_PITTIMER1], FSL_PITTIMER1_CHANNEL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to reset pending bit of PIT channel 0 and I saw that TIF bit goes to 0 and goes one more time to 1 after 10 secs...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me please, like you can see I'm not the one who ask for everything (all this I did by myself, without help) but now I don't know what else to do, please hele me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need more info please ask me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2015 08:20:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440176#M2776</guid>
      <dc:creator>nicolag</dc:creator>
      <dc:date>2015-07-23T08:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: KV30 interrupt issue</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440177#M2777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicola,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please attach your code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I can recommend to check this document that expresses how to handle interrupt in KSDK. It could be helpful for you.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-104352"&gt;Interrupt handling with KSDK and Kinetis Design Studio&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Jul 2015 00:18:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440177#M2777</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2015-07-25T00:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: KV30 interrupt issue</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440178#M2778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicola&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has this issue been resolved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 20:48:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440178#M2778</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2015-08-07T20:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: KV30 interrupt issue</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440179#M2779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Isaac, sorry for this delay but I had a "long time holyday" but now I'm back. My collegue (Isacco) solved this problem connecting via hardware the NMI pin to 5V through a pull up resistor. The problem was this pin that if not connected is in an Idle state and can generate an interrupt which if not handled causes a not handled interrupt but with high priority (and ignoring others of course).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thank you for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nicola&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 06:51:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KV30-interrupt-issue/m-p/440179#M2779</guid>
      <dc:creator>nicolag</dc:creator>
      <dc:date>2015-08-24T06:51:43Z</dc:date>
    </item>
  </channel>
</rss>

