<?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 Toggle PWM Module Off and On</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9429/unable-to-toggle-pwm-module-off-and-on</link><description>Hello, 
 I have an issue that I can&amp;#39;t seem to sort out involving the PWM module. I am currently using SDK9.0 and SoftDevice S110 V8.0 and I am using the stock PWM files from the SDK. The problem I am having is that I can&amp;#39;t seem to disable and then re</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Nov 2015 13:40:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9429/unable-to-toggle-pwm-module-off-and-on" /><item><title>RE: Unable to Toggle PWM Module Off and On</title><link>https://devzone.nordicsemi.com/thread/34806?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2015 13:40:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0469b97-d179-4fb1-a11d-0a0ce0ac915e</guid><dc:creator>Pawel Zadrozniak</dc:creator><description>&lt;p&gt;The power enable/disable and power consumtion related issues has been fixed in SDK v10.0 available here: &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/"&gt;developer.nordicsemi.com/.../&lt;/a&gt; .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to Toggle PWM Module Off and On</title><link>https://devzone.nordicsemi.com/thread/34805?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 18:53:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5587b665-1672-4604-8e47-ddc80f529cb8</guid><dc:creator>Cory Mast</dc:creator><description>&lt;p&gt;I believe there may be an error in the app_pwm.c file, specifically regarding the app_pwm_enable function. When I look at the app_pwm disable function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void app_pwm_disable(app_pwm_t const * const p_instance)
{
  app_pwm_cb_t * p_cb = p_instance-&amp;gt;p_cb;
  ASSERT(p_cb-&amp;gt;state != NRF_DRV_STATE_UNINITIALIZED);
  nrf_drv_timer_disable(p_instance-&amp;gt;p_timer);
  pwm_irq_disable(p_instance);
  p_cb-&amp;gt;state = NRF_DRV_STATE_INITIALIZED;
  return;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is a function that disables the IRQ for that instance:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_timer_disable(p_instance-&amp;gt;p_timer);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if we look at the function declaration for app_pwm_enable:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void app_pwm_enable(app_pwm_t const * const p_instance)
{
  app_pwm_cb_t * p_cb = p_instance-&amp;gt;p_cb;
  ASSERT(p_cb-&amp;gt;state != NRF_DRV_STATE_UNINITIALIZED);
  nrf_drv_timer_enable(p_instance-&amp;gt;p_timer);
  p_cb-&amp;gt;state = NRF_DRV_STATE_POWERED_ON;
  return;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is no function to enable the IRQ for the specified instance. By adding the following line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pwm_irq_enable(p_instance);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to the app_pwm_enable function we end up with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void app_pwm_enable(app_pwm_t const * const p_instance)
{
  app_pwm_cb_t * p_cb = p_instance-&amp;gt;p_cb;
  ASSERT(p_cb-&amp;gt;state != NRF_DRV_STATE_UNINITIALIZED);
  nrf_drv_timer_enable(p_instance-&amp;gt;p_timer);
  pwm_irq_enable(p_instance);
  p_cb-&amp;gt;state = NRF_DRV_STATE_POWERED_ON;
  return;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This seems to have fixed the problems with PWM that I was having. Was this just a bug in the SDK or was I doing something wrong? I can now toggle PWM on and off and everything else appears to be functioning properly. Any clarification or confirmation would be great and I hope this helps anyone else who may be struggling with the same issue.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>