<?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>SDK14 nRF52 PWM module and BLE example?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28552/sdk14-nrf52-pwm-module-and-ble-example</link><description>Is there an example of using the nRF52&amp;#39;s PWM module and BLE at the same time using SDK14 / GCC ?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Dec 2017 09:28:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28552/sdk14-nrf52-pwm-module-and-ble-example" /><item><title>RE: SDK14 nRF52 PWM module and BLE example?</title><link>https://devzone.nordicsemi.com/thread/113108?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2017 09:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7eace553-f124-4586-a4f6-c7e45b17cc5c</guid><dc:creator>Wayne</dc:creator><description>&lt;p&gt;It occurred to me that it might be useful to add a bit of context...&lt;/p&gt;
&lt;p&gt;The reason I asked in the first place was that once PWM was setup and then later when I performed a &lt;code&gt;nrf_drv_pwm_uninit&lt;/code&gt; and then &lt;code&gt;nrf_drv_pwm_init&lt;/code&gt; within the BLE NUS event handler to set PWM sequence based on GATT supplied data there was a HardFault occurring.&lt;/p&gt;
&lt;p&gt;So, I thought it wasn&amp;#39;t possible to perform the PWM change in the BLE handler and/or I needed to go via a SoftDevice API, turns out the &lt;code&gt;nrf_drv_pwm_uninit&lt;/code&gt; wasn&amp;#39;t being called correctly.&lt;/p&gt;
&lt;p&gt;It seems ok now, but I do wonder if the PWM update request should be queued and executed within the context of the App Scheduler.  I couldn&amp;#39;t find anywhere in the docs where it explicitly says &amp;#39;PWM init/deinit is ok in a IRQ and Event handlers&amp;#39;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK14 nRF52 PWM module and BLE example?</title><link>https://devzone.nordicsemi.com/thread/113107?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 11:08:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a349b0ab-36d5-4249-b28d-78a6c48601b6</guid><dc:creator>Wayne</dc:creator><description>&lt;p&gt;Fo anyone that whats to try then please see here: &lt;a href="https://devzone.nordicsemi.com/question/99915/nrf52-dim-led-with-pwm-driver/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pasting the &amp;#39;pwm_simple()&amp;#39; function and making a call of the code prior to the infinite loop of HRS example worked a lot better than trying to reuse the SD&amp;quot;s PWM driver &amp;#39;5demo&amp;#39; example.&lt;/p&gt;
&lt;p&gt;The SDK13 zip update in the answer of that post works fine with SDK14.&lt;/p&gt;
&lt;p&gt;You also need to adjust the make file, here&amp;#39;s a diff of what&amp;#39;s worked for me.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;44a45
&amp;gt;   $(SDK_ROOT)/components/drivers_nrf/pwm/nrf_drv_pwm.c \
215a217,221
&amp;gt; CFLAGS += -DPWM_ENABLED=1
&amp;gt; CFLAGS += -DPWM0_ENABLED=1
&amp;gt; CFLAGS += -DPWM1_ENABLED=1
&amp;gt; CFLAGS += -DPWM2_ENABLED=1
&amp;gt; CFLAGS += -DAPP_PWM_ENABLED=1
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>