<?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>Using two ADC channel with interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14247/using-two-adc-channel-with-interrupt</link><description>Hi! I would like to get adc sample from two different channels at the same time on my beacon (nrf1822), using the same interrupt. Is that possible?I mean I can use ADC_IRQhandler function for both conversion?If yes how can I write it in the code?Thank</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Jun 2016 14:45:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14247/using-two-adc-channel-with-interrupt" /><item><title>RE: Using two ADC channel with interrupt</title><link>https://devzone.nordicsemi.com/thread/54410?ContentTypeID=1</link><pubDate>Tue, 14 Jun 2016 14:45:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cab08ad-d092-4068-8b59-f0a6a3bdce12</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You will get an interrupt when the EVENTS_END flag is set (if it is zero), so in your case you will get a pending interrupt when the code exits &lt;code&gt;while (!NRF_ADC-&amp;gt;EVENTS_END)&lt;/code&gt;. This means that you will jump right back into the interrupt when you exit it. You should disable the END interrupt (&lt;code&gt;NRF_ADC-&amp;gt;INTENCLR = (ADC_INTENCLR_END_Enabled &amp;lt;&amp;lt; ADC_INTENCLR_END_Pos)&lt;/code&gt;) while doing the second measurement.&lt;/p&gt;
&lt;p&gt;Also be sure to not run the interrupt at APP_PRIORITY_HIGH if you are going to do SoftDevice calls (sd_...) from it, as this will lead to a SoftDevice assert. See for example &lt;a href="https://devzone.nordicsemi.com/question/80720/calling-soft-device-methods-from-uartuarte-interrupt-handler/"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two ADC channel with interrupt</title><link>https://devzone.nordicsemi.com/thread/54409?ContentTypeID=1</link><pubDate>Wed, 08 Jun 2016 08:51:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22b6257b-187e-44af-809b-b6eeca37a8b3</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;I think I am doing some basic errors, because I have a timer that counts 2ms and then it starts the adc conversion and between the conversion of the two channel I don&amp;#39;t want to start the timer.This is my piece of code, can you help me to find what doesn&amp;#39;t work?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void ADC_IRQHandler(void)
{
	/* Clear dataready event */
  NRF_ADC-&amp;gt;EVENTS_END = 0;	
	
	//Invio a pacchetti di 20 bytes (ogni dato in uscita dall&amp;#39;adc è 2byte)
	static uint8_t i=0;                 //usiamo static per evitare che modifichi il valore della variabile
	static uint16_t adc_results[10];    
		if (i&amp;lt;10)	
{		
			adc_results[i]=NRF_ADC-&amp;gt;RESULT;
			i=i+1;
	NRF_ADC-&amp;gt;TASKS_STOP = 1;
	NRF_ADC-&amp;gt;CONFIG=(ADC_CONFIG_PSEL_AnalogInput3 &amp;lt;&amp;lt; ADC_CONFIG_PSEL_Pos);
	NRF_ADC-&amp;gt;ENABLE = ADC_ENABLE_ENABLE_Enabled;
	NRF_ADC-&amp;gt;TASKS_START = 1;	
	while (!NRF_ADC-&amp;gt;EVENTS_END)
	{}
	NRF_ADC-&amp;gt;EVENTS_END	= 0;
	adc_results[i]=NRF_ADC-&amp;gt;RESULT;
		NRF_ADC-&amp;gt;CONFIG=(ADC_CONFIG_PSEL_AnalogInput2 &amp;lt;&amp;lt; ADC_CONFIG_PSEL_Pos);
			i=i+1;
}
 NRF_ADC-&amp;gt;TASKS_STOP = 1;
	
	//Release the external crystal
	sd_clock_hfclk_release();
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two ADC channel with interrupt</title><link>https://devzone.nordicsemi.com/thread/54407?ContentTypeID=1</link><pubDate>Sat, 04 Jun 2016 19:10:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10964517-859f-4a35-92d7-8bc6b406e931</guid><dc:creator>uriy</dc:creator><description>&lt;p&gt;Please read this &lt;a href="https://devzone.nordicsemi.com/question/77700/adc_event_handler-doesnt-work-well/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two ADC channel with interrupt</title><link>https://devzone.nordicsemi.com/thread/54408?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2016 11:22:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:118e5040-f718-4ca9-abc0-3d7fb35320c0</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You can only sample one channel at the time. You will have to do the two conversions one after another and read the result and change the config register in between. The same interrupt will be used for both conversions.&lt;/p&gt;
&lt;p&gt;The time for one conversion is 20, 36 or 68 us depending on the bit mode (8, 9 or 10 bits), see &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51822_PS_v3.2.pdf"&gt;Product Specification&lt;/a&gt; chapter 8.12.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>