<?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>PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57189/pwm-on-nrf52840</link><description>i have just blinked the LED and trying to pwm 
 i have written a simple led blinking program like this one below 
 #include &amp;lt;stdbool.h&amp;gt; #include &amp;lt;stdint.h&amp;gt; #include &amp;quot;nrf_delay.h&amp;quot; #include &amp;quot;boards.h&amp;quot; #include &amp;quot;nrf_gpio.h&amp;quot; 
 #define led_pin 27 /** * @brief</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Nov 2020 08:50:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57189/pwm-on-nrf52840" /><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/282211?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 08:50:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aca5fce9-d490-4328-b1f1-62d59af9b4ca</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;5000 is the period in micro seconds. So the frequency will be 1 / 5000e-6 s&amp;nbsp;= 200 Hz.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/282180?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 05:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:101914ff-b837-4ceb-bfa7-97a6b7b5f2f0</guid><dc:creator>vietanhkt24</dc:creator><description>&lt;p&gt;hey bro, can you expland why 5000L = 200Hz ? I really don&amp;#39;t understand. Thank you bro&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232253?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 08:34:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d9e5dad-a735-445d-8791-33f6be83f429</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The driver code (implementation) is provided as-is, and not intended to be used. When it comes to the WPM driver example that is also quite complex but remembers that the PWM peripheral is most sensible for more complex signals since it can &amp;quot;play out&amp;quot; a waveform from RAM via DMA etc. If you just want a simple to use PWM implementation then the PWM library is just as good in most cases (provided you have available TIMER, PPI and GPIOTE channels).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232252?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 08:31:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b62fa48-0e9d-4a20-82d4-c870ad6c22bb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This for loop creates the breathing effect by having the duty cycle change slowly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232191?ContentTypeID=1</link><pubDate>Sun, 02 Feb 2020 07:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b019b444-ad23-4a8d-8673-e068e8baaaa4</guid><dc:creator>saver</dc:creator><description>&lt;p&gt;pwm driver is better or pwm library is better?&lt;/p&gt;
&lt;p&gt;why the pwm driver has 600 lines of code&lt;/p&gt;
&lt;p&gt;can i get some simpler pwm driver code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232189?ContentTypeID=1</link><pubDate>Sun, 02 Feb 2020 06:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ed1525f-83f0-4409-ad11-3d20db07b5b2</guid><dc:creator>saver</dc:creator><description>&lt;p&gt;In pwm library i have some doubt to some commands&lt;/p&gt;
&lt;p&gt;err_code = app_pwm_init(&amp;amp;PWM1,&amp;amp;pwm1_cfg,pwm_ready_callback);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;and what are these things for&lt;/p&gt;
&lt;p&gt;for (uint8_t i = 0; i &amp;lt; 40; ++i)&lt;br /&gt; {&lt;br /&gt; value = (i &amp;lt; 20) ? (i * 5) : (100 - (i - 20) * 5);&lt;/p&gt;
&lt;p&gt;what is the purpose of this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232110?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 14:26:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a626d79e-1180-4745-8e25-2b585d21ea48</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you just want a simple PWM system, then you can use the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_pwm.html"&gt;PWM library&lt;/a&gt;. The &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/pwm_example.html"&gt;example&lt;/a&gt; uses two breathing LEDs, but you can simplify it to one fixed LED glowing with 50 % intensity. Then the example could reduce to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;app_pwm.h&amp;quot;

APP_PWM_INSTANCE(PWM1,1);                   // Create the instance &amp;quot;PWM1&amp;quot; using TIMER1.

int main(void)
{
    ret_code_t err_code;

    /* 1-channel PWM, 200Hz, output on DK LED 1 pin. */
    app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_1CH(5000L, BSP_LED_0);

    /* Switch the polarity of the second channel. */
    pwm1_cfg.pin_polarity[0] = APP_PWM_POLARITY_ACTIVE_HIGH;

    /* Initialize and enable PWM. */
    err_code = app_pwm_init(&amp;amp;PWM1,&amp;amp;pwm1_cfg, NULL);
    APP_ERROR_CHECK(err_code);
    app_pwm_enable(&amp;amp;PWM1);

    /* Set duty cycle to 50 % */
    while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, 50) == NRF_ERROR_BUSY);

    while (true)
    {
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/232106?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 14:08:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ef16084-05fe-4036-b288-1daa218f8475</guid><dc:creator>saver</dc:creator><description>&lt;p&gt;can you give me a more simpler code the documentation is some what tough to understand.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/231904?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 13:26:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:712988bd-1cb5-4fb8-8311-6b5996a61253</guid><dc:creator>Patrick</dc:creator><description>&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_pwm.html"&gt;PWM Library Documentation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/hardware_driver_pwm.html"&gt;PWM Driver Documentation&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/231900?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 13:22:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a109bc43-7597-44bb-8d86-98fac72bc3c8</guid><dc:creator>saver</dc:creator><description>&lt;p&gt;they are actually really hard to understand,&lt;/p&gt;
&lt;p&gt;can you give me a simpler code&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(OR)&lt;/p&gt;
&lt;p&gt;where can i get the meaning or purpose for the commands given in the PWM library or pwm driver?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM on  nrf52840</title><link>https://devzone.nordicsemi.com/thread/231898?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 13:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dafc914-d6cb-4b1d-9a32-974e115f9a8e</guid><dc:creator>Patrick</dc:creator><description>&lt;p&gt;Have you taken a look at the pwm examples included with the SDK? Particularly pwm_driver and pwm_library?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>