<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PWM glitch/duty inversion when rapidly changing duty cycle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4730/pwm-glitch-duty-inversion-when-rapidly-changing-duty-cycle</link><description>I need to create a backlight fade-in/out effect. For this I&amp;#39;m using the latest nrf_pwm lib form here together with the S110 Softdevice. Using the scheduler and an application timer I&amp;#39;m updating every ~31.25ms the duty cycle using nrf_pwm_set_value() in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Dec 2014 15:09:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4730/pwm-glitch-duty-inversion-when-rapidly-changing-duty-cycle" /><item><title>RE: PWM glitch/duty inversion when rapidly changing duty cycle</title><link>https://devzone.nordicsemi.com/thread/16735?ContentTypeID=1</link><pubDate>Fri, 12 Dec 2014 15:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b55f35a-4663-4a0c-9ebb-39b839d03c0b</guid><dc:creator>martin-ve</dc:creator><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I have a similar problem. I have a nRF51 dongle, using SDK 7.1.0 without SD.
I&amp;#39;m using two channels. One seems fine, the other one sometimes seems to miss an event, causing the signal to change polarity. I.e. when I set 15% duty it is actually 85%&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also tried the nrf_pwm_noglitch driver. However, then only one channel is working. The one that is working, seems to work fine.&lt;/p&gt;
&lt;p&gt;This is my code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_pwm.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
    
int main(void)
{
    uint32_t counter = 0;
    
    nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;

	 /* This config will generate a frequency of 20kHz */
    pwm_config.mode             = PWM_MODE_MTR_100;
    pwm_config.num_channels     = 2;
    pwm_config.gpio_num[0]      = 15;
    pwm_config.gpio_num[1]      = 16;
    
    nrf_pwm_init(&amp;amp;pwm_config);
	
	 /* Change the resolution from 100 to 1000, resulting in a 
	 * PWM frequency of 2kHz with a resolution from 0-1000 */
	 nrf_pwm_set_max_value(1000);

    while (true)
    {
	    nrf_pwm_set_value(0, counter);
        nrf_pwm_set_value(1, counter);
			
        counter = (counter + 10) % 1000;
        
        nrf_delay_us(1000);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM glitch/duty inversion when rapidly changing duty cycle</title><link>https://devzone.nordicsemi.com/thread/16734?ContentTypeID=1</link><pubDate>Wed, 10 Dec 2014 13:09:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a33d7d19-574d-4543-9a00-3eff1bdc749c</guid><dc:creator>michael</dc:creator><description>&lt;p&gt;Hi Torbjorn,
I&amp;#39;m using sdk version 6.1.0 and SoftDevice s110 7.1.0. I&amp;#39;ve created a support case in which I attached source for the nRF6310+PCA10004 DK that demonstrate the issue by fading LED 1 on the board in and out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM glitch/duty inversion when rapidly changing duty cycle</title><link>https://devzone.nordicsemi.com/thread/16733?ContentTypeID=1</link><pubDate>Tue, 09 Dec 2014 13:32:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ea86e83-1425-4353-9da3-1cbb51a4a49f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Michael&lt;/p&gt;
&lt;p&gt;Which SDK and SoftDevice version are you using?&lt;/p&gt;
&lt;p&gt;Also, are you able to share your code project?
If yes, please just zip the project folder, including source and project files.&lt;/p&gt;
&lt;p&gt;Regards
Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>