<?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>Dual channel ADC capture missing samples from one channel</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68440/dual-channel-adc-capture-missing-samples-from-one-channel</link><description>Dear All, 
 I am trying to implement a simple data recorder on nRF52840 DK that digitizes signals over SAADC and writes them onto the SD card. The program is working fine for just one input channel, but when I try to extend it to use two SAADC channels</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Nov 2020 22:15:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68440/dual-channel-adc-capture-missing-samples-from-one-channel" /><item><title>RE: Dual channel ADC capture missing samples from one channel</title><link>https://devzone.nordicsemi.com/thread/280998?ContentTypeID=1</link><pubDate>Thu, 19 Nov 2020 22:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f933b99e-22e8-4600-9333-285ff91f2a39</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Oh, both pieces of information are useful, thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dual channel ADC capture missing samples from one channel</title><link>https://devzone.nordicsemi.com/thread/280573?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 11:23:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3474d12b-d0a1-4d70-b917-d6cd979a70e0</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="newtom"]As for the SAADC; it&amp;#39;s a pity the internal timer is not an option for multi-channel acquisition! I very much liked the idea of not bothering the CPU with single &amp;quot;sample task&amp;quot; triggers, which becomes a real overhead when you are about to use high rates with many channels. It would be cool to have the internal timer for more channels in future revisions...[/quote]
&lt;p&gt;There is no need to bother the CPU in order to trigger the SAMPLE task. If you setup a TIMER or RTC peripheral to generate a COMPARE event on the desired sample rate, you can use &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/ppi.html"&gt;PPI&lt;/a&gt;&amp;nbsp;to trigger the SAMPLE task in the SAADC peripheral directly using hardware signals.&lt;/p&gt;
[quote user="newtom"]As for mixing the use of driver API and peripheral registers: as far as I can recall, SAADC driver did not have a function to configure internal timer. Has it changed recently?[/quote]
&lt;p&gt;In fact, it has changed. We introduced a &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/migration.html#migr_lib_nrfx"&gt;new SAADC driver API in nrfx in SDK 17.0.0&lt;/a&gt;, which divides the driver into a simple and an advanced mode configuration. In the advanced mode configuration, it is possible to &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/v1.8.4/drivers/src/nrfx_saadc.c#L988-L990"&gt;set a internal_timer_cc parameter&lt;/a&gt; to enable the internal timer of the SAADC and use continuous mode. Unfortunately, there is not much documentation about this driver yet, but you can find a few examples in above link.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dual channel ADC capture missing samples from one channel</title><link>https://devzone.nordicsemi.com/thread/280518?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2020 08:03:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3ce8265-ecf8-4d57-ac15-a245db473ac7</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Dear J&amp;oslash;rgen,&lt;/p&gt;
&lt;p&gt;thank you very much for the quick reply! That&amp;#39;s definitely something I am very keen on when dealing with Nordic&amp;#39;s products!&lt;/p&gt;
&lt;p&gt;As for the SAADC; it&amp;#39;s a pity the internal timer is not an option for multi-channel acquisition! I very much liked the idea of not bothering the CPU with single &amp;quot;sample task&amp;quot; triggers, which becomes a real overhead when you are about to use high rates with many channels. It would be cool to have the internal timer for more channels in future revisions...&lt;/p&gt;
&lt;p&gt;As for mixing the use of driver API and peripheral registers: as far as I can recall, SAADC driver did not have a function to configure internal timer. Has it changed recently?&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;br /&gt;Tamas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dual channel ADC capture missing samples from one channel</title><link>https://devzone.nordicsemi.com/thread/280392?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 14:15:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59bcdac0-e6bb-4843-b546-ab046b15f833</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi Tamas,&lt;/p&gt;
&lt;p&gt;The internal timer can only be used with a single channel, see&amp;nbsp;&lt;a title="Continuous sampling" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/saadc.html?cp=4_0_0_5_22_4#concept_continuous"&gt;Continuous sampling&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;&lt;span&gt;Note:&lt;/span&gt;&lt;span&gt;&amp;nbsp;Note that the internal timer can only be used when a single input channel is enabled.&lt;/span&gt;&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You will have to use a TIMER/RTC to trigger the sample task at the desired interval in order to sample two channels. You can reference the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/nrf_dev_saadc_example.html"&gt;SAADC example&lt;/a&gt; in the SDK, or one of the examples in &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples"&gt;this GitHub repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is also not generally recommended to to mix usage of the driver APIs and writing directly to the peripheral registers.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>