<?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>SAADC_ACQTIME and conversion timing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34978/saadc_acqtime-and-conversion-timing</link><description>Context: in my application, I need to know rather precisely when the SAADC is taking a sample. So I did a test and discovered something interesting. 
 I&amp;#39;m triggering the SAADC with a timer measuring the total conversion time from the end of the call to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Jun 2018 09:11:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34978/saadc_acqtime-and-conversion-timing" /><item><title>RE: SAADC_ACQTIME and conversion timing</title><link>https://devzone.nordicsemi.com/thread/134493?ContentTypeID=1</link><pubDate>Mon, 04 Jun 2018 09:11:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1752723-4f74-480e-9b83-db08a95e80ff</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;No, not really a reason for this. I just find it easier than getting to know all the different libraries for the differnet peripherals. It is probably easier to use the dedicated functions for this &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt; No problem using the functions, such as nrf_drv_ppi_channel_assign(), etc. They do the same thing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC_ACQTIME and conversion timing</title><link>https://devzone.nordicsemi.com/thread/134404?ContentTypeID=1</link><pubDate>Fri, 01 Jun 2018 16:11:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d33ae3ac-3010-4051-9733-0ba9c52a9b32</guid><dc:creator>rdpoor</dc:creator><description>&lt;p&gt;Thanks -- I independently came to the conclusion that I should be using the PPI; your explanation confirms my reasoning.&amp;nbsp; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m actually going one step further: for my app, I need to know the exact timing when the SAADC input switch connects to the sampling capacitor.&amp;nbsp; So I&amp;#39;ll be using&amp;nbsp;TIMER COMPARE events to toggle a&amp;nbsp;GPIO pin, connected in series with a resistor, to the input of the SAADC.&amp;nbsp; Using the PPI allows for precise timing, so I&amp;#39;ll be able to make that measurement.&lt;/p&gt;
&lt;p&gt;One lingering question: you&amp;#39;ve couched your answer using low-level register access.&amp;nbsp; Is there a reason to prefer that style over the nRF SDK 15.0 driver functions (e.g. `nrf_drv_ppi_channel_assign()`, etc)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC_ACQTIME and conversion timing</title><link>https://devzone.nordicsemi.com/thread/134373?ContentTypeID=1</link><pubDate>Fri, 01 Jun 2018 13:05:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:942ec5da-d14b-4e95-8003-edc27cf15d4a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have not set up and done this test myself, but I suspect that the overhead that you see on 3µs is not actually the SAADC taking as long as with the 5µs ACQTIME, but rather the timing delay from calling nrf_drv_saadc_sample() until the SAADC starts, then the ACQTIME, and then the time it takes for the adc_event_handler() to get called.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am not sure exactly how you measure this, but may I suggest that you try to use the PPI together with a timer? Try to fork the events from the SAADC to the timer:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define CH_A 0
#define CH_B 1

NRF_PPI-&amp;gt;CH[0].EEP = (uint32_t)&amp;amp;NRF_SAADC-&amp;gt;EVENTS_STARTED
NRF_PPI-&amp;gt;CH[0].TEP = (uint32_t)&amp;amp;NRF_TIMER3-&amp;gt;TASKS_CAPTURE[1];
NRF_PPI-&amp;gt;CH[1].EEP = (uint32_t)&amp;amp;NRF_SAADC-&amp;gt;EVENTS_DONE;
NRF_PPI-&amp;gt;CH[1].TEP = (uint32_t)&amp;amp;NRF_TIMER3-&amp;gt;TASKS_CAPTURE[2];

NRF_PPI-&amp;gt;CHENSET = (1 &amp;lt;&amp;lt; CH_A) | (1 &amp;lt;&amp;lt; CH_B);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Remember to configure and start TIMER3 before calling nrf_drv_saadc_sample.&lt;/p&gt;
&lt;p&gt;Then when you get the event, you can compare NRF_TIMER3-&amp;gt;CC[1] and NRF_TIMER3-&amp;gt;CC[2] and see how many ticks that passed in between, to calculate the time used.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The advantage of using the PPI is that this can run independently from the CPU, so you don&amp;#39;t have to wait in the application to get the applications &amp;quot;attention&amp;quot; to measure the time. It is quite useful when you are dealing with such short time intervals.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>