<?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: MCXN SCTIMER in MCX Microcontrollers</title>
    <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1986584#M1889</link>
    <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;SPAN&gt;Hang.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your code is&amp;nbsp;pretty much the same as mine, unless you use Center-Aligned PWM mode and the same dutycycle value when you change the PWM frequency.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe changing the PWM frequency at run-time is possible only with the current dutycycle value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What about the 'event' variable? It needs to be cleared before changing the PWM frequency at run-time?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Nov 2024 17:07:17 GMT</pubDate>
    <dc:creator>Vagni</dc:creator>
    <dc:date>2024-11-03T17:07:17Z</dc:date>
    <item>
      <title>MCXN SCTIMER</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1984591#M1864</link>
      <description>&lt;P&gt;I successfully run the SDK sctimer_pwm_with_dutycycle_change example program on the MCX-N5XX-EVK board.&amp;nbsp;I successfully changed the PWM mode from Center-Aligned to Edge-Aligned.&lt;/P&gt;&lt;P&gt;But I get the following issues:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The SCT outputs a short high impulse when I set 0% duty cycle.&lt;/LI&gt;&lt;LI&gt;The SCT outputs a short low impulse when I set 100% duty cycle.&lt;/LI&gt;&lt;LI&gt;In addition to the dudty cycle, I also need to change the PWM frequency run-time, so I tried to re-configure the PWM with my following function:&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;short PWM_FreqSet( unsigned long pwmFreq_Hz, unsigned char duty)
{
	short RetVal = 0;
    sctimer_pwm_signal_param_t pwmParam;
    uint32_t sctimerClock = SCTIMER_CLK_FREQ;

	/* Stop the 32-bit unify timer */
    SCTIMER_StopTimer(SCT0, kSCTIMER_Counter_U);

	/* Configure PWM with the new frequency */
	pwmParam.output           = DEMO_SCTIMER_OUT;
	pwmParam.level            = kSCTIMER_HighTrue;
	pwmParam.dutyCyclePercent = duty;
	if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, pwmFreq_Hz, sctimerClock, &amp;amp;eventNumberOutput) == kStatus_Success)
	{
		RetVal = 1;
		/* Start the 32-bit unify timer */
		SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_U);
	}
	
	return RetVal;
}
​&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;But it does not work, although &lt;SPAN&gt;SCTIMER_SetupPwm() returns&amp;nbsp;kStatus_Success&lt;/SPAN&gt;. And, after the first calling to my PWM_FreqSet() function, the PWM timer does not work any more, I need to reset my board to recover it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to fix those issues on SCTIMER?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 08:59:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1984591#M1864</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2024-10-30T08:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN SCTIMER</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1985924#M1882</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/3989"&gt;@Vagni&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;1. When setting 0% duty cycle or&amp;nbsp;100% duty cycle,&amp;nbsp;This can be done by bypassing the PWM setup logic and directly setting output pin high.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;2. I try to change&amp;nbsp;PWM Frequency at Runtime.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    /* Configure first PWM with frequency 24kHZ from first output */
    pwmParam.output           = DEMO_FIRST_SCTIMER_OUT;
    pwmParam.level            = kSCTIMER_HighTrue;
    pwmParam.dutyCyclePercent = 50;
    if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_CenterAlignedPwm, 48000U, sctimerClock, &amp;amp;event) == kStatus_Fail)
    {
        return -1;
    }

    /* Start the 32-bit unify timer */
    SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_U);

    SCTIMER_StopTimer(SCT0, kSCTIMER_Counter_U);

    /* Configure PWM with the new frequency */
    pwmParam.output           = DEMO_FIRST_SCTIMER_OUT;
    pwmParam.level            = kSCTIMER_HighTrue;
    pwmParam.dutyCyclePercent = 50;
    if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_CenterAlignedPwm, 24000U, sctimerClock, &amp;amp;event) == kStatus_Fail)
    {
	return -1;
    }
    SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_U);&lt;/LI-CODE&gt;
&lt;P&gt;It can work.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HangZhang_0-1730434429340.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/308023iBFF5930B644979FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HangZhang_0-1730434429340.png" alt="HangZhang_0-1730434429340.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HangZhang_1-1730434447701.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/308024iE7F71762DF3DBCA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HangZhang_1-1730434447701.png" alt="HangZhang_1-1730434447701.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;BR&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;Hang&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 04:14:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1985924#M1882</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-11-01T04:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN SCTIMER</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1986584#M1889</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;SPAN&gt;Hang.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your code is&amp;nbsp;pretty much the same as mine, unless you use Center-Aligned PWM mode and the same dutycycle value when you change the PWM frequency.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe changing the PWM frequency at run-time is possible only with the current dutycycle value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What about the 'event' variable? It needs to be cleared before changing the PWM frequency at run-time?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2024 17:07:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1986584#M1889</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2024-11-03T17:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN SCTIMER</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1987548#M1901</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/3989"&gt;@Vagni&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Maybe changing the PWM frequency at run-time is possible only with the current dutycycle value?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp;What about the 'event' variable? It needs to be cleared before changing the PWM frequency at run-time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I test it, i change the PWM frequency at run-time directly, it can work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hang&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 02:51:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN-SCTIMER/m-p/1987548#M1901</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-11-05T02:51:57Z</dc:date>
    </item>
  </channel>
</rss>

