<?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/"><channel><title>A simple example of using PWM with softdevice S110 using the Nordic nRF51-DK</title><link>/nordic/nordic-blog/b/blog/posts/a-simple-example-of-using-pwm-with-softdevice-s110</link><description>A simple example of using PWM with softdevice S110 using the Nordic nRF51-DK. I have tried to remove all unnecessary layers (like the Nordic BSP support) to make this example simple to understand.
http://electronut.in/nrf51-pwm-test/
UPDATE:
I hav</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><item><title>RE: A simple example of using PWM with softdevice S110 using the Nordic nRF51-DK</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/a-simple-example-of-using-pwm-with-softdevice-s110</link><pubDate>Tue, 14 Jul 2015 01:22:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cffeb9f9-46f2-4fb2-a5c2-962dccf563c6</guid><dc:creator>Mahesh Venkitachalam</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Not sure if you looked at my code, but I am doing pretty much everything you posted, and didn&amp;#39;t run into any issue. I also mentioned nrf_drv_config.h in my article. (You might have missed that this was posted under &amp;#39;blog&amp;#39; and not &amp;#39;questions&amp;#39;.)&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=823&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: A simple example of using PWM with softdevice S110 using the Nordic nRF51-DK</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/a-simple-example-of-using-pwm-with-softdevice-s110</link><pubDate>Mon, 13 Jul 2015 16:32:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cffeb9f9-46f2-4fb2-a5c2-962dccf563c6</guid><dc:creator>wojc0008</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I had the same issue but used the HRM example (that uses the S110 so all the BLE stuff is enabled).  You will need to enable the Timer 2 (Timer 0 and 1 are used by the example).&lt;/p&gt;
&lt;p&gt;In the file nrf_drv_config.H&lt;/p&gt;
&lt;pre&gt;  #define TIMER2_ENABLED 1
&lt;/pre&gt;
&lt;p&gt;Then in the main.c, add this (not inside of the void main{}):&lt;/p&gt;
&lt;pre&gt;#include &amp;quot;app_pwm.h&amp;quot; // I had to include this or it would not work.
APP_PWM_INSTANCE(PWM1,2);                   // Create the instance &amp;quot;PWM1&amp;quot; using TIMER2.  Timer0 used by S110 and Timer1 used by other BLE services (battery level...)


static volatile bool pwm_change_ready_flag;            // A flag indicating PWM status.

void pwm_ready_callback(uint32_t pwm_id)    // PWM callback function
{
    pwm_change_ready_flag = true;
}
&lt;/pre&gt;
&lt;p&gt;Add this into your void main(){}&lt;/p&gt;
&lt;pre&gt;app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(5000L, BSP_LED_0, BSP_LED_1);  //PWM on two LEDs.  
//Switch to whatever port pin like  by switching BSP_LED_0 and BSP_LED_1 to  4,5 for P0.4 and P0.5

	/* Switch the polarity of channels. */
        //    pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
	//    pwm1_cfg.pin_polarity[0] = APP_PWM_POLARITY_ACTIVE_HIGH;
    
    /* Initialize and enable PWM. */
    err_code = app_pwm_init(&amp;amp;PWM1,&amp;amp;pwm1_cfg,pwm_ready_callback);
    APP_ERROR_CHECK(err_code);
    app_pwm_enable(&amp;amp;PWM1);
	
//set the duty cycle to whatever you want from 0 to 100.
int dutycycle = 50;  //50% dutycycle (50% brightness for an LED)

while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, duty) == NRF_ERROR_BUSY);  //PWM instance, PWM number (0 or 1), duty cycle,  This sets the PWM1 instance of channel 0

while (app_pwm_channel_duty_set(&amp;amp;PWM1, 1, duty) == NRF_ERROR_BUSY);  //adjust second PWM which is channel 1
&lt;/pre&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=823&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>