<?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 SCTIMER_SetupCaptureAction not working ? in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1177180#M42772</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using LPC822. I want to measure an input square wave signal from a falling edge to next falling edge. My code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;uint32_t fallEvent;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;uint32_t CaptureT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;void CAP_init(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// configure the input mux for the sct timer input0 from external pin&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;INPUTMUX_Init(INPUTMUX);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;INPUTMUX_AttachSignal(INPUTMUX, 0U, kINPUTMUX_SctPin0ToSct0);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimer_config_t sctimerInfo;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;/* Enable clock of sct. */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;CLOCK_EnableClock(kCLOCK_Sct);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_GetDefaultConfig(&amp;amp;sctimerInfo);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableCounterUnify = false; // 2 contadores (H y L) de 16 bits cada uno&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.clockMode = kSCTIMER_System_ClockMode;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Rise_Input_0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableBidirection_l = false;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableBidirection_h = false;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.prescale_l = 3U; // dividido por 4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.prescale_h = 0U; // dividido por 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.outInitState = 0U;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.inputsync = (1 &amp;lt;&amp;lt; 0U); // Sincronizar la entrada con el reloj del SCT para no perder pulsos.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;/* Initialize SCTimer module */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_Init(SCT0, &amp;amp;sctimerInfo);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_InputFallEvent, 0u, kSCTIMER_Input_0, kSCTIMER_Counter_L, &amp;amp;fallEvent); //creates event on data input pin transition&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_SetupCaptureAction(SCT0, kSCTIMER_Counter_L, &amp;amp;CaptureT, fallEvent); //captures input on pin fall transition event&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// Define event interrupt callback&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_SetCallback(SCT0, ctimer_cap0_callback, fallEvent);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// Enable interrupt&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_EnableInterrupts(SCT0, 1&amp;lt;&amp;lt;fallEvent);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;NVIC_EnableIRQ(SCT0_IRQn);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;void ctimer_cap0_callback(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint32_t capturelatch;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;capturelatch = CaptureT; // It fails&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//capturelatch = SCT0-&amp;gt;COUNT; // It works&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;When fall event happens "ctimer_cap0_callback" is called but "CaptureT" register has 0 value. In the other hand, if I read STC0-&amp;gt;COUNT counter value is correct. Why CaptureT is not getting counter value when defining "SCTIMER_SetupCaptureAction" ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asier.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2020 14:35:10 GMT</pubDate>
    <dc:creator>asier</dc:creator>
    <dc:date>2020-11-03T14:35:10Z</dc:date>
    <item>
      <title>SCTIMER_SetupCaptureAction not working ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1177180#M42772</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using LPC822. I want to measure an input square wave signal from a falling edge to next falling edge. My code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;uint32_t fallEvent;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;uint32_t CaptureT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;void CAP_init(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// configure the input mux for the sct timer input0 from external pin&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;INPUTMUX_Init(INPUTMUX);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;INPUTMUX_AttachSignal(INPUTMUX, 0U, kINPUTMUX_SctPin0ToSct0);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimer_config_t sctimerInfo;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;/* Enable clock of sct. */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;CLOCK_EnableClock(kCLOCK_Sct);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_GetDefaultConfig(&amp;amp;sctimerInfo);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableCounterUnify = false; // 2 contadores (H y L) de 16 bits cada uno&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.clockMode = kSCTIMER_System_ClockMode;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Rise_Input_0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableBidirection_l = false;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.enableBidirection_h = false;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.prescale_l = 3U; // dividido por 4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.prescale_h = 0U; // dividido por 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.outInitState = 0U;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;sctimerInfo.inputsync = (1 &amp;lt;&amp;lt; 0U); // Sincronizar la entrada con el reloj del SCT para no perder pulsos.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;/* Initialize SCTimer module */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_Init(SCT0, &amp;amp;sctimerInfo);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_InputFallEvent, 0u, kSCTIMER_Input_0, kSCTIMER_Counter_L, &amp;amp;fallEvent); //creates event on data input pin transition&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_SetupCaptureAction(SCT0, kSCTIMER_Counter_L, &amp;amp;CaptureT, fallEvent); //captures input on pin fall transition event&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// Define event interrupt callback&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_SetCallback(SCT0, ctimer_cap0_callback, fallEvent);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;// Enable interrupt&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_EnableInterrupts(SCT0, 1&amp;lt;&amp;lt;fallEvent);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;NVIC_EnableIRQ(SCT0_IRQn);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;void ctimer_cap0_callback(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;uint32_t capturelatch;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;capturelatch = CaptureT; // It fails&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//capturelatch = SCT0-&amp;gt;COUNT; // It works&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="3" color="#808080"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;When fall event happens "ctimer_cap0_callback" is called but "CaptureT" register has 0 value. In the other hand, if I read STC0-&amp;gt;COUNT counter value is correct. Why CaptureT is not getting counter value when defining "SCTIMER_SetupCaptureAction" ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asier.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 14:35:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1177180#M42772</guid>
      <dc:creator>asier</dc:creator>
      <dc:date>2020-11-03T14:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: SCTIMER_SetupCaptureAction not working ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1179504#M42803</link>
      <description>&lt;P&gt;Any answer about that ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I keep a sequence at defining Event, Limit, Capture or another action ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asier.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 15:49:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1179504#M42803</guid>
      <dc:creator>asier</dc:creator>
      <dc:date>2020-11-06T15:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: SCTIMER_SetupCaptureAction not working ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1180922#M42830</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.&lt;/P&gt;
&lt;P&gt;The sequence you are following for setting the events is correct. SCTIMER_SetupCaptureAction seems the ideal option for what you try to accomplish&amp;nbsp; From this I can suggest to modify this line:&lt;/P&gt;
&lt;P&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Fall_Input_0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SCTIMER_CreateAndScheduleEvent returns an status flag, you could check that flag to assure that the event was successfully created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this helpful, if you have more questions do not hesitate to ask me.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Omar&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 17:55:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1180922#M42830</guid>
      <dc:creator>Omar_Anguiano</dc:creator>
      <dc:date>2020-11-10T17:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: SCTIMER_SetupCaptureAction not working ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1186644#M42965</link>
      <description>&lt;P&gt;Hello Omar,&lt;/P&gt;&lt;P&gt;Why do you suggest "&lt;SPAN&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Fall_Input_0;" ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was not getting capture value in my variable (CaptureT), so finally I've writed code this way:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SCT0-&amp;gt;SCTCAPCTRL[0] = (1U &amp;lt;&amp;lt; fallEvent);&amp;nbsp;&lt;/P&gt;&lt;P&gt;SCT0-&amp;gt;REGMODE = (1U &amp;lt;&amp;lt; fallEvent); // Capture mode&lt;/P&gt;&lt;P&gt;SCT0-&amp;gt;LIMIT = (1U &amp;lt;&amp;lt; fallEvent);&lt;/P&gt;&lt;P&gt;Thank you for your time,&lt;/P&gt;&lt;P&gt;Asier.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 10:42:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTIMER-SetupCaptureAction-not-working/m-p/1186644#M42965</guid>
      <dc:creator>asier</dc:creator>
      <dc:date>2020-11-20T10:42:03Z</dc:date>
    </item>
  </channel>
</rss>

