<?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>Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28087/timer-and-pwm-and-ble-in-nrf5-v12</link><description>(Building with nRF5 12.2.0 / armgcc) 
 I want to do bursts of pulses using PWM for the pulses and a TIMER to enable the bursts.
I need this to be non-blocking so I can also use BLE. 
 Now PWM uses a timer so its inner timer will be controlled by an</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Dec 2017 07:38:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28087/timer-and-pwm-and-ble-in-nrf5-v12" /><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110721?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 07:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6da1a1c-6652-4ddf-94ab-b8b5301ca75f</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The SDK configuration header is documented &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/sdk_config.html?cp=4_0_5_1_6"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Every module in SDK contains at least one configuration option that is enabling this module. If the module is disabled, then even if source code is added to the project, it is not compiled because the module implementation is conditionally included.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110720?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 18:49:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a6df3c2-ac60-4308-ab75-4a2e75ceddd3</guid><dc:creator>Wayne</dc:creator><description>&lt;p&gt;where is it documented that you need to add APP_PWM_ENABLED  ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110722?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 15:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abe4752f-0ba5-4bf8-bb3e-8dbceabe2abb</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Please see above for answer which comes in 2 parts:&lt;/p&gt;
&lt;p&gt;A. Starting with the timer example enable PWM and other dependencies in [board]/config/sdk_config.h&lt;/p&gt;
&lt;p&gt;B. Configure the outer timer as above.&lt;/p&gt;
&lt;p&gt;Many thx to @Bjorn for his assist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110713?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 14:54:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d26379a2-9e33-4d21-817f-0ddd77f40188</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Setup the PWM library to use TIMER1, i.e.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_PWM_INSTANCE(PWM1,1); 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then setup TIMER2 as the outer timer, i.e.&lt;/p&gt;
&lt;p&gt;const nrf_drv_timer_t TIMER = NRF_DRV_TIMER_INSTANCE(2);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
  err_code = nrf_drv_timer_init(&amp;amp;TIMER, &amp;amp;timer_cfg, timer_event_handler);
  APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110714?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 14:48:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:204543b6-7e55-4786-8484-4de9bd9b8a09</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx @Bjorn, that fixes the build (I also had to add the GPIOTE stuff to sdk_config.h).  Is there any doc to help me understand the configuration of timers so I can have an outer timer (TIMER2) around PWM? Pls see above.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m thinking it could be something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const nrf_drv_timer_t TIMER_OUTER = NRF_DRV_TIMER_INSTANCE(2);
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
timer_cfg.p_context=&amp;amp;TIMER_OUTER;  // pure guesswork and evidently WRONG!!
err_code = nrf_drv_timer_init(&amp;amp;TIMER_OUTER, &amp;amp;timer_cfg, timer_led_event_handler);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So the remaining question is how to configure this outer timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110719?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 13:20:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32606ca3-6b73-413d-bb26-d6012a313898</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;There should be a APP_PWM section in your sdk_config.h file, i.e.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// &amp;lt;q&amp;gt; APP_PWM_ENABLED  - app_pwm - PWM functionality
 

#ifndef APP_PWM_ENABLED
#define APP_PWM_ENABLED 1
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If not then you have to add it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110718?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 12:59:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14387b76-1cd7-4ef1-9698-b89f88a51611</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;No mods made to sdk_config.h.  That has some defines for the timers but nothing related to PWM so far as I can see.  The board I am using is pca10040.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110716?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 10:51:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5ba7917-f64b-445c-a320-ad9bba181646</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Have you also modified the sdk_config.h file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110715?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 10:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99a36c08-9a18-47c0-9735-82fb4d242035</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx @Bjorn the Makefile &lt;em&gt;does&lt;/em&gt; contain the entries for app_pwm.c and the corresponding library folder.  On one test I copied the PWM Makefile and added the timer references to that. Same result.  But without the timer references the ppm example builds OK.  Something to do with PWM using timers I think.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110717?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 08:52:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d4313a2-eb94-42bf-9fa3-f70f30a467fb</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Paul, the error &lt;code&gt;undefined reference to app_pwm_init&lt;/code&gt; suggests that you have not added the &lt;code&gt;app_pwm.c&lt;/code&gt; to the &lt;code&gt;SRC_FILES&lt;/code&gt; in the makefile.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and PWM (and BLE) in nRF5 v12</title><link>https://devzone.nordicsemi.com/thread/110712?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 08:22:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeb52f25-e0d2-47b4-b1cf-9a86c16ddf8a</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;I might be able to figure this out myself if I understood the way the PPI stuff works.  I see the PPI and GPIOTE examples but I don&amp;#39;t understand them well enough.  Is there any documentation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>