<?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:  PIT as timer interrupt for DAC- KL25Z  in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PIT-as-timer-interrupt-for-DAC-KL25Z/m-p/725220#M7645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ofir&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIT module take bus speed as the reference clock, How do you have setup the bus speed? depending on this speed, you will have to load a value to PIT_LDVAL0. Also, I didn't see where you are clearing the MDIS bit of the PIT_MCR register, this field must be enabled before any other setup is done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Apr 2018 21:51:50 GMT</pubDate>
    <dc:creator>jorge_a_vazquez</dc:creator>
    <dc:date>2018-04-18T21:51:50Z</dc:date>
    <item>
      <title>PIT as timer interrupt for DAC- KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PIT-as-timer-interrupt-for-DAC-KL25Z/m-p/725219#M7644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="direction: ltr;"&gt;HI,&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&amp;nbsp;I tried to send signal with DAC in fixed times using PIT timer interrupt (the value of the signal is changing as the PIT interrupt occur). I configured the PIT timer to interrupt in each 1ms and what I get in&amp;nbsp;oscilloscope which test the signal&amp;nbsp; is&amp;nbsp;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;that the signal is changed in any 5ms and not 1ms as i thought.&lt;/P&gt;&lt;P style="direction: ltr;"&gt;here is the setting of the the clocks, DAC and the PIT Interrupt.&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&lt;STRONG&gt;please tell me if&amp;nbsp;&amp;nbsp;something with my setting is wrong&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;void InitPIT(){&lt;/P&gt;&lt;P style="direction: ltr;"&gt;SIM_SCGC6 |= SIM_SCGC6_PIT_MASK; //Enable the Clock to the PIT Modules&lt;/P&gt;&lt;P style="direction: ltr;"&gt;// Timer 0&lt;/P&gt;&lt;P style="direction: ltr;"&gt;PIT_LDVAL0 = 0x0000BB80; // setup timer 0 for 1msec counting period&lt;/P&gt;&lt;P style="direction: ltr;"&gt;PIT_TCTRL0 = PIT_TCTRL_TEN_MASK | PIT_TCTRL_TIE_MASK; //enable PIT0 and its interrupt&lt;/P&gt;&lt;P style="direction: ltr;"&gt;PIT_MCR |= PIT_MCR_FRZ_MASK; // stop the pit when in debug mode&lt;/P&gt;&lt;P style="direction: ltr;"&gt;enable_irq(INT_PIT-16); // //Enable PIT IRQ on the NVIC&lt;/P&gt;&lt;P style="direction: ltr;"&gt;set_irq_priority(INT_PIT-16,0); // Interrupt priority = 0 = max&lt;/P&gt;&lt;P style="direction: ltr;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;void InitDAC(){&lt;/P&gt;&lt;P style="direction: ltr;"&gt;//When the DAC is enabled and the buffer is not enabled,&amp;nbsp;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;//the DAC module always converts the data in DAT0 to analog output voltage.&lt;/P&gt;&lt;P style="direction: ltr;"&gt;// pin PTE30 is by default (ALT0) configured as DAC0_OUT&lt;/P&gt;&lt;P style="direction: ltr;"&gt;//VDDA reference voltage (Use this option for the best ADC operation).&lt;/P&gt;&lt;P style="direction: ltr;"&gt;SIM_SCGC6 |= SIM_SCGC6_DAC0_MASK; //DAC0 Clock Gate Control&lt;/P&gt;&lt;P style="direction: ltr;"&gt;DAC0_C0 |= DAC_C0_DACEN_MASK + DAC_C0_DACRFS_MASK + DAC_C0_DACTRGSEL_MASK + DAC_C0_LPEN_MASK;&amp;nbsp;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;}&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;void PIT_IRQHandler(){&lt;BR /&gt; if (state==2){ //if state=2 deliver signal out will enter each 1ms (I don't know why the scope show 5ms)&lt;BR /&gt; sampleNumOut=sampleNumOut%41;&lt;BR /&gt; DAC0_DAT0H = ((int)samplesArray[sampleNumOut] &amp;amp; 0xF00)&amp;gt;&amp;gt; 8; //deliver the signal of the DAC out (DAT0H=DAC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATA High Register)&lt;BR /&gt; DAC0_DAT0L = (int)samplesArray[sampleNumOut] &amp;amp; 0x0FF; //deliver the signal of the DAC out (DAT0L=DAC DATA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOW Register)&lt;BR /&gt; sampleNumOut++; &lt;BR /&gt; }&lt;BR /&gt; // When software trigger is selected, a conversion is initiated following a write to SC1A&lt;BR /&gt; ADC0_SC1A = POT_ADC_CHANNEL | ADC_SC1_AIEN_MASK; //here for other purpose.&lt;BR /&gt; PIT_TFLG0 = PIT_TFLG_TIF_MASK; //clear the Pit 0 Irq flag &lt;BR /&gt;}&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&lt;/P&gt;&lt;P style="direction: ltr;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;thank you&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2018 22:05:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PIT-as-timer-interrupt-for-DAC-KL25Z/m-p/725219#M7644</guid>
      <dc:creator>ofiryaish</dc:creator>
      <dc:date>2018-04-11T22:05:43Z</dc:date>
    </item>
    <item>
      <title>Re:  PIT as timer interrupt for DAC- KL25Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PIT-as-timer-interrupt-for-DAC-KL25Z/m-p/725220#M7645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ofir&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIT module take bus speed as the reference clock, How do you have setup the bus speed? depending on this speed, you will have to load a value to PIT_LDVAL0. Also, I didn't see where you are clearing the MDIS bit of the PIT_MCR register, this field must be enabled before any other setup is done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Jorge Alcala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2018 21:51:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PIT-as-timer-interrupt-for-DAC-KL25Z/m-p/725220#M7645</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2018-04-18T21:51:50Z</dc:date>
    </item>
  </channel>
</rss>

