<?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>Unable to generate PWM pulse</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9365/unable-to-generate-pwm-pulse</link><description>Hi, I am trying to generate PWM pulse based on sample application in GitHub. However instead of using different modes and multiple channels, I tried to simplify it to just configuring Timer2, one channel, and one output pin. I am trying to set the duty</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 27 Sep 2015 07:57:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9365/unable-to-generate-pwm-pulse" /><item><title>RE: Unable to generate PWM pulse</title><link>https://devzone.nordicsemi.com/thread/34569?ContentTypeID=1</link><pubDate>Sun, 27 Sep 2015 07:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1ba8690-adba-412a-b509-fb30f6349caa</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Ayan&lt;/p&gt;
&lt;p&gt;I have included an answer on &lt;a href="https://devzone.nordicsemi.com/question/42082/how-do-i-include-a-library-in-a-new-project/?answer=52429#post-id-52429"&gt;this thread&lt;/a&gt; which hopefully answers your question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to generate PWM pulse</title><link>https://devzone.nordicsemi.com/thread/34568?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 07:33:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de435e42-23c8-4cb6-b6d2-377045d19860</guid><dc:creator>Ayan</dc:creator><description>&lt;p&gt;Thanks Stefan.
I too feel that it&amp;#39;ll be best to use a standard pwm_library.
I have downloaded nrf51-pwm-library from github, But I don&amp;#39;t know how/where to start. Can you help me guiding on how to include the library in my project? I&amp;#39;m new to this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to generate PWM pulse</title><link>https://devzone.nordicsemi.com/thread/34567?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2015 16:09:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b51ae9d7-519f-4140-be0a-df522311ea93</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Ayan&lt;/p&gt;
&lt;p&gt;May I ask why you want to make your own pwm implementation? The basics of the pwm_library on Github is basically the same as you are proposing, i.e. a Timer using two CC registers, two PPIs and a single GPIOTE channel in Toggle mode. You can configure it for many PWM channels or just one PWM channel. You could configure it to a single PWM channel by defining your main function as e.g. :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
	nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
	pwm_config.mode             = PWM_MODE_LED_255;
	pwm_config.num_channels     = 1;
	pwm_config.gpio_num[0]      = LED_1;

    nrf_pwm_init(&amp;amp;pwm_config);

	nrf_pwm_set_value(0, 150);
	nrf_delay_us(1000000);
	nrf_pwm_set_value(0, 180);
	nrf_delay_us(1000000);
	nrf_pwm_set_value(0, 210);
	nrf_delay_us(1000000);
	nrf_pwm_set_value(0, 240);

    while(true){}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where the duty cycle of the configured channel is set 4 times.&lt;/p&gt;
&lt;p&gt;I recommend to use the pwm_library as it uses Timeslot API to safely update the pwm duty cycle, which is discussed on &lt;a href="https://devzone.nordicsemi.com/question/42518/random-pwm-dutycycle-inversion-in-softdevice-80/?answer=43270#post-id-43270"&gt;this thread&lt;/a&gt; a little.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>