<?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>Way to cancel TASK_STOP (PWM driver)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56559/way-to-cancel-task_stop-pwm-driver</link><description>Hi there, 
 
 I&amp;#39;m using nRF52840 dev kit board and v15.2 SDK. 
 I&amp;#39;ve set up a PWM using the PWM driver and is working well. 
 I&amp;#39;m frequently stopping and starting the PWM and I&amp;#39;m stopping the pwm by calling nrf_drv_pwm_stop. My PWM is running at around</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Jan 2020 09:31:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56559/way-to-cancel-task_stop-pwm-driver" /><item><title>RE: Way to cancel TASK_STOP (PWM driver)</title><link>https://devzone.nordicsemi.com/thread/229369?ContentTypeID=1</link><pubDate>Thu, 16 Jan 2020 09:31:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3e87146-1d75-4091-801d-154c9121459b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Triggering any TASKS would start set of actions within the hardware like requesting/releasing resources (like clocks etc) which cannot be undone and brought back to the state as it was before. So I can confirm that you can safely think that once doing a TASKS_STOP your app needs to wait until you get the event that the stop is finished.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Way to cancel TASK_STOP (PWM driver)</title><link>https://devzone.nordicsemi.com/thread/229316?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2020 23:55:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3b4be33-3a0c-4a62-9af7-ea8dacc8089d</guid><dc:creator>AOF</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Ok, I just wanted to confirm there was no way of canceling a task that was already triggered.&lt;/p&gt;
&lt;p&gt;I will need to handle it in my code then.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the confirmation!&lt;/p&gt;
&lt;p&gt;AOF&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Way to cancel TASK_STOP (PWM driver)</title><link>https://devzone.nordicsemi.com/thread/229177?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2020 09:45:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1bee3f8-e55b-477e-a06a-552488a6d5b6</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]I&amp;#39;ve tried writing 0 to my_pwm.p_registers-&amp;gt;TASKS_STOP but this does not seem to have any effect.[/quote]
&lt;p&gt;&amp;nbsp;After triggering the STOP TASK, i do not see anyway of stopping this. I strongly recommend you not to pursue this direction.&lt;/p&gt;
&lt;p&gt;The problem seems to be that your application logic is starting the new PWM action before the previous one stop has completed. In this scenario, the proper way, according to me, is to fix your application logic, that it could wait until the STOP_TASK has finished its work and the interrupt is triggered for EVENT_STOP.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>