<?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>S32KのトピックRe: FlexTimer Example SW=4 [s32k144]</title>
    <link>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766884#M2258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I&amp;nbsp;slightly modified the code.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;/* Interrupt routine to determine period of tested signal */
void FTM0_Ch0_Ch1_IRQHandler(void) 
{
&amp;nbsp; period[counter] = FTM0-&amp;gt;CONTROLS[0].CnV - temp;
&amp;nbsp; temp = FTM0-&amp;gt;CONTROLS[0].CnV;
&amp;nbsp; FTM0-&amp;gt;CONTROLS[0].CnSC &amp;amp;= ~FTM_CnSC_CHF_MASK; // clear channel flag
&amp;nbsp; counter++;
&amp;nbsp; if((counter) == 20){
&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM1-&amp;gt;SC = 0;
&amp;nbsp; }
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The results:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/29624i4D056B04D6627928/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Since&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;FTM1-&amp;gt;MOD = FTM_MOD_MOD(11200 - 1); // Set Modulo (10kHz PWM frequency @112MHz system clock)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result seems to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2020 14:07:06 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2020-11-02T14:07:06Z</dc:date>
    <item>
      <title>FlexTimer Example SW=4 [s32k144]</title>
      <link>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766881#M2255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to the community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running the example (#define SW 4) of the Single Edge Capture, but all the variables have the same result. Even those which are not being used. What could be the problem here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/358i20996C21E9F217A0/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jorge&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 14:11:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766881#M2255</guid>
      <dc:creator>electronica2pow</dc:creator>
      <dc:date>2018-04-25T14:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: FlexTimer Example SW=4 [s32k144]</title>
      <link>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766882#M2256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm unable to compile the attached project for some reason.&lt;/P&gt;&lt;P&gt;Does the interrupt trigger?&lt;/P&gt;&lt;P&gt;What is the value of&amp;nbsp;FTM0-&amp;gt;CONTROLS[0].CnSC in the register view?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 14:33:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766882#M2256</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2018-04-26T14:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: FlexTimer Example SW=4 [s32k144]</title>
      <link>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766883#M2257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a new project in order to allow you to compile it. I attached it below.&lt;/P&gt;&lt;P&gt;Yes, it is triggering and the counter is working ok, but i don't know why i can't get the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12010i6B70F6D3B2E3C004/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/12144iF8E0EB0BA3F5D43A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * main implementation: use this 'C' sample to create your own application&lt;BR /&gt; *&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#include "S32K144.h" /* include peripheral declarations S32K144 */&lt;/P&gt;&lt;P&gt;uint32_t temp, counter, FTM0_CH0_period;&lt;/P&gt;&lt;P&gt;/* Transmit from RUN mode to HSRUN mode */&lt;BR /&gt;void HSRUN_Init()&lt;BR /&gt;{&lt;BR /&gt; SMC-&amp;gt;PMPROT=SMC_PMPROT_AHSRUN_MASK // Allows High Speed Run&lt;BR /&gt; |SMC_PMPROT_AVLP_MASK; // Allows Very Low Power Modes&lt;BR /&gt; SMC-&amp;gt;PMCTRL=SMC_PMCTRL_RUNM(3); // Entry to High Speed Run&lt;BR /&gt; /* Wait for High Speed Run mode */&lt;BR /&gt; while(SMC-&amp;gt;PMSTAT != SMC_PMSTAT_PMSTAT(128))&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* System oscillator and HSRUN configuration */&lt;BR /&gt;void SCG_Init()&lt;BR /&gt;{&lt;BR /&gt; /* SOSC Configuration&lt;BR /&gt; * OSC_OUT = 8MHz, 8MHz EXTAL */&lt;/P&gt;&lt;P&gt;SCG-&amp;gt;SOSCDIV=SCG_SOSCDIV_SOSCDIV1(1) // System OSC DIV1=1&lt;BR /&gt; |SCG_SOSCDIV_SOSCDIV2(1); // System OSC DIV2=1&lt;BR /&gt; SCG-&amp;gt;SOSCCFG=SCG_SOSCCFG_RANGE(2) // Medium frequency range OSC 1-8MHz&lt;BR /&gt; |SCG_SOSCCFG_EREFS(1); // Select internal OSC&lt;BR /&gt; while(SCG-&amp;gt;SOSCCSR &amp;amp; SCG_SOSCCSR_LK_MASK); // Wait for SOSCCSR unlocked state&lt;BR /&gt; SCG-&amp;gt;SOSCCSR=SCG_SOSCCSR_SOSCEN_MASK; // Enable OSC&lt;BR /&gt; // | SCG_SOSCCSR_SOSCLPEN_MASK // Enable OSC in very low power modes&lt;BR /&gt; while(!(SCG-&amp;gt;SOSCCSR &amp;amp; SCG_SOSCCSR_SOSCVLD_MASK)); // Wait for OSC enabling and valid output&lt;/P&gt;&lt;P&gt;/* SPLL Configuration&lt;BR /&gt; * PLL_OUT = 112MHz, 8MHz EXTAL */&lt;/P&gt;&lt;P&gt;SCG-&amp;gt;SPLLDIV=SCG_SPLLDIV_SPLLDIV1(1) // PLL DIV1=1&lt;BR /&gt; |SCG_SPLLDIV_SPLLDIV2(1); // PLL DIV2=1&lt;BR /&gt; SCG-&amp;gt;SPLLCFG=SCG_SPLLCFG_PREDIV(0) // PLL PREDIV=0&lt;BR /&gt; |SCG_SPLLCFG_MULT(12); // PLL MULT=28&lt;BR /&gt; while(SCG-&amp;gt;SPLLCSR &amp;amp; SCG_SPLLCSR_LK_MASK); // Wait for SPLLCSR unlocked state&lt;BR /&gt; SCG-&amp;gt;SPLLCSR=SCG_SPLLCSR_SPLLEN_MASK; // Enable PLL&lt;BR /&gt; while(!(SCG-&amp;gt;SPLLCSR &amp;amp; SCG_SPLLCSR_SPLLVLD_MASK)); // Wait for PLL enabling and valid output&lt;/P&gt;&lt;P&gt;/* HCCR Configuration&lt;BR /&gt; * PLL_OUT = 112MHz, 8MHz EXTAL */&lt;/P&gt;&lt;P&gt;SCG-&amp;gt;HCCR=SCG_HCCR_SCS(6) // PLL source clock&lt;BR /&gt; |SCG_HCCR_DIVCORE(0) // DIVCORE=1, Core=112MHz&lt;BR /&gt; |SCG_HCCR_DIVBUS(1) // DIVBUS=2, BUS=56MHz&lt;BR /&gt; |SCG_HCCR_DIVSLOW(3); // DIVSLOW=4, Flash=28MHz&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* FTM1 is initialized to generate signals for Single-Edge Capture Mode of FTM0&lt;BR /&gt; * and Dual-Edge Capture Mode of FTM0 */&lt;BR /&gt;void Signals_Generator()&lt;BR /&gt;{&lt;BR /&gt; /* Enable clock for FTM1 */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_FTM1_INDEX] = PCC_PCCn_PCS(6) | PCC_PCCn_CGC_MASK;&lt;BR /&gt; /* Enable clock for PORTB */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_PORTB_INDEX] = PCC_PCCn_CGC_MASK;&lt;BR /&gt; /* Enable clock for PORTC */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK;&lt;/P&gt;&lt;P&gt;PORTB-&amp;gt;PCR[2] = PORT_PCR_MUX(2); // Set PTB2 for FTM1 – Channel0&lt;BR /&gt; PORTB-&amp;gt;PCR[3] = PORT_PCR_MUX(2); // Set PTB3 for FTM1 – Channel1&lt;BR /&gt; PORTD-&amp;gt;PCR[8] = PORT_PCR_MUX(6); // Set PTD8 for FTM1 – Channel4&lt;BR /&gt; PORTD-&amp;gt;PCR[9] = PORT_PCR_MUX(6); // Set PTD9 for FTM1 – Channel5&lt;/P&gt;&lt;P&gt;FTM1-&amp;gt;CONTROLS[0].CnSC=FTM_CnSC_MSB_MASK|FTM_CnSC_ELSB_MASK; // Select high-true pulses&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[1].CnSC=FTM_CnSC_MSB_MASK|FTM_CnSC_ELSB_MASK; // Select high-true pulses&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[4].CnSC=FTM_CnSC_MSB_MASK|FTM_CnSC_ELSB_MASK; // Select high-true pulses&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[5].CnSC=FTM_CnSC_MSB_MASK|FTM_CnSC_ELSB_MASK; // Select high-true pulses&lt;BR /&gt; FTM1-&amp;gt;MOD = FTM_MOD_MOD(11200 - 1); // Set Modulo (10kHz PWM frequency @112MHz system clock)&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[0].CnV=FTM_CnV_VAL(2800); // Set channel Value&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[1].CnV=FTM_CnV_VAL(5600); // Set channel Value&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[4].CnV=FTM_CnV_VAL(1000); // Set channel Value&lt;BR /&gt; FTM1-&amp;gt;CONTROLS[5].CnV=FTM_CnV_VAL(5600); // Set channel Value&lt;BR /&gt; FTM1-&amp;gt;CNT = 0; // Counter reset&lt;BR /&gt; FTM1-&amp;gt;SC|=FTM_SC_CLKS(1)|FTM_SC_PWMEN0_MASK|FTM_SC_PWMEN1_MASK|FTM_SC_PWMEN4_MASK&lt;BR /&gt; |FTM_SC_PWMEN5_MASK; // Select clock and enable PWM&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* SW=4 - Single-Edge Capture Mode */&lt;BR /&gt;void FTM0_Single_Edge_Capture_Mode()&lt;BR /&gt;{&lt;BR /&gt; /* Enable clock for PORTD */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK;&lt;BR /&gt; /* Select and enable clock for FTM0 */&lt;BR /&gt; PCC-&amp;gt;PCCn[PCC_FTM0_INDEX] = PCC_PCCn_PCS(6) | PCC_PCCn_CGC_MASK;&lt;/P&gt;&lt;P&gt;PORTD-&amp;gt;PCR[15] = PORT_PCR_MUX(2); // Set PTD15 for FTM0 - Channel0&lt;BR /&gt; S32_NVIC-&amp;gt;ICPR[99 / 32] = 1 &amp;lt;&amp;lt; (99 % 32); /* IRQ48-FTM0 ch0: clr any pending IRQ*/&lt;BR /&gt; S32_NVIC-&amp;gt;ISER[99 / 32] = (1 &amp;lt;&amp;lt; (99 % 32)); // Enable FTM0 interrupt&lt;/P&gt;&lt;P&gt;/* Input capture mode sensitive on rising edge to measure period of tested signal */&lt;BR /&gt; FTM0-&amp;gt;CONTROLS[0].CnSC = 0x48u; //Falling edge 0x48u; Rising FTM_CnSC_ELSA_MASK | FTM_CnSC_CHIE_MASK (Enable Interrupt)&lt;BR /&gt; //Rising or Falling 0x4Cu (Enable interrupt 0x40u);&lt;BR /&gt; /* Reset counter */&lt;BR /&gt; FTM0-&amp;gt;CNT = 0;&lt;BR /&gt; /* Select clock */&lt;BR /&gt; FTM0-&amp;gt;SC = FTM_SC_CLKS(1);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void WDOG_disable (void) {&lt;BR /&gt; WDOG-&amp;gt;CNT=0xD928C520; /* Unlock watchdog */&lt;BR /&gt; WDOG-&amp;gt;TOVAL=0x0000FFFF; /* Maximum timeout value */&lt;BR /&gt; WDOG-&amp;gt;CS = 0x00002100; /* Disable watchdog */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;WDOG_disable();&lt;BR /&gt; SCG_Init();&lt;BR /&gt; HSRUN_Init();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /* Single-Edge Capture Mode */&lt;/P&gt;&lt;P&gt;Signals_Generator();&lt;BR /&gt; FTM0_Single_Edge_Capture_Mode();&lt;/P&gt;&lt;P&gt;for(;;);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void FTM0_IRQHandler() { /* Interrupt routine to determine period of tested signal */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; counter++;&lt;BR /&gt; FTM0_CH0_period = FTM0-&amp;gt;CONTROLS[0].CnV - temp; // Period calculation&lt;BR /&gt; temp = FTM0_CH0_period + temp; // Save C0V value into the variable&lt;BR /&gt; FTM0-&amp;gt;CONTROLS[0].CnSC &amp;amp;= ~FTM_CnSC_CHF_MASK; // clear channel flag&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2018 11:49:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766883#M2257</guid>
      <dc:creator>electronica2pow</dc:creator>
      <dc:date>2018-04-27T11:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: FlexTimer Example SW=4 [s32k144]</title>
      <link>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766884#M2258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I&amp;nbsp;slightly modified the code.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;/* Interrupt routine to determine period of tested signal */
void FTM0_Ch0_Ch1_IRQHandler(void) 
{
&amp;nbsp; period[counter] = FTM0-&amp;gt;CONTROLS[0].CnV - temp;
&amp;nbsp; temp = FTM0-&amp;gt;CONTROLS[0].CnV;
&amp;nbsp; FTM0-&amp;gt;CONTROLS[0].CnSC &amp;amp;= ~FTM_CnSC_CHF_MASK; // clear channel flag
&amp;nbsp; counter++;
&amp;nbsp; if((counter) == 20){
&amp;nbsp;&amp;nbsp;&amp;nbsp; FTM1-&amp;gt;SC = 0;
&amp;nbsp; }
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The results:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/29624i4D056B04D6627928/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Since&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;FTM1-&amp;gt;MOD = FTM_MOD_MOD(11200 - 1); // Set Modulo (10kHz PWM frequency @112MHz system clock)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result seems to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:07:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/FlexTimer-Example-SW-4-s32k144/m-p/766884#M2258</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-11-02T14:07:06Z</dc:date>
    </item>
  </channel>
</rss>

