<?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>nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106525/nrf9160-triggering-saadc-by-external-pin</link><description>Hi, 
 we try to trigger the ADC by an external event. When the event occurs we would like to take a small amount of samples 32-256 in a buffer and then disable we the ADC. 
 
 We want to use the internal timer at the maximum frequency INTERNAL_TIMER_CC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Jan 2024 14:01:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106525/nrf9160-triggering-saadc-by-external-pin" /><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/463170?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2024 14:01:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:552ce07d-e74c-462a-aa38-1c2d71458dc6</guid><dc:creator>tpg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;just to clarify, we use the GPIOTE as trigger on one end, so this should create a single event:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrfx_gppi_channel_endpoints_setup(gppi_channel,
        nrfx_gpiote_in_event_address_get(pos_trig_pin),
        nrf_saadc_task_address_get(NRF_SAADC, NRF_SAADC_TASK_START));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We do _not_ use double buffering, one trigger event, one buffer of size 32-125 samples and after that we are done.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, if I understand you correctly, the nrf91 cannot trigger the ADC sampling of 32 samples via DMA, or an SPI transfer of 32 samples via DMA with a guaranteed low latency (around 1 us)? With the GPIOTE handler calling&amp;nbsp;nrfx_saadc_mode_trigger we are at around 30-50 us, that is to slow for us.&lt;/p&gt;
&lt;p&gt;Or, in other words, I can use NRF_SAADC_TASKS_START as PPI endpoint, but the result is undefined?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/463035?ContentTypeID=1</link><pubDate>Sun, 07 Jan 2024 20:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b40b296-484a-4ed4-b318-ea5dd1baebbe</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Thomas,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Happy New Year and sorry for late response.&lt;/p&gt;
[quote user="tpg"]Is this the right way? I couldn&amp;#39;t find any example until now that uses NRF_SAADC_TASK_START in the PPI, normally the SAMPLE task is used. But, I want to run sampling on the internal time, just start of the sampling of _one_ buffer needs to happen with very low latency.[/quote]
&lt;p&gt;You are right, I cannot find any sample that uses the NRF_SAADC_TASK_START in the ppi to start the chain reaction of the events.&lt;/p&gt;
&lt;p&gt;TASK_START is also another task which we should be able to connect to the end point of the PPI. I am guessing that this PPI configuration of low latency timer at one end and the NRF_SAADC_TASKS_START on the other end of the PPI might be messing up the internal state machine of the nrfx_saadc driver or maybe it is the adv double buffered usage of the nrfx_saadc feature that might be not able to keep with the buffer set and new sample trigger chain of events.&amp;nbsp;&lt;/p&gt;
[quote user="tpg"]Or, would an external ADC and triggering the SPI DMA transfer via PPI more feasible?[/quote]
&lt;p&gt;I have a strong feeling that this would also yield the same results of getting few events.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/462962?ContentTypeID=1</link><pubDate>Fri, 05 Jan 2024 15:59:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e1b7a5f-b789-469a-8455-0736ad328a8e</guid><dc:creator>tpg</dc:creator><description>&lt;p&gt;I should maybe be a bit more clear, it is the start of the adc with NRF_SAADC_TASK_START that does not work. Using &amp;quot;nrfx_saadc_mode_trigger()&amp;quot; in the gpiote handler works. Rest of the code is the same.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is this the right way? I couldn&amp;#39;t find any example until now that uses NRF_SAADC_TASK_START in the PPI, normally the SAMPLE task is used. But, I want to run sampling on the internal time, just start of the sampling of _one_ buffer needs to happen with very low latency.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Or, would an external ADC and triggering the SPI DMA transfer via PPI more feasible?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/462705?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 13:44:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1b4cef2-f763-4188-af4d-c078bd7231e3</guid><dc:creator>tpg</dc:creator><description>&lt;p&gt;Hi, haven&amp;#39;t gotten any further here, but I have two more questions:&lt;/p&gt;
&lt;p&gt;What latency should we expect from gpio trigger to first ADC sample using PPI?&lt;/p&gt;
&lt;p&gt;What latency can we archive using an external SPI ADC, haven&amp;#39;t checked but I guess the PPI can trigger a SPI DMA transfer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/460185?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 15:21:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fae2a8a-3e4b-442d-8dad-7aa598289c24</guid><dc:creator>tpg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I should attach some debugger. The timer is like a burst:&lt;/p&gt;
&lt;p&gt;The main trigger pulse comes once a second. This pulse shall be captured by GPIOTE to start the SAADC with 200ksps for typically 128 samples (640 uS).&lt;/p&gt;
&lt;p&gt;Then we change ADC channel and do the same again a second later (or even later, as long as it is triggered by the time pulse). After that the nrf91 goes to sleep for some minutes.&lt;br /&gt;&lt;br /&gt;So this is not a StartOnEnd configuration where need to quickly change the buffer. The DMA task for this single buffer should work regardless of the application, or not?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrfx_gppi_channel_endpoints_setup(gppi_channel,
        nrfx_gpiote_in_event_address_get(pos_trig_pin),
        nrf_saadc_task_address_get(NRF_SAADC, NRF_SAADC_TASK_START));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And then starting the PPI does not work, but calling nrfx_saadc_mode_trigger() in the GPIOTE handler works.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 Triggering SAADC by external pin</title><link>https://devzone.nordicsemi.com/thread/460063?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 08:18:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8e84dbc-f320-4f39-962c-3cd9b254d566</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Seems like doable but I do not know where you are setting the buffer for the next trigger event. Also it is hard to say which timer frequency your application would be able to handle as it seems like it depends on the post processing latency where you configure the buffer for next trigger.&lt;/p&gt;
&lt;p&gt;Have you started your application in the debugger mode and see where the application is getting stuck?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>