<?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>nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle</link><description>The PWM Driver has all sorts of fancy stuff for dealing with clever sequences - but I can&amp;#39;t see anything to just set a simple, steady, fixed duty cycle! 
 
 How does one just set a fixed duty cycle? 
 
 What I actually want is to be able to fade an LED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Feb 2019 08:16:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle" /><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/172437?ContentTypeID=1</link><pubDate>Fri, 22 Feb 2019 08:16:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a319309-4204-4afc-a373-e01d1e73ce7d</guid><dc:creator>inghowe83</dc:creator><description>&lt;p&gt;Hi Guys,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any founding on this topics? How the&amp;nbsp;.base_clock&amp;nbsp; &amp;nbsp;= NRF_PWM_CLK_2MHz influence the .top_value&amp;nbsp; &amp;nbsp; = 32768, // = 0x8000?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/150025?ContentTypeID=1</link><pubDate>Mon, 24 Sep 2018 11:35:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23ec4ebc-f394-4a3f-a036-916a8e989d35</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;The Assert is actually in&amp;nbsp;nrf_pwm_configure():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_reg,
                                       nrf_pwm_clk_t  base_clock,
                                       nrf_pwm_mode_t mode,
                                       uint16_t       top_value)
{
    NRFX_ASSERT(top_value &amp;lt;= PWM_COUNTERTOP_COUNTERTOP_Msk);

    p_reg-&amp;gt;PRESCALER  = base_clock;
    p_reg-&amp;gt;MODE       = mode;
    p_reg-&amp;gt;COUNTERTOP = top_value;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and&amp;nbsp;PWM_COUNTERTOP_COUNTERTOP_Msk is defined in nrf52810_bitfields.h:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Bits 14..0 : Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM are used. */
#define PWM_COUNTERTOP_COUNTERTOP_Pos (0UL) /*!&amp;lt; Position of COUNTERTOP field. */
#define PWM_COUNTERTOP_COUNTERTOP_Msk (0x7FFFUL &amp;lt;&amp;lt; PWM_COUNTERTOP_COUNTERTOP_Pos) /*!&amp;lt; Bit mask of COUNTERTOP field. */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149992?ContentTypeID=1</link><pubDate>Mon, 24 Sep 2018 10:27:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97ead99d-97fa-41ab-b35a-d6e932794f96</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. It worked in my tests, but maybe we tried on different chips.&lt;/p&gt;
&lt;p&gt;You can use&amp;nbsp; 7FFF then.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I can agree that the PWM drivers are a bit confusing, which is why I suggested the PPI implementation, which only uses a timer and the GPIOTE driver to toggle the pins.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The example actually uses both the GPIO driver and the PWM driver to control the LEDs/pins. The NRF_DRV_PWM_PIN_INVERTED is actually not used when the PWM is running. That is, when you call&amp;nbsp;nrf_drv_pwm_simple_playback(). It is used when the PWM is stopped (which it doesn&amp;#39;t do in this example, so it is a bit misleading.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to stop the PWM (by not using the loop-flag, but the&amp;nbsp;NRF_DRV_PWM_FLAG_STOP, then the NRF_DRV_PWM_PIN_INVERTED will cause the pin to go high after the sequence. And pin high means LED off. If you remove PIN_INVERTED and use&amp;nbsp;NRF_DRV_PWM_FLAG_STOP, you will see that the LED will turn on after the sequence.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But if you want to have a constant duty cycle, e.g. for controlling a motor, you might not want to turn it off at all, so then you would have to use the&amp;nbsp;first bit to tell it whether you want to have an active high or an active low PWM signal.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149880?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 16:36:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:541a7c6a-af65-420f-b964-bf84d7965968</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Quoting from code doesn&amp;#39;t seem to work on this forum?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; .top_value&amp;#160; &amp;#160; = 32768, // = 0x8000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;causes&amp;nbsp;&lt;strong&gt;nrf_drv_pwm_init()&lt;/strong&gt; to Assert - the maximum allowed value is 7FFF.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149714?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2018 22:14:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f7a8c48-b19f-4cdb-8915-feb52bde76f8</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Now I see:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;nrf_pwm_sequence_t.repeats&lt;/strong&gt;&lt;span&gt;&amp;nbsp;sets the number of times to repeat&amp;nbsp;&lt;/span&gt;&lt;em&gt;each step&lt;/em&gt;&lt;span&gt;&amp;nbsp;within the sequence;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;playback_count &lt;/strong&gt;sets the number of times to repeat&amp;nbsp;the &lt;em&gt;entire sequence&lt;/em&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Of course, with only a single step in the sequence, they both end up&amp;nbsp;as the same effect!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To further clarify,&amp;nbsp;&lt;strong&gt;nrf_pwm_sequence_t.repeats&lt;/strong&gt;&lt;span&gt;&amp;nbsp;is the number of repeats &lt;em&gt;after&lt;/em&gt; the first iteration; ie,&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;repeats = 0 runs each step once;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;repeats = 1 runs each step once, plus 1 repeat;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;repeats = 2 runs each step once, plus 2 repeats;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;repeats =&amp;nbsp;n runs each step once, plus n repeats&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149501?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2018 16:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:624ddf2b-c3bc-4216-a7ed-288ab0251b7b</guid><dc:creator>awneil</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle/149367"]But you can do this with a simple test[/quote]
&lt;p&gt;Sadly, there seems to be far too much of that with the Nordic parts.&lt;/p&gt;
&lt;p&gt;Documentation is supposed to &lt;strong&gt;tell&lt;/strong&gt; us these things - not leave us puzzled and having to experiment &amp;amp; reverse-engineer it all!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle/149367"]the signal will start high[/quote]
&lt;p&gt;So what is the&amp;nbsp;NRF_DRV_PWM_PIN_INVERTED flag supposed to do in the config.output_pins[] settings?&lt;/p&gt;
&lt;p&gt;I doesn&amp;#39;t seem to make any difference ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149367?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2018 09:02:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb1c4b89-447d-44bf-b254-4a69029c5c28</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I agree. That is also why I didn&amp;#39;t specify which is which. But you can do this with a simple test. Set it to e.g. 1/10th of 0x7FFF ≈ 0x0800. Then check if the light is on for 1/10th, or off for 1/10th of the period. Testing this shows that with sec_value of 0x0800&amp;nbsp;the LED is on for a very short amount of time. Since the LED is ON when the pin is LOW, this means that if the msb is 0, then the PWM signal will go from low to high when 0x0800 ticks = 2048 ticks has passed. Then it stays high until the .top_value is reached.&lt;/p&gt;
&lt;p&gt;Note that you will see a similar behavior if you set the value to 0x8000 (=0b1000 0000 0000 0000) + 0x7FFF-0x0800 = 0xF7FF.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is because the signal will start high, and stay high until the value reaches 0xF7FF-0x8000 = 0x77FF ticks, and switch to LOW (LED ON) for the rest of the period, which is 0x8000 ticks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But to summarize:&lt;/p&gt;
&lt;p&gt;msb = 0, signal goes low to high on seq_values.&lt;/p&gt;
&lt;p&gt;msb = 1, signal goes high to low on seq_values.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149312?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 17:40:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e1fa05b-a689-4b39-8a2b-f7024c1d7112</guid><dc:creator>awneil</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle/149264"]If you look in the description of the sec_values, you see that the first bit will be the polarity of the PWM signal, as described in nrf_pwm.h, line 248 (in SDK15.0.0).[/quote]
&lt;p&gt;What it doesn&amp;#39;t tell you is &lt;em&gt;&lt;strong&gt;how&lt;/strong&gt; &lt;/em&gt;it sets the polarity - does 1 set active high, or active low?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149289?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 14:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a50d3be-1915-44c1-9d6e-b1201578b76a</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So what&amp;#39;s the difference between the&amp;nbsp;&lt;span&gt;&lt;strong&gt;nrf_pwm_sequence_t.repeats&lt;/strong&gt; setting, and the &lt;strong&gt;playback_count&lt;/strong&gt; parameter in&amp;nbsp;&lt;strong&gt;nrfx_pwm_simple_playback()&lt;/strong&gt; ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149277?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 14:23:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:688796ab-d9f3-4613-935b-a5fbf9fb54ad</guid><dc:creator>awneil</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/38607/nrf5-sdk15-0---pwm-driver-just-set-a-fixed-duty-cycle/149264"]I changed nrf_pwm_sequence_t.repeats to 0, but changed the flag to NRF_PWM_FLAG_LOOP, so that it will repeat the signal forever[/quote]
&lt;p&gt;I think that&amp;#39;s the key piece of information that&amp;#39;s missing from all the documentation!&lt;/p&gt;
&lt;p&gt;I did wonder if there was an option like this, but could not find it anywhere - so what I did was to set repeats to UINT16_MAX. With my other settings, this meant that it only needed attention every 20 minutes or so.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;With repeats set to zero, and the LOOP flag set, does this mean that a&amp;nbsp;NRF_DRV_PWM_EVT_FINISHED event is never generated?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149264?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 14:03:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a576fac6-977e-485b-aabd-5ea143c55cf7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes. This is basically what the pwm driver does.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;See the attached version of demo3 in examples\peripheral\pwm_driver.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you replace demo3() with this, it will have the LED in a dimmed position.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void demo3(void)
{
    NRF_LOG_INFO(&amp;quot;Demo 3&amp;quot;);

    /*
     * This demo uses only one channel, which is reflected on LED 1.
     * The LED blinks three times (200 ms on, 200 ms off), then it stays off
     * for one second.
     * This scheme is performed three times before the peripheral is stopped.
     */

    nrf_drv_pwm_config_t const config0 =
    {
        .output_pins =
        {
            BSP_LED_0 | NRF_DRV_PWM_PIN_INVERTED, // channel 0
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 1
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 2
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 3
        },
        .irq_priority = APP_IRQ_PRIORITY_LOWEST,
        .base_clock   = NRF_PWM_CLK_2MHz,//NRF_PWM_CLK_125kHz,
        .count_mode   = NRF_PWM_MODE_UP,
        .top_value    = 32768, // = 0x8000
        .load_mode    = NRF_PWM_LOAD_COMMON,
        .step_mode    = NRF_PWM_STEP_AUTO
    };
    APP_ERROR_CHECK(nrf_drv_pwm_init(&amp;amp;m_pwm0, &amp;amp;config0, NULL));
    m_used |= USED_PWM(0);

    // This array cannot be allocated on stack (hence &amp;quot;static&amp;quot;) and it must
    // be in RAM (hence no &amp;quot;const&amp;quot;, though its content is not changed).
    static uint16_t /*const*/ seq_values[] =
    {
        0x3000,
//        0x2000,
//        0x4000,
//        0x6000,
//        0x7FFF,
//        0x8000
    };
    nrf_pwm_sequence_t const seq =
    {
        .values.p_common = seq_values,
        .length          = NRF_PWM_VALUES_LENGTH(seq_values),
        .repeats         = 0,
        .end_delay       = 0
    };

    (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;seq, 3, NRF_DRV_PWM_FLAG_LOOP);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You see that if you remove all but 1 seq_values[], this value will be used.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you see, you can adjust the frequency of the base clock, which will change the tick rate. The seq_values[] value will be the number of ticks before it changes.&lt;/p&gt;
&lt;p&gt;The .top_value is the number of ticks before the clock will reset the counter (.base clock *&amp;nbsp; .top_value = pwm period).&lt;/p&gt;
&lt;p&gt;If you look in the description of the sec_values, you see that the first bit will be the polarity of the PWM signal, as described in nrf_pwm.h, line 248 (in SDK15.0.0).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The most significant bit (bit 15) will decide the polarity of the output, while bit 0-14 will be the duty cycle.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I changed nrf_pwm_sequence_t.repeats to 0, but changed the flag to NRF_PWM_FLAG_LOOP, so that it will repeat the signal forever.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149243?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 13:03:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f54a2129-b757-4dff-be37-0fd35cfd306b</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;OK -&amp;nbsp; thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, for completeness, is it possible to use the PWM peripheral to give a simple fixed duty cycle that will continue indefinitely?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 SDK15.0 - PWM Driver: Just set a fixed duty cycle?</title><link>https://devzone.nordicsemi.com/thread/149221?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 12:10:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbaa33af-2319-41f6-aa1e-4c9076987bef</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I would agree to some degree of what you are saying. The PWM driver example is good for fancy PWM LEDs, but if you want a simple PWM with a fixed period and a dimmed LED that is easily controllable, it might be easier to use the PPI module with a timer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Attached is a simple PPI example that does this. If you run it on an nRF52DK, it shouldn&amp;#39;t need any modifications. It should dim 2 LEDs in a pattern.&lt;/p&gt;
&lt;p&gt;The PPI setup might look a bit scary, but the function that is actually controlling the LEDs duty cycle is controlled from the main() function. Note that for simplicity, the example uses nrf_delay_ms(), which is not a good approach, power consumption vise.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-dfd94ac4c0e445a5ad8bc82bc101f250/ppi_5F00_double_5F00_channel_5F00_pwm.zip"&gt;devzone.nordicsemi.com/.../ppi_5F00_double_5F00_channel_5F00_pwm.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that the pwm[0/1]_set_duty_cycle() doesn&amp;#39;t need to use the sin_scaled() function. You can set it to any value between 1 and 1024 (TIMER_RELOAD), which is the number of ticks in the current setup.&lt;/p&gt;
&lt;p&gt;You can change the TIMER_RELOAD to change the period of your PWM signal.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the zip-folder attached, only a Keil project is included. But you should be able to change any of the main.c files from the projects in SDK\examples\periperal with this one, if you want to use a different IDE.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me know if anything is unclear, or if you have any questions regarding the PPI, or if you want to use the PWM driver instead of this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>