<?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 Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118461/saadc-multiple-channel-sampling-and-reset-with-ppi</link><description>I have a situation where I need to sample from multiple channels using SAADC on a timer (similar to maximum performance example). However, the added catch is that at the end I want to use a timer to reset an external circuit. I have it somewhat working</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Feb 2025 08:56:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118461/saadc-multiple-channel-sampling-and-reset-with-ppi" /><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/521047?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2025 08:56:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06a4f29c-52c5-4adb-b5ea-f8064907afe4</guid><dc:creator>JyriLehtinen</dc:creator><description>&lt;p&gt;Once the buffer is full, I&amp;#39;d&amp;nbsp;&amp;quot;unzip&amp;quot; it into&amp;nbsp;arrays per channel, then do whatever math you want, like taking the average:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// Assuming int16_t sample_buffer[3*8] is the EasyDMA buffer for SAADC,

// 3 channels with 8 samples each.
int16_t adc_ch_buffer[3][8];

// Split ADC buffer into individual channels
for (int i = 0; i &amp;lt; 8; i++) {
    for(int j=0; j &amp;lt; 3; j++) {
        adc_ch_buffer[j][i] = (*sample_buffer)[i*3+j]);
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/521041?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2025 08:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25deae9b-608d-4dc7-bd0e-18a0219732b8</guid><dc:creator>JyriLehtinen</dc:creator><description>&lt;p&gt;There&amp;#39;s the internal ADC @16 MHz which can be used to sample at 8 kHz or higher, or you can use a PPI&amp;nbsp; task for lower or more accurate timing.&lt;br /&gt;&lt;br /&gt;I think here&amp;#39;s some code (I haven&amp;#39;t tested this) that uses the internal timer:&lt;br /&gt;&lt;a href="https://nq.cba.mit.edu/pub/hello-world/nrf52/-/blob/5f44ca1fab29243f3871e2a8ddfa1851a8fbc384/modules/saadc/saadc.ino"&gt;modules/saadc/saadc.ino &amp;middot; 5f44ca1fab29243f3871e2a8ddfa1851a8fbc384 &amp;middot; pub / hello-world / nrf52 &amp;middot; GitLab&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520982?ContentTypeID=1</link><pubDate>Sat, 01 Feb 2025 18:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24e5798b-707c-42ee-9578-5e37e761ac48</guid><dc:creator>Jeffrey Haynes</dc:creator><description>&lt;p&gt;I got it working.&amp;nbsp; I did have to &amp;quot;overclock&amp;quot; the timer driving the SAADC to get the desired behavior.&amp;nbsp; Hopefully that&amp;#39;s right :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520977?ContentTypeID=1</link><pubDate>Sat, 01 Feb 2025 15:55:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50f2a26d-58a8-4a73-8aee-53ad7c034643</guid><dc:creator>Jeffrey Haynes</dc:creator><description>&lt;p&gt;Is there an example of this being done?&amp;nbsp; I haven&amp;#39;t seen an example with multiple channels and multiple samples and so far I haven&amp;#39;t gotten it to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520842?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2025 10:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4edfda50-036e-4cf5-b6cf-a60a13033959</guid><dc:creator>JyriLehtinen</dc:creator><description>&lt;p&gt;&lt;span&gt;Simple approach would be to set the buffer large enough to collect multiple samples, then calculate the average per channel after EVENTS_END.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520789?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2025 21:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49b88cf7-b384-40dc-9932-69d9a1574604</guid><dc:creator>Jeffrey Haynes</dc:creator><description>&lt;p&gt;Ah, ok.&amp;nbsp; Thank you for the explanation.&amp;nbsp; I&amp;#39;ll try that.&lt;/p&gt;
&lt;p&gt;Just to clarify, I can&amp;#39;t do oversampling in multiple channel mode, correct?&amp;nbsp; That is to say, I can&amp;#39;t oversample on multiple channels and average per channel.&lt;/p&gt;
&lt;p&gt;And to extend that a bit, what would be the best way to average multiple samples across multiple channels?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520788?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2025 21:25:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f01e469-0f47-4ed6-96ff-3327aafd001e</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Could you be confusing the DONE event and the END event? They are different events.&lt;/p&gt;
&lt;p&gt;The Scan Mode documentation only says that the RESULTDONE and the DONE events &lt;em&gt;have the same meaning&lt;/em&gt; when there is no oversampling.&lt;/p&gt;
&lt;p&gt;You can think of the event in this way: DONE is generated when a sampling is done, and RESULTDONE is generated when all samples necessary for&amp;nbsp;averaging a result is done. When you don&amp;#39;t use oversampling, averaging is done over just one sample, so DONE and RESULTDONE are generated at the same time.&lt;/p&gt;
&lt;p&gt;Meanwhile, END is an entirely different event and is tied to result buffer. When EasyDMA has filled the configured buffer, END is generated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520785?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2025 20:52:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9cbb045-20f8-48b4-9b8b-2363513044d4</guid><dc:creator>Jeffrey Haynes</dc:creator><description>&lt;p&gt;Sorry, I clearly don&amp;#39;t understand the different events.&lt;/p&gt;
&lt;p&gt;My understanding was that when multiple channels are being sampled, this forces the SAADC into scan mode.&amp;nbsp; In scan mode, the documentation states that END and RESULTSDONE have the same meaning.&amp;nbsp; What am I missing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520783?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2025 20:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7fd564a-dd10-411a-a443-9c32842bc56d</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I agree that using EVENTS_END would help you achieve the desired result here. Please just remember that EVENTS_END is generated when the buffer is full, so&amp;nbsp;the RESULT.MAXCNT need to be set to the appropriate value for the END event to be generated&amp;nbsp;at the timing you desire.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC Multiple Channel Sampling and Reset with PPI</title><link>https://devzone.nordicsemi.com/thread/520647?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2025 07:58:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c40af669-a2f2-4b8c-9927-bbb39e9fa43c</guid><dc:creator>JyriLehtinen</dc:creator><description>&lt;p&gt;Have you tried using EVENTS_END instead?&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;// Enable interrupt for buffer full
NRF_SAADC_NS-&amp;gt;INTENSET = SAADC_INTENSET_END_Set &amp;lt;&amp;lt; SAADC_INTENSET_END_Pos;
NRF_SAADC_NS-&amp;gt;INTEN |= SAADC_INTEN_END_Enabled &amp;lt;&amp;lt; SAADC_INTEN_END_Pos;
NRF_SAADC_NS-&amp;gt;EVENTS_END = 0;

NVIC_EnableIRQ( SAADC_IRQn );&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>