<?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>Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8676/simulataneous-adc-sampling</link><description>Hello, I am trying to make adc sampling on two adc inputs at the same time. The adc example (simulataneous-adc-sampling-from-two-inputs) is not using IRQ handler and applying some delay, but I really want to sample them at the same time. Here is my code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Aug 2015 13:18:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8676/simulataneous-adc-sampling" /><item><title>RE: Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/thread/31785?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 13:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fb5117c-533b-4e85-b5bf-609c8d6759cf</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;In the example above, when both of the pins have been sampled, the ADC interrupt handler is entered.&lt;/p&gt;
&lt;p&gt;If you want to start the ADC sampling from a RTC interrupt hanlder instead of directly connecting the RTC with the ADC-&amp;gt;START task via PPI, then you could enable the RTC0 interrupt in the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void rtc_config(void)
{
	NRF_RTC0-&amp;gt;PRESCALER = COUNTER_PRESCALER;                   // Set prescaler to a TICK of RTC_FREQUENCY
	NRF_RTC0-&amp;gt;EVTENSET = RTC_EVTENSET_TICK_Msk;                // Enable TICK event			
	NRF_RTC0-&amp;gt;INTENSET = RTC_INTENSET_TICK_Msk;		    //Enable RTC interrupt on TICK event
	NVIC_EnableIRQ(RTC0_IRQn);						    //Enable RTC interrupt
	
	NRF_RTC0-&amp;gt;TASKS_START = 1;                                               // Start RTC0
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then you would define the RTC0 interrupt handler like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void RTC0_IRQHandler(void)
{
    NRF_RTC0-&amp;gt;EVENTS_TICK = 0;
    NRF_ADC-&amp;gt;TASKS_START = 1;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/thread/31784?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2015 19:57:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:082a545d-4852-47c4-93d3-e8bb4f0931d7</guid><dc:creator>Peaghus</dc:creator><description>&lt;p&gt;Thank you for the reply. I have one more question. Is there any example that enable two ADC using IRQ? All the examples and questions that can be found here is only using PPI, so it will be really helpful to have an example with IRQ.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/thread/31783?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2015 13:40:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fbe5184-f823-41fe-85cc-61543eed8138</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Actual simultaneous ADC sampling is not possible. You will always have to sample one pin and then the other pin. In order to make it simultaneous, you would need two ADC peripherals, but the nRF51 only has one.&lt;/p&gt;
&lt;p&gt;The time difference between the two samples is approximately the duration of the sampling plus ~10us. It takes ~10us to enter the ADC interrupt handler, reconfigure the ADC and start the sampling on the second pin. For 8-bit sampling, the time difference would be 20+10=30us. For 10-bit sampling the time difference would be 68+10=78us&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/thread/31782?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2015 19:38:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a1640b4-8e41-4984-a9cd-81f14d6f7dee</guid><dc:creator>Peaghus</dc:creator><description>&lt;p&gt;Thank you for the work Stefan. But it looks like it is sampling two inputs sequentially. I have also looked at similar questions posted on the developer zone, but they don&amp;#39;t seem to work in simultaneous fashion. I am curious whether real simultaneous sampling is even possible&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simulataneous ADC sampling</title><link>https://devzone.nordicsemi.com/thread/31781?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2015 14:34:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b221fe28-4a27-4814-878a-9abe0388f187</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Peaghus&lt;/p&gt;
&lt;p&gt;Here is an example that I have been working on to sample from two pins. It is interrupt driven and made for nRF51 SDK 8.1.0 and the PCA10028. It logs result on &lt;a href="https://devzone.nordicsemi.com/tutorials/6/debugging-with-real-time-terminal/"&gt;RTT&lt;/a&gt;. Perhaps I will be able to update it tomorrow with some documentation and/or enhancements.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/rtc0_5F00_triggering_5F00_ADC_5F00_sample_5F00_from_5F00_two_5F00_GPIO_5F00_pins.zip"&gt;rtc0_triggering_ADC_sample_from_two_GPIO_pins.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know if you think it is useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>