<?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 回复： 一个使用Pwm驱动ws2812的问题 in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1491590#M20680</link>
    <description>&lt;P&gt;hello, &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/89833"&gt;@diego_charles&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, and sorry for the late response.&lt;/P&gt;&lt;P&gt;There're &lt;STRONG&gt;timer(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;lcdif(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;gpio(priority 4),&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;spi master(priority 1)&lt;/STRONG&gt;, &lt;STRONG&gt;spi slave(priority 1)&lt;/STRONG&gt;, another &lt;STRONG&gt;spi slave(priority 0)&lt;/STRONG&gt;, &lt;STRONG&gt;pit(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;uart(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;usb(priority 1)&lt;/STRONG&gt; and &lt;STRONG&gt;eflexpwm(priority 5)&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;interrupts.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my application is running an bare-metal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It seems that my current interrupt priority configuration is a bit confusing, I'm wondering, how to set interrupt priority properly.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 08:01:09 GMT</pubDate>
    <dc:creator>5angxr</dc:creator>
    <dc:date>2022-07-19T08:01:09Z</dc:date>
    <item>
      <title>一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1473305#M20104</link>
      <description>&lt;P&gt;芯片是rt1062, 我想使用eflexpwm外设来给ws2812发送数据波形,&lt;/P&gt;&lt;P&gt;配置如下:&lt;BR /&gt;* pwm频率设定为800khz&lt;BR /&gt;*&amp;nbsp;&lt;SPAN&gt;initializationControl&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;kPWM_Initialize_LocalSync&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;forceTrigger&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;kPWM_Force_Local&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;* reloadSelect&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;kPWM_LocalReload&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;* reloadLogic&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;kPWM_ReloadImmediate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;数据波形的发生如下代码:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void ws2812_ratio_update(uint8_t val)
{
	uint16_t val_tran = 0;
	
	/* 四舍五入，以提高准确性 */
    val_tran = ((65535U * val) + 50U) / 100U;
    PWM_UpdatePwmDutycycleHighAccuracy(PWM_BASE_WS2812, WS2812_PWM_SUBMODULE, WS2812_PWM_CHANNEL, kPWM_SignedCenterAligned, val_tran);
}

/**
 * @author 
 * @brief  
 * &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/197964"&gt;@Param&lt;/a&gt;  strip 
 * @return 
 * @note   每次调用color_flush的事件都应大于280us
 */
static ws2812_status_t color_flush(ws2812_strip_t *strip)
{
    ws2812_status_t res = ws2812_ok;

    for(uint8_t i = 0; i &amp;lt; WS2812_LED_NUM; i++)
    {
        for(uint8_t j = 0; j &amp;lt; TRI_COLOR_BITS; j++)
        {
            // 等待pwm重载完成
            while(1)
			{
				if(PWM_GetStatusFlags(PWM_BASE_WS2812, WS2812_PWM_SUBMODULE) &amp;amp; kPWM_ReloadFlag)
				{
					break;
				}
			}

            if((strip-&amp;gt;out_color_data[i] &amp;gt;&amp;gt; (TRI_COLOR_BITS -1 - j)) &amp;amp; (0x01))
            {
                ws2812_ratio_update(WS2812_T1H_RATIO);
            }
            else
            {
                ws2812_ratio_update(WS2812_T0H_RATIO);
            }
        }
    }

    return res;
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;但是数据波形一直不能正确输出, 请问我该怎么做呢?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 03:00:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1473305#M20104</guid>
      <dc:creator>5angxr</dc:creator>
      <dc:date>2022-06-14T03:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1478357#M20224</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/195866"&gt;@5angxr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that you are doing excellent.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what I translated&amp;nbsp; to English&amp;nbsp; it seems that the&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;eflexpwm perihpheral is not generating the expected PWM output&amp;nbsp; signal, when configured as you show. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, c&lt;/SPAN&gt;&lt;SPAN&gt;ould you provide more descriptions on your issue? Also, SDK version and if you are using our evaluation board are useful.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If my understanding is&amp;nbsp; correct , I still&amp;nbsp; recommend you to use&amp;nbsp; our RT1062 eflexpwm example to see if we can replicate this issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;All the best,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Diego.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 17:42:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1478357#M20224</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2022-06-22T17:42:05Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1487904#M20536</link>
      <description>&lt;P&gt;现在已可以使用eFLEXPWM模块生成数据波形. 实现方式是在完成一个周期之后进入PWM的中断, 然后改变占空比.&lt;/P&gt;&lt;P&gt;不过, 现在遇到的问题是:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;如果有其他中断被使能, 则pwm有时候会在应该进入中断的时候无法进入pwm中断, 这样就无法及时更新占空比, pwm波形就会不正确&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;English:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/89833"&gt;@diego_charles&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The eFLEXPWM module can now be used to generate data waveforms. This is achieved by entering a PWM interrupt after one cycle, and then changing the duty cycle.&lt;/P&gt;&lt;P&gt;However, here's the problem:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If other interrupts are enabled, the pwm sometimes fails to enter the pwm interrupt when it should, so the duty cycle cannot be updated in time and the pwm waveform will be incorrect.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/89833"&gt;@diego_charles&lt;/a&gt;&amp;nbsp;any commont on that?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 07:31:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1487904#M20536</guid>
      <dc:creator>5angxr</dc:creator>
      <dc:date>2022-07-12T07:31:36Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1490552#M20648</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/195866"&gt;@5angxr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your reply!&lt;/P&gt;
&lt;P&gt;From which other modules are this other interrupts ?However, it could be the case that higher priority interrupt is wining&amp;nbsp; over&amp;nbsp; the eFlexPWM one. Try to increase the priority of eFlexPWM.&lt;/P&gt;
&lt;P&gt;Btw,&amp;nbsp; Is you application&amp;nbsp; running an&amp;nbsp; RTOS or bare-metal ?&lt;/P&gt;
&lt;P&gt;All the best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Diego&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jul 2022 02:25:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1490552#M20648</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2022-07-16T02:25:27Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1491590#M20680</link>
      <description>&lt;P&gt;hello, &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/89833"&gt;@diego_charles&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, and sorry for the late response.&lt;/P&gt;&lt;P&gt;There're &lt;STRONG&gt;timer(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;lcdif(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;gpio(priority 4),&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;spi master(priority 1)&lt;/STRONG&gt;, &lt;STRONG&gt;spi slave(priority 1)&lt;/STRONG&gt;, another &lt;STRONG&gt;spi slave(priority 0)&lt;/STRONG&gt;, &lt;STRONG&gt;pit(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;uart(priority 3)&lt;/STRONG&gt;, &lt;STRONG&gt;usb(priority 1)&lt;/STRONG&gt; and &lt;STRONG&gt;eflexpwm(priority 5)&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;interrupts.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my application is running an bare-metal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It seems that my current interrupt priority configuration is a bit confusing, I'm wondering, how to set interrupt priority properly.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 08:01:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1491590#M20680</guid>
      <dc:creator>5angxr</dc:creator>
      <dc:date>2022-07-19T08:01:09Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1495826#M20816</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/195866"&gt;@5angxr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope you are doing great, where you able play with the eflexPWM priority ? It seems that it is the lowest priority level in your system. You may want to increase its level.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is documentation from ARM on interrupt handling techniques, for example this post that may help&amp;gt;&amp;nbsp;&lt;A href="https://developer.arm.com/documentation/dui0646/a/The-Cortex-M7-Processor/Exception-model/Interrupt-priority-grouping" target="_blank"&gt;https://developer.arm.com/documentation/dui0646/a/The-Cortex-M7-Processor/Exception-model/Interrupt-priority-grouping&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Try to isolate the issue, test without any other interrupts, see if we are really seing issues due to the interrupt being preempted.&lt;/P&gt;
&lt;P&gt;On the other hand, If the eflexPWM interrupt needs to occur very&amp;nbsp; often and all the time, you may opt for another way to configure the module, so that does need to operate with a interrupt method, in example combine it with PWM.&lt;/P&gt;
&lt;P&gt;All the best,&lt;/P&gt;
&lt;P&gt;Diego&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 22:12:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1495826#M20816</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2022-07-26T22:12:03Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1497049#M20850</link>
      <description>&lt;P&gt;thank you diego,&amp;nbsp;&lt;SPAN&gt;I'll check the ARM documentation for the interrupt configuration.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe&amp;nbsp;eFlexPwm&amp;nbsp;is not suitable for my project, now I use FlexIO to control WS2812 and it works fine!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 06:56:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1497049#M20850</guid>
      <dc:creator>5angxr</dc:creator>
      <dc:date>2022-07-28T06:56:55Z</dc:date>
    </item>
    <item>
      <title>回复： 一个使用Pwm驱动ws2812的问题</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1497534#M20859</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/195866"&gt;@5angxr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the follow up! best wishes on your application&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Diego&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 21:17:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/%E4%B8%80%E4%B8%AA%E4%BD%BF%E7%94%A8Pwm%E9%A9%B1%E5%8A%A8ws2812%E7%9A%84%E9%97%AE%E9%A2%98/m-p/1497534#M20859</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2022-07-28T21:17:18Z</dc:date>
    </item>
  </channel>
</rss>

