<?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 single pulse generation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103576/pwm-single-pulse-generation</link><description>Hi there, 
 I&amp;#39;m trying to create a single pulse from PWM instance. Using SDK5 SDK, I could create only even number of pulses with a nrf_pwm_simple_playback(). When playback_count = 1 or 2, I get two pulses. playback_count = 3, 4 I get four pulses. 5,6</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Sep 2023 11:55:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103576/pwm-single-pulse-generation" /><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/446056?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2023 11:55:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:547508b6-4f60-460b-9b90-6272e695dc93</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, that example, and 0 was a typo, I meant 1,&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/445722?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2023 02:38:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaae5050-73c0-416a-ac45-ed8613386f39</guid><dc:creator>lvh831</dc:creator><description>&lt;p&gt;Jared, do you mean this example:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1694572604619v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;From the API&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__drv__pwm.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__drv__pwm.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;table class="params"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="paramdir" colspan="1" rowspan="1"&gt;[in]&lt;/td&gt;
&lt;td class="paramname" colspan="1" rowspan="1"&gt;playback_count&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;Number of playbacks to be performed (must not be 0).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Also if playback_count is zero, why would it play one?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/445665?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2023 14:10:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d182450-c968-4b34-a3cd-b6309cdcbede</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m happy that found a solution,&lt;/p&gt;
&lt;p&gt;I tried playing with the PWM driver example in the SDK and I modified demo 3 such that&amp;nbsp;playback_count parameter of&amp;nbsp;nrf_drv_pwm_simple_playback() was set to 0 instead of 3 and it resulted in the sequence being played only once instead of 3 times. Note that this is with the&amp;nbsp;load_mode being COMMON. Try to do the same and see if you&amp;#39;re able to repeat the results,&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/445225?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2023 21:16:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d258300-8640-43c5-a00b-1615ba37bb11</guid><dc:creator>lvh831</dc:creator><description>&lt;p&gt;I couldn&amp;#39;t get mode NRF_PWM_LOAD_GROUPED to work in either HAL or NRF&amp;#39;s nrfx_pwm_* driver. I can get it work with&amp;nbsp;NRF_PWM_LOAD_WAVE_FORM. I wonder if it&amp;#39;s mode dependent. Here is a code it&amp;nbsp;that works.&lt;/p&gt;
&lt;p&gt;void demo9(void) {&lt;br /&gt; &lt;br /&gt; /* #define NRFX_PWM_DEFAULT_CONFIG \ */&lt;br /&gt; /* { \ */&lt;br /&gt; /* .output_pins = { NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN, \ */&lt;br /&gt; /* NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN, \ */&lt;br /&gt; /* NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN, \ */&lt;br /&gt; /* NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN }, \ */&lt;br /&gt; /* .irq_priority = NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY, \ */&lt;br /&gt; /* .base_clock = (nrf_pwm_clk_t)NRFX_PWM_DEFAULT_CONFIG_BASE_CLOCK, \ */&lt;br /&gt; /* .count_mode = (nrf_pwm_mode_t)NRFX_PWM_DEFAULT_CONFIG_COUNT_MODE, \ */&lt;br /&gt; /* .top_value = NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE, \ */&lt;br /&gt; /* .load_mode = (nrf_pwm_dec_load_t)NRFX_PWM_DEFAULT_CONFIG_LOAD_MODE, \ */&lt;br /&gt; /* .step_mode = (nrf_pwm_dec_step_t)NRFX_PWM_DEFAULT_CONFIG_STEP_MODE, \ */&lt;br /&gt; /* } */&lt;br /&gt; &lt;br /&gt; nrf_drv_pwm_config_t const config0 =&lt;br /&gt; {&lt;br /&gt; .output_pins =&lt;br /&gt; {&lt;br /&gt; PWM_PIN_A,&lt;br /&gt; PWM_PIN_B,&lt;br /&gt; 0xFF,&lt;br /&gt; 0xFF,&lt;br /&gt; },&lt;br /&gt; .irq_priority = APP_IRQ_PRIORITY_LOWEST,&lt;br /&gt; .base_clock = NRF_PWM_CLK_1MHz,&lt;br /&gt; .count_mode = NRF_PWM_MODE_UP,&lt;br /&gt; .top_value = TOP_VALUE, //unused&lt;br /&gt; .load_mode = NRF_PWM_LOAD_WAVE_FORM,&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_demo9_seq_values.channel_0 = 10;&lt;br /&gt; m_demo9_seq_values.channel_1 = 10;&lt;br /&gt; m_demo9_seq_values.channel_2 = 0;&lt;br /&gt; m_demo9_seq_values.counter_top = 20;&lt;br /&gt; /* nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_demo9_seq, 1, */&lt;br /&gt; /* NRF_DRV_PWM_FLAG_START_VIA_TASK | NRFX_PWM_FLAG_STOP); */&lt;br /&gt; &lt;br /&gt; NRF_PWM0-&amp;gt;SHORTS = 0;&lt;br /&gt; nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_demo9_seq, 1, NRFX_PWM_FLAG_STOP);&lt;br /&gt; /* NRF_PWM0-&amp;gt;SHORTS = PWM_SHORTS_SEQEND0_STOP_Enabled &amp;lt;&amp;lt; PWM_SHORTS_SEQEND0_STOP_Pos; */&lt;br /&gt; &lt;br /&gt; /* NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1; */&lt;br /&gt; }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/445223?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2023 21:10:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffb8992a-0938-4f50-9c3b-c406c17cfd1d</guid><dc:creator>lvh831</dc:creator><description>&lt;p&gt;void demo5(void) {&lt;br /&gt; &lt;br /&gt; nrf_drv_pwm_config_t const config0 =&lt;br /&gt; {&lt;br /&gt; .output_pins =&lt;br /&gt; {&lt;br /&gt; PWM_PIN_A | NRF_DRV_PWM_PIN_INVERTED, // channel 0&lt;br /&gt; 0xFF,&lt;br /&gt; PWM_PIN_C, // channel 0&lt;br /&gt; 0xFF,&lt;br /&gt; },&lt;br /&gt; .irq_priority = APP_IRQ_PRIORITY_LOWEST,&lt;br /&gt; .base_clock = NRF_PWM_CLK_1MHz,&lt;br /&gt; .count_mode = NRF_PWM_MODE_UP,&lt;br /&gt; .top_value = TOP_VALUE,&lt;br /&gt; .load_mode = NRF_PWM_LOAD_GROUPED,&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)); // changes the pins to the levels set in output_pins&lt;br /&gt; &lt;br /&gt; nrf_drv_pwm_config_t const config1 =&lt;/p&gt;
&lt;p&gt;{&lt;br /&gt; .output_pins =&lt;br /&gt; {&lt;br /&gt; PWM_PIN_B | NRF_DRV_PWM_PIN_INVERTED, // channel 0&lt;br /&gt; 0xFF,&lt;br /&gt; PWM_PIN_D | NRF_DRV_PWM_PIN_INVERTED, // channel 0&lt;br /&gt; 0xFF,&lt;br /&gt; },&lt;br /&gt; .irq_priority = APP_IRQ_PRIORITY_LOWEST,&lt;br /&gt; .base_clock = NRF_PWM_CLK_1MHz,&lt;br /&gt; .count_mode = NRF_PWM_MODE_UP,&lt;br /&gt; .top_value = TOP_VALUE,&lt;br /&gt; .load_mode = NRF_PWM_LOAD_GROUPED,&lt;br /&gt; .step_mode = NRF_PWM_STEP_AUTO&lt;br /&gt; };&lt;/p&gt;
&lt;p&gt;/* APP_ERROR_CHECK(nrf_drv_pwm_init(&amp;amp;m_pwm1, &amp;amp;config1, NULL)); // changes the pins */&lt;br /&gt; &lt;br /&gt; nrf_drv_timer_config_t const config2 = &lt;br /&gt; {&lt;br /&gt; .frequency = NRF_TIMER_FREQ_1MHz,\&lt;br /&gt; .mode = NRF_TIMER_MODE_TIMER,\&lt;br /&gt; .bit_width = TIMER_BITMODE_BITMODE_16Bit,\&lt;br /&gt; .interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY, \&lt;br /&gt; .p_context = NULL \&lt;br /&gt; };&lt;br /&gt; &lt;br /&gt; APP_ERROR_CHECK(nrf_drv_timer_init(&amp;amp;m_tim1, &amp;amp;config2, NULL));&lt;br /&gt; &lt;br /&gt; APP_ERROR_CHECK(nrf_drv_ppi_init());&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel1));&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel2)); &lt;br /&gt; &lt;br /&gt; nrf_drv_ppi_channel_assign(m_ppi_channel1,&lt;br /&gt; nrf_drv_timer_event_address_get(&amp;amp;m_tim1, NRF_TIMER_EVENT_COMPARE0),&lt;br /&gt; nrf_drv_pwm_task_address_get(&amp;amp;m_pwm0, NRF_PWM_TASK_SEQSTART0));&lt;br /&gt; &lt;br /&gt; nrf_drv_ppi_channel_assign(m_ppi_channel1,&lt;br /&gt; nrf_drv_timer_event_address_get(&amp;amp;m_tim1, NRF_TIMER_EVENT_COMPARE1),&lt;br /&gt; nrf_drv_pwm_task_address_get(&amp;amp;m_pwm1, NRF_PWM_TASK_SEQSTART0));&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; // Enable both configured PPI channels&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_ppi_channel_enable(m_ppi_channel1));&lt;br /&gt; APP_ERROR_CHECK(nrf_drv_ppi_channel_enable(m_ppi_channel2));&lt;br /&gt; &lt;br /&gt; m_demo4a_seq_values.group_0 = 5; //group 0 inverted&lt;br /&gt; m_demo4a_seq_values.group_1 = 5|0x8000;&lt;br /&gt; /* m_demo4a_seq_values.group_1 = 5; */&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; m_demo4b_seq_values.group_0 = 4|0x8000; //group 0 inverted&lt;br /&gt; m_demo4b_seq_values.group_1 = 4;&lt;br /&gt; &lt;br /&gt; /* (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_demo4a_seq, 1, */&lt;br /&gt; /* NRF_DRV_PWM_FLAG_LOOP); */&lt;br /&gt; &lt;br /&gt; /* (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm1, &amp;amp;m_demo4b_seq, 1, */&lt;br /&gt; /* NRF_DRV_PWM_FLAG_LOOP); */&lt;br /&gt; &lt;br /&gt; (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_demo4a_seq, 1,&lt;br /&gt; NRF_DRV_PWM_FLAG_START_VIA_TASK | NRFX_PWM_FLAG_STOP);&lt;br /&gt; &lt;br /&gt; /* (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm1, &amp;amp;m_demo4b_seq, 1, */&lt;br /&gt; /* NRF_DRV_PWM_FLAG_START_VIA_TASK | NRFX_PWM_FLAG_STOP); */&lt;br /&gt; &lt;br /&gt; // note this must be true: CH1_VAL &amp;gt; CH0_VAL since we stop at the last CC compare count&lt;br /&gt; nrf_drv_timer_compare&lt;br /&gt; (&amp;amp;m_tim1, NRF_TIMER_CC_CHANNEL0, timer_ch0_val, false);&lt;br /&gt; nrf_drv_timer_extended_compare&lt;br /&gt; (&amp;amp;m_tim1, NRF_TIMER_CC_CHANNEL1, timer_ch1_val, NRF_TIMER_SHORT_COMPARE1_STOP_MASK, false);&lt;br /&gt; &lt;br /&gt; //this will run one time and launch a pulse?&lt;br /&gt; /* nrf_drv_timer_enable(&amp;amp;m_tim1); */&lt;br /&gt; NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1;&lt;br /&gt; }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM single pulse generation</title><link>https://devzone.nordicsemi.com/thread/445132?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2023 12:03:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23e1f6a7-11f9-4506-a28f-ecabe720a1f8</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;Can you show me the code when you use&amp;nbsp;&lt;span&gt;nrf_pwm_simple_playback(), did you also add the&amp;nbsp;flag&amp;nbsp;&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrfx__pwm.html#gga68ffb6414b8b5e07ddb4e14431b2bd1fa4b95e8b694bd8ccea5732ecdb50dcc18"&gt;NRFX_PWM_FLAG_STOP&lt;/a&gt;&amp;nbsp;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>