<?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>ADC EVENTS_END failed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3484/adc-events_end-failed</link><description>Hello, 
 I&amp;#39;m using: nRF51422-QFAA E00 and SDK - nRF51 5.2.0 
 My problem with ADC is that I stucked when waiting for event - end of conversion.
I used the code from Nordic examples called &amp;quot;simultaneous-adc-sampling-from-two-inputs&amp;quot;. 
 Firts strange</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Aug 2014 11:58:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3484/adc-events_end-failed" /><item><title>RE: ADC EVENTS_END failed</title><link>https://devzone.nordicsemi.com/thread/12619?ContentTypeID=1</link><pubDate>Fri, 15 Aug 2014 11:58:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8b550b7-69a9-419a-8eea-b030e0e8b6c2</guid><dc:creator>Ck</dc:creator><description>&lt;p&gt;I made some experiments and here is a result:&lt;/p&gt;
&lt;p&gt;If I&amp;#39;m enabling IRQ and handling event inside IRQ handler all works good even without any delay between CONFIG and TASK_START.&lt;/p&gt;
&lt;p&gt;If I&amp;#39;m not using IRQ (ADC_INTENSET_END_Disabled) , events are generated anyway so it&amp;#39;s OK to use it as in my first post. BUT delay between CONFIG and TASK START is necessary! As i tried now, 1ms is too much, a few clocks should be enough.&lt;/p&gt;
&lt;p&gt;Since app is critical I&amp;#39;ll use IRQ solution coz that seems it&amp;#39;s prefered(and tested) by Nordic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC EVENTS_END failed</title><link>https://devzone.nordicsemi.com/thread/12618?ContentTypeID=1</link><pubDate>Fri, 15 Aug 2014 11:13:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ed06c7d-a319-4022-a747-7cb11a53c460</guid><dc:creator>Ck</dc:creator><description>&lt;p&gt;Hi, thanks for reply.&lt;/p&gt;
&lt;p&gt;Well I ADC_INTENSET_END_Disabled was used in example, but in comment for this line is enable. I tried even with enabled option with same result. The problem is that I&amp;#39;m using 2 Analog channels so I have to make CONFIG each time before I&amp;#39;m starting TASK. And here is a problem. Without that 1ms delay I mentioned above it really doesn&amp;#39;t work. Same problem but with LCOMP has Michael and delay help him too -&amp;gt; here : &lt;a href="https://devzone.nordicsemi.com/question/15153/s110-lpcomp-interrupt-not-working/#15158"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Even more strange is that with interrupt disabled and with 1ms delay trick event is generated and all working good!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC EVENTS_END failed</title><link>https://devzone.nordicsemi.com/thread/12617?ContentTypeID=1</link><pubDate>Fri, 15 Aug 2014 09:44:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12403a3b-31be-4322-ac14-94530a7c9214</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Hmm, the example should work on your nRF51422 chip. Are you running the code unmodified?&lt;/p&gt;
&lt;p&gt;One thing I think you are misunderstanding. With the line&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	NRF_ADC-&amp;gt;INTENSET = (ADC_INTENSET_END_Disabled &amp;lt;&amp;lt; ADC_INTENSET_END_Pos);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;disables the ADC interrupt. The interrupt is disabled by default so this line is actually not necessary but I think anyway it makes it clear that the ADC interrupt is not enabled. So the ADC_END event and the ADC interrupt are in fact two separate things. If the ADC interrupt handler would be enabled, the ADC interrupt would be triggered on ADC_END event and we would be able to have the ADC interrupt handler to execute on the ADC_END event. The comments for this code are anyway not very good and that may have caused your confusion. I will try to improve them. The ADC_END event is however still enabled and we check for that event with the code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	while (!NRF_ADC-&amp;gt;EVENTS_END)  {}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then the event flag is cleared so it can be monitored next time we start ADC conversion. You could try to clear the event flag before you start the ADC conversion, with the code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_ADC-&amp;gt;EVENTS_END	= 0;

// start ADC conversion
NRF_ADC-&amp;gt;TASKS_START = 1;

// wait for conversion to end
while (!NRF_ADC-&amp;gt;EVENTS_END)
{}
NRF_ADC-&amp;gt;EVENTS_END	= 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let me know what you find out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>