<?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>PPI interrupt was influenced by BLE connecting event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4016/ppi-interrupt-was-influenced-by-ble-connecting-event</link><description>Hi, 
 I used PPI module and Timer2 to generate a 4Mhz pwm. But I founld when using softdevice(s110 v7.0), the pwm will be broke a while by BLE advertising or connecting event. So I suppose the ble event will influence the PPI module ? 
 And is there</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 15 Aug 2015 23:40:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4016/ppi-interrupt-was-influenced-by-ble-connecting-event" /><item><title>RE: PPI interrupt was influenced by BLE connecting event</title><link>https://devzone.nordicsemi.com/thread/14415?ContentTypeID=1</link><pubDate>Sat, 15 Aug 2015 23:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e4783b5-698d-477b-9fa9-e04880758425</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;I notice you haven&amp;#39;t set any priority for Timer2.   Would that be necessary?  I am having similar code causing issues with the Button module which also uses the GPIOTE.  Wasn&amp;#39;t sure if it was due to not having set the Timer2 Interrupt Priority,   or having set  APP_GPIOTE_MAX_USERS  1    and not 2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI interrupt was influenced by BLE connecting event</title><link>https://devzone.nordicsemi.com/thread/14414?ContentTypeID=1</link><pubDate>Wed, 15 Oct 2014 01:20:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:626f4616-09d6-4f77-9f41-f14a0fa528f9</guid><dc:creator>long</dc:creator><description>&lt;p&gt;First thank you very much. In fact, my method is same to your, but I found the PWM sitll has a interval when BLE event is working. After I tested this config, the interval was disappeared.&lt;/p&gt;
&lt;p&gt;SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
change to :&lt;/p&gt;
&lt;p&gt;SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, false);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI interrupt was influenced by BLE connecting event</title><link>https://devzone.nordicsemi.com/thread/14413?ContentTypeID=1</link><pubDate>Wed, 08 Oct 2014 20:24:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d0caf29-b8b3-481f-9cb9-d1eb77655a11</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;You need to use the GPIOTE tasks to have the PPI driver the GPIO directly without any intervention. I had the same problem and had to jiggle around to get it to work.&lt;/p&gt;
&lt;p&gt;This snippet of code is used to drive a buzzer (via PWM) with two output lines tied together and another output line at the opposite (so when the two are high, I set the other low). But you can strip out a bunch of these to just have it toggle one line.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Configure as outputs
nrf_gpio_cfg_output(BUZZER_OUT_0);
nrf_gpio_cfg_output(BUZZER_OUT_1);
nrf_gpio_cfg_output(BUZZER_IN_0);

// Configure GPIOTE_CHANNEL_NUMBER to toggle the GPIO pin state with input.
// @note Only one GPIOTE task can be coupled to an output pin.
nrf_gpiote_task_config(0 /*GPIOTE_CHANNEL_NUMBER*/, BUZZER_OUT_0, \
                       NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_LOW);
nrf_gpiote_task_config(1 /*GPIOTE_CHANNEL_NUMBER*/, BUZZER_OUT_1, \
                       NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_LOW);
nrf_gpiote_task_config(2 /*GPIOTE_CHANNEL_NUMBER*/, BUZZER_IN_0, \
                       NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH);

// Clear TIMER2
NRF_TIMER2-&amp;gt;TASKS_CLEAR = 1;

// Configure TIMER2 for compare[0] event every xx 
NRF_TIMER2-&amp;gt;PRESCALER = 0;
NRF_TIMER2-&amp;gt;CC[0]     = 1904;
NRF_TIMER2-&amp;gt;MODE      = TIMER_MODE_MODE_Timer;
NRF_TIMER2-&amp;gt;BITMODE   = TIMER_BITMODE_BITMODE_16Bit;
NRF_TIMER2-&amp;gt;SHORTS    = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE0_CLEAR_Pos);

// Configure the PPI
sd_ppi_channel_assign(0 /*ch_num*/, &amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0], &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0]);
sd_ppi_channel_enable_set(1 &amp;lt;&amp;lt; 0 /*ch_num*/);

sd_ppi_channel_assign(1 /*ch_num*/, &amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0], &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[1]);
sd_ppi_channel_enable_set(1 &amp;lt;&amp;lt; 1 /*ch_num*/);

sd_ppi_channel_assign(2 /*ch_num*/, &amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0], &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[2]);
sd_ppi_channel_enable_set(1 &amp;lt;&amp;lt; 2 /*ch_num*/);
// Start it
NRF_TIMER2-&amp;gt;TASKS_START = 1;  // Start event generation.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This value here 1904 is for about 4.1Khz. You can calculate this with the formula&lt;/p&gt;
&lt;p&gt;pwm_max_value = 16.000.000 / (2 * 2^PRESCALER * FREQUENCY)&lt;/p&gt;
&lt;p&gt;Hope that helps, I had exactly the same problem with the BLE SD as the interrupts are the highest priority so all the nrf_pwm.c sample code had issues..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>