<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82369/pwm</link><description>how to set the duty cycle of a pwm? how to set the pwm frequency? what is that nrf_pwm_values_common_t in the pwm ?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Dec 2021 05:49:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82369/pwm" /><item><title>RE: PWM</title><link>https://devzone.nordicsemi.com/thread/341970?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 05:49:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61996d51-8ab3-4e04-90e2-d88ba4800cd1</guid><dc:creator>venkatesha kj</dc:creator><description>&lt;p&gt;&lt;span&gt;thats fine but i need to know how to set the duty cycle and frequency in the pwm driver ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM</title><link>https://devzone.nordicsemi.com/thread/341969?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 05:49:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dde1270-2b1c-49d3-8c85-da96acb2aefb</guid><dc:creator>venkatesha kj</dc:creator><description>&lt;p&gt;thats fine but i need to know how to set the duty cycle and frequency in the pwm driver ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM</title><link>https://devzone.nordicsemi.com/thread/341918?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 15:01:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fadf3f48-7028-459f-9a4f-b891f0e1180e</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;What will you be using the PWM for? It might be easier for you to familiarize with &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_pwm.html"&gt;the PWM Library (app_pwm)&lt;/a&gt; instead of the PWM driver, in many cases. We have &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/pwm_example.html"&gt;a separate example that demonstrate its usage&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The PWM Library lets you set the PWM duty cycle and frequency directly, like you ask about in your original ticket, it is also easier to get started with than using the PWM driver directly.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM</title><link>https://devzone.nordicsemi.com/thread/341837?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 11:02:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:765a5cbc-a60d-47a4-9c04-bec5feda809b</guid><dc:creator>venkatesha kj</dc:creator><description>&lt;p&gt;static void demo3(void)&lt;br /&gt;{&lt;br /&gt; NRF_LOG_INFO(&amp;quot;Demo 3&amp;quot;);&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt; * This demo uses only one channel, which is reflected on LED 1.&lt;br /&gt; * The LED blinks three times (200 ms on, 200 ms off), then it stays off&lt;br /&gt; * for one second.&lt;br /&gt; * This scheme is performed three times before the peripheral is stopped.&lt;br /&gt; */&lt;/p&gt;
&lt;p&gt;nrf_drv_pwm_config_t const config0 =&lt;br /&gt; {&lt;br /&gt; .output_pins =&lt;br /&gt; {&lt;br /&gt; BSP_LED_0 | NRF_DRV_PWM_PIN_INVERTED, // channel 0&lt;br /&gt; NRF_DRV_PWM_PIN_NOT_USED, // channel 1&lt;br /&gt; NRF_DRV_PWM_PIN_NOT_USED, // channel 2&lt;br /&gt; NRF_DRV_PWM_PIN_NOT_USED, // channel 3&lt;br /&gt; },&lt;br /&gt; .irq_priority = APP_IRQ_PRIORITY_LOWEST,&lt;br /&gt; .base_clock = NRF_PWM_CLK_125kHz,&lt;br /&gt; .count_mode = NRF_PWM_MODE_UP,&lt;br /&gt; .top_value = 25000,&lt;br /&gt; .load_mode = NRF_PWM_LOAD_COMMON,&lt;br /&gt; .step_mode = NRF_PWM_STEP_AUTO&lt;br /&gt; };&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_pwm_init(&amp;amp;m_pwm0, &amp;amp;config0, NULL));&lt;br /&gt; m_used |= USED_PWM(0);&lt;/p&gt;
&lt;p&gt;// This array cannot be allocated on stack (hence &amp;quot;static&amp;quot;) and it must&lt;br /&gt; // be in RAM (hence no &amp;quot;const&amp;quot;, though its content is not changed).&lt;br /&gt; static uint16_t /*const*/ seq_values[] =&lt;br /&gt; {&lt;br /&gt; 0x8000,&lt;br /&gt; 0,&lt;br /&gt; 0x8000,&lt;br /&gt; 0,&lt;br /&gt; 0x8000,&lt;br /&gt; 0&lt;br /&gt; };&lt;br /&gt; nrf_pwm_sequence_t const seq =&lt;br /&gt; {&lt;br /&gt; .values.p_common = seq_values,&lt;br /&gt; .length = NRF_PWM_VALUES_LENGTH(seq_values),&lt;br /&gt; .repeats = 0,&lt;br /&gt; .end_delay = 4&lt;br /&gt; };&lt;/p&gt;
&lt;p&gt;(void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;seq, 3, NRF_DRV_PWM_FLAG_STOP);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;why in common mode sequence_value is 0x8000,0,0x8000,0,0x8000,0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM</title><link>https://devzone.nordicsemi.com/thread/341818?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 09:45:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d000cab2-11e0-4274-b369-05c229c51a69</guid><dc:creator>venkatesha kj</dc:creator><description>&lt;p&gt;static uint16_t /*const*/ seq_values[] =&lt;br /&gt; {&lt;br /&gt; 0x8000,&lt;br /&gt; 0,&lt;br /&gt; 0x8000,&lt;br /&gt; 0,&lt;br /&gt; 0x8000,&lt;br /&gt; 0&lt;br /&gt; };&lt;/p&gt;
&lt;p&gt;why only 6 values what actually it represents? what actually seq_values represents? if i set the sequence value &amp;gt; top_value in pwm configuration waht will happen?&lt;/p&gt;
&lt;p&gt;if i use common mode then is it sequence value range is 0-100?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>