<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Pause and resume PPI</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88412/pause-and-resume-ppi</link><description>I am controlling the SPI via PPI at regular time intervals and it is working as expected. 
 However, I want the SPI to operate manually at any given time under certain conditions, and then when those conditions are lifted, I want to control the SPI again</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 01 Jun 2022 07:45:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88412/pause-and-resume-ppi" /><item><title>RE: Pause and resume PPI</title><link>https://test-devzone.nordicsemi.com/thread/370346?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 07:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ded4b43-796b-4037-af27-e7fb0e3822ce</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="TML_YT"]I am aware that the API includes xxx_event_enable, xxx_task_enable, xxx_channel_enable, etc.&lt;br /&gt;To stop the system at once, do I need to disable all events, tasks and channels using the API?[/quote]
&lt;p&gt;xxx_event_enable and xxx_task_enable belongs to the gpiote library, so that is not really relevant for the PPI (but you need to enable it if you want to use gpiote in PPI).&lt;/p&gt;
&lt;p&gt;If you just want to disable the ppi, you can just disable the ppi channel using nrf_drv_ppi_channel_disable&lt;/p&gt;
[quote user="TML_YT"]&lt;p&gt;Are there any other APIs to be executed other than disable?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;If you do not intend to use the same ppi channel for other purposes, but actually intend to use it for the same puprose later, then you can just disable the channel, and then enable it when you want to use it again later.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As long as you didn&amp;#39;t change any of the configurations for the ppi channels, such as changing the events and tasks that will be connected/assigned, you just need to enable that channel again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="TML_YT"]If so, should the order in which they are enabled be as in the above programe?[/quote]
&lt;p&gt;That depends on your application logic. Since it takes a few clock cycles to enable all 3 (for the CPU to actually call&amp;nbsp;nrf_drv_ppi_channel_enable()), then they will be enabled in the order that you call it. So if they are dependent on eachother, then you need to make sure to enable them in the correct order. The correct order depends on what your tasks are doing. Just from looking at your snippet, I can&amp;#39;t tell whether they are dependent on eachother, or if enabling them (or disabling them) in a certain order will cause some weird behavior.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;An example:&lt;/p&gt;
&lt;p&gt;Let us say that you had two PPI channels:&lt;/p&gt;
&lt;p&gt;ppi_ch1: gpio1 event -&amp;gt; SPI1 start task&lt;/p&gt;
&lt;p&gt;ppi_ch2:&amp;nbsp;SPI1 end event -&amp;gt; SPI2 start task&lt;/p&gt;
&lt;p&gt;and SPI1 and SPI2 are two different messages going to some external HW that expects to receive two messages, and will &amp;quot;break&amp;quot; if it only receives one.&lt;/p&gt;
&lt;p&gt;In that case, if you disable ppi_ch2 first, and the gpio1 event occurs before you disable ppi_ch1, then it will send only the first message, because ppi_ch2 is disabled.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then you disable ppi_ch1, do your custom stuff, and then enable both ppi_channels later, then the SPI1 message will be sent when the gpio event occurs again, and the SPI receiver will receive two SPI1 messages in a row.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So if your ppi channels are chained in this way, you may want to disable the ppi channel handling the first event first, so you don&amp;#39;t end up in some unwanted state.&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: Pause and resume PPI</title><link>https://test-devzone.nordicsemi.com/thread/370338?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 07:03:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8711e46b-607d-4402-9be0-8508f6c21e08</guid><dc:creator>user113706</dc:creator><description>&lt;p&gt;Hi&lt;br /&gt;By executing &amp;#39;nrf_drv_ppi_channel_disable()&amp;#39; for each configured PPI channel, PPI could be stopped and SPI could be controlled at any time PPI&lt;/p&gt;
&lt;p&gt;PPI operation could also be restarted by reconfiguring PPI with the above programme.&lt;/p&gt;
&lt;p&gt;Thank you very much for your advice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pause and resume PPI</title><link>https://test-devzone.nordicsemi.com/thread/370055?ContentTypeID=1</link><pubDate>Mon, 30 May 2022 23:16:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15f58046-c818-46f5-ad1a-f5fed8442fc0</guid><dc:creator>user113706</dc:creator><description>&lt;p&gt;Thanks for the reply.&lt;/p&gt;
&lt;p&gt;I am using the API to set up the PPI. A part of the programme is shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/PPI_5F00_Config.txt"&gt;test-devzone.nordicsemi.com/.../PPI_5F00_Config.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;(Program overview)&lt;/p&gt;
&lt;p&gt;Triggered by the reception of an ESB, the GPI outputs a total of 10 pulses, 9 PWM and 1 &amp;#39;GPIOE&amp;#39; via the PPI.&lt;br /&gt;I input those 10 pulses to another GPIO port and trigger that GPIOE input to run the SPI via PPI.&lt;/p&gt;
&lt;p&gt;What I want to do is to stop the sequence of these pulses when a certain condition is met, and run the SPI at an arbitrary timing, and when that condition is lifted, restart the above sequence again.&lt;br /&gt;When the condition is lifted, the above sequence is restarted again.&lt;/p&gt;
&lt;p&gt;(Pause)&lt;br /&gt;Question (1).&lt;br /&gt;I am aware that the API includes xxx_event_enable, xxx_task_enable, xxx_channel_enable, etc.&lt;br /&gt;To stop the system at once, do I need to disable all events, tasks and channels using the API?&lt;/p&gt;
&lt;p&gt;Question (2).&lt;br /&gt;Are there any other APIs to be executed other than disable?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;(Resume)&lt;br /&gt;Question (3).&lt;br /&gt;To restart PPI, is it sufficient to enable event, task and channel using the API?&lt;br /&gt;If so, should the order in which they are enabled be as in the above programe?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pause and resume PPI</title><link>https://test-devzone.nordicsemi.com/thread/369980?ContentTypeID=1</link><pubDate>Mon, 30 May 2022 12:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cfec352-b80c-431c-8a72-54a22e7ab2ad</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what API you are currently using to set up the PPI. I guess you are either writing to some bare metal registers manually, or you are using some PPI API.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are using the registers directly, then you are probably enabling the PPI using the CHENSET register to enable the PPI channel. Then you can use the CHENCLR register to disable that same channel(s).&lt;/p&gt;
&lt;p&gt;If you are using some API, then you are probably using something like: &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__drv__ppi.html?cp=8_1_6_8_0_23_0_4#ga1faa29d59ce310b5606ff2445543202d"&gt;nrf_drv_ppi_channel_enable&lt;/a&gt;() (or an equivalent using the softdevice API). In that case, look for a function called nrf_drv_ppi_channel_disable() (or the equivalent softdevice API version).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then, when you are done with the custom SPI operations, you can enable the PPI channel like you did when you first set it up. The configuration will probably still be the same, so you just need to enable the channel(s).&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>