<?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>How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61730/how-can-i-use-2-or-more-ppi-channels-to-control-1gpio</link><description>Hello 
 I would like use at least 2PPI channels to control a GPIO. 
 If PPI CH0&amp;amp;CH1 both setup, then GPIO_CTL just go high. 
 If PPI CH0 remarked, then GPIO_CTL go low 
 How to use 2ppi to control 1gpio? 
 
 The code as below</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 May 2020 03:32:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61730/how-can-i-use-2-or-more-ppi-channels-to-control-1gpio" /><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251374?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 03:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50f3c983-16b1-4dca-99db-08ffd66251f8</guid><dc:creator>Austin (S.F.)</dc:creator><description>&lt;p&gt;Hi Dmitry&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;You are totally right! -&amp;gt; &amp;quot;&lt;span&gt;Also the timer needs some time to start up.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img height="70" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1590377528439v1.png" width="467" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your help.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Austin&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251362?ContentTypeID=1</link><pubDate>Sun, 24 May 2020 18:54:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67cdc95d-d5ce-45c5-bc04-38bb8ed728d2</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;I couldn&amp;#39;t get your goal..&amp;nbsp; if you need to respond to an external signal as quick as possible, you should start a timer also using PPI, but if it&amp;#39;s a response to a software event, you cannot guarantee such a tight timings. Your code is compiled into a sequence of assembly instructions, their count depends on compiler and its settings (especially optimization level), and they cannot be executed in a zero time. Also the timer needs some time to start up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251356?ContentTypeID=1</link><pubDate>Sun, 24 May 2020 14:40:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d022636-3a79-473e-b76c-96815992488f</guid><dc:creator>Austin (S.F.)</dc:creator><description>&lt;p&gt;Hi Dmitry&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Thanks a lot! You rescue me!&lt;/p&gt;
&lt;p&gt;&amp;nbsp; If I use &amp;quot;(uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];&amp;quot; , it cost timing around 1us.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I use &amp;quot;(uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_CLR[0]; &amp;quot; or &amp;quot;(uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_SET[0];&amp;quot; , the timing cost is almost zero!&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;I have a new problem as below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void TIMER2_config(void)
{
  NRF_TIMER2-&amp;gt;TASKS_STOP = 1;	// Stop timer
  NRF_TIMER2-&amp;gt;MODE = TIMER_MODE_MODE_Timer;  // taken from Nordic dev zone
  NRF_TIMER2-&amp;gt;BITMODE = (TIMER_BITMODE_BITMODE_08Bit &amp;lt;&amp;lt; TIMER_BITMODE_BITMODE_Pos);
  NRF_TIMER2-&amp;gt;PRESCALER = 0;	// 1us resolution
  NRF_TIMER2-&amp;gt;TASKS_CLEAR = 1; // Clear timer
  NRF_TIMER2-&amp;gt;CC[0] = 1;					//*62.5ns
  NRF_TIMER2-&amp;gt;CC[1] = 2;					//*62.5ns
NRF_TIMER2-&amp;gt;CC[2] = 62;					//*62.5ns	
	
  NRF_TIMER2-&amp;gt;INTENSET = (TIMER_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE0_Pos) |
													(TIMER_INTENSET_COMPARE1_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE1_Pos) | 	
													(TIMER_INTENSET_COMPARE2_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE2_Pos);  // taken from Nordic dev zone
  NRF_TIMER2-&amp;gt;SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Disabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE0_CLEAR_Pos)	|
											 (TIMER_SHORTS_COMPARE1_CLEAR_Disabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE1_CLEAR_Pos)	|
											 (TIMER_SHORTS_COMPARE2_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE2_CLEAR_Pos);
}&lt;/pre&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void PPI_config(void)
{
		/*when TIMER2 CC0 = NUM , then pin =0*/
		NRF_PPI-&amp;gt;CH[0].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0];     
//		NRF_PPI-&amp;gt;CH[0].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];    
			NRF_PPI-&amp;gt;CH[0].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_CLR[0];    
	
		/when TIMER2 CC1 = NUM , then pin = 1*/
		NRF_PPI-&amp;gt;CH[1].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[1];     
//		NRF_PPI-&amp;gt;CH[1].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];     		
			NRF_PPI-&amp;gt;CH[1].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_SET[0];     		
		/*when TIMER2 CC2 = NUM then TIMER2 stop*/
		NRF_PPI-&amp;gt;CH[2].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[2];     
		NRF_PPI-&amp;gt;CH[2].TEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;TASKS_STOP;				// Stop TIMER	
	
		NRF_PPI-&amp;gt;CHEN       = (PPI_CHEN_CH0_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH0_Pos)	|
													(PPI_CHEN_CH1_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH1_Pos)	|
													(PPI_CHEN_CH2_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH2_Pos);
													
		NRF_GPIOTE-&amp;gt;CONFIG[0] =((GPIOTE_CONFIG_MODE_Task &amp;lt;&amp;lt; GPIOTE_CONFIG_MODE_Pos)
															|(CVSD_CTL  &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos)
															|(GPIOTE_CONFIG_POLARITY_Toggle &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos)
															|(GPIOTE_CONFIG_OUTINIT_High     &amp;lt;&amp;lt; GPIOTE_CONFIG_OUTINIT_Pos)); 
}
&lt;/pre&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		int8_t bit_cnt;
		
		bit_cnt++;
		bit_cnt = bit_cnt &amp;amp; 0x01;
	
		bool	DIN_bit ;
		DIN_bit = bit_cnt;					    //for test

		NRF_TIMER2-&amp;gt;CC[0] = 1;					
		NRF_TIMER2-&amp;gt;CC[1] = 3;					
		NRF_TIMER2-&amp;gt;CC[2] = 62;					

		nrf_gpio_pin_write (GPIO14, DIN_bit );	

		NRF_TIMER2-&amp;gt;TASKS_START = 1;	// Start TIMER	
&lt;/pre&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;GPIO14 is a sign, for check how log PPI CH0 works.&lt;/p&gt;
&lt;p&gt;The question is ,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;After&amp;nbsp;&amp;quot;NRF_TIMER2-&amp;gt;TASKS_START = 1;&amp;quot;, the timing pass 400ns then PPI CH0 works.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;How could it takes so much time?&lt;/p&gt;
&lt;p&gt;In my imagine, PPI CH0 should response in 100ns , because CC[0]=1.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Austin&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="PPI CH0 response time is 400ns" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/20200524224915.jpg" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251355?ContentTypeID=1</link><pubDate>Sun, 24 May 2020 14:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba673af3-783c-469c-8aac-d6cc7a9b8750</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;For example, to make a low-polarity pulse:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		NRF_PPI-&amp;gt;CH[0].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0];     
		NRF_PPI-&amp;gt;CH[0].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_CLR[0];    
	
		NRF_PPI-&amp;gt;CH[1].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[1];     
		NRF_PPI-&amp;gt;CH[1].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_SET[0];     		
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251353?ContentTypeID=1</link><pubDate>Sun, 24 May 2020 12:08:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a541bd02-911c-489d-8ad8-61f7622d0f79</guid><dc:creator>Austin (S.F.)</dc:creator><description>&lt;p&gt;Hi Dmitry&lt;/p&gt;
&lt;p&gt;How to setup &amp;quot;&amp;quot;a&amp;nbsp;&lt;span&gt;single GPIOTE channel (SET and CLR) from two different PPI channels&amp;quot;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My code as below. Thanks a lot.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		
		NRF_PPI-&amp;gt;CH[0].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[0];     
		NRF_PPI-&amp;gt;CH[0].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];    
	
		NRF_PPI-&amp;gt;CH[1].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[1];     
		NRF_PPI-&amp;gt;CH[1].TEP  = (uint32_t)&amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];     		

		NRF_PPI-&amp;gt;CH[2].EEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;EVENTS_COMPARE[2];     
		NRF_PPI-&amp;gt;CH[2].TEP  = (uint32_t)&amp;amp;NRF_TIMER2-&amp;gt;TASKS_STOP;				// Stop TIMER	
	
		NRF_PPI-&amp;gt;CHEN       = (PPI_CHEN_CH0_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH0_Pos)	|
													(PPI_CHEN_CH1_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH1_Pos)	|
													(PPI_CHEN_CH2_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH2_Pos);
													
		NRF_GPIOTE-&amp;gt;CONFIG[0] =((GPIOTE_CONFIG_MODE_Task &amp;lt;&amp;lt; GPIOTE_CONFIG_MODE_Pos)
															|(CVSD_CTL  &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos)
															|(GPIOTE_CONFIG_POLARITY_Toggle &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos)
															|(GPIOTE_CONFIG_OUTINIT_High     &amp;lt;&amp;lt; GPIOTE_CONFIG_OUTINIT_Pos)); 
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Austin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use 2 or more PPI channels to control 1GPIO?</title><link>https://devzone.nordicsemi.com/thread/251351?ContentTypeID=1</link><pubDate>Sun, 24 May 2020 11:17:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbe4e988-ba59-4dd4-b8f8-e6269b4be6ee</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;you cannot assign two GPIOTE channels to the same pin, that won&amp;#39;t work. But you can control different tasks of a single GPIOTE channel (SET and CLR) from two different PPI channels.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>