<?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>NRFX  RTC -&amp;gt; PPI -&amp;gt; ADC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93055/nrfx-rtc---ppi---adc</link><description>I&amp;#39;ve been piecing examples together and I think I&amp;#39;m getting close. I&amp;#39;m using the NRF52 DK PCB. 
 I can get the RTC to trigger callbacks but it seems to be running way too fast. Prescaler is set to 32767 but I&amp;#39;m getting about 10 ticks per second. 
 I&amp;#39;m</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Oct 2022 07:57:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93055/nrfx-rtc---ppi---adc" /><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392757?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 07:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb6dcfd3-e362-4f8b-a204-c8069631a0d2</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Good to hear that it now works! You are right about one SAMPLE is required to sample all channels in scan mode, I will fix that in my previous answer.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392727?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 03:03:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37a3ea6b-d75e-4e58-a624-52afa78325b9</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;There is one&amp;nbsp;thing I wanted to correct in your statement.&amp;nbsp; I wasn&amp;#39;t sure given the poor wording of the datasheet, but after some testing, it appears that only one SAMPLE task is required to sample all channels if you are in scan mode.&amp;nbsp; Just wanted to put this here for others benefit.&amp;nbsp; This means for 8 channels, I still only want to trigger SAMPLE at 1khz not 8khz.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392715?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 22:24:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:772e90c0-0fea-4fa0-8ad4-1573f292d3dc</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;I&amp;#39;ve implemented the logic and it looks like it&amp;#39;s working fine now.&amp;nbsp; This explanation you provided is very valuable - is there someplace outside this forum that you could share/post it so it&amp;#39;s easier to find for others?&amp;nbsp; Or perhaps add it to some documentation.&lt;br /&gt;&lt;br /&gt;Internally, it looks like the code tries to have a double-buffer on hand.&amp;nbsp; Can I invoke START after DONE assuming that the SDK has a double-buffer ready and then copy the contents out of the previous buffer and provide a new buffer when I get the BUF_REQ event?&amp;nbsp; This is what I&amp;#39;m doing now:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
void adc_handler(const nrfx_saadc_evt_t *p_event) { 
  switch (p_event-&amp;gt;type) {
    case NRFX_SAADC_EVT_DONE:      ///&amp;lt; Event generated when the buffer is filled with samples.
      printk(&amp;quot;NRFX_SAADC_EVT_DONE\n&amp;quot;);
      adc_enqueue(); // &amp;lt;--- COPIES THE CONTENTS OF THE ADC BUFFER OUT
      nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START);      
      break;
    case NRFX_SAADC_EVT_BUF_REQ:       ///&amp;lt; Event generated when the next buffer for continuous conversion is requested.
      printk(&amp;quot;NRFX_SAADC_EVT_BUF_REQ\n&amp;quot;);
      nrfx_saadc_buffer_set(adc_samples[DOUBLE_BUFFER].samples, NUM_ADC_CHANS); // &amp;lt;-- provides the pointer to the next buffer
      current_adc_buffer = DOUBLE_BUFFER; // &amp;lt;-- SWAPS OUT MY INTERNAL BUFFERS
      break;
  }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but would this work (and would it be better?)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void adc_handler(const nrfx_saadc_evt_t *p_event) { 
  switch (p_event-&amp;gt;type) {
    case NRFX_SAADC_EVT_DONE:      ///&amp;lt; Event generated when the buffer is filled with samples.
      printk(&amp;quot;NRFX_SAADC_EVT_DONE\n&amp;quot;);
      nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START);      
      break;
    case NRFX_SAADC_EVT_BUF_REQ:       ///&amp;lt; Event generated when the next buffer for continuous conversion is requested.
      printk(&amp;quot;NRFX_SAADC_EVT_BUF_REQ\n&amp;quot;);
      nrfx_saadc_buffer_set(adc_samples[DOUBLE_BUFFER].samples, NUM_ADC_CHANS); // &amp;lt;-- provides the pointer to the next buffer
      adc_enqueue(); // &amp;lt;--- COPIES THE CONTENTS OF THE ADC BUFFER OUT
      current_adc_buffer = DOUBLE_BUFFER; // &amp;lt;-- SWAPS OUT MY INTERNAL BUFFERS
      break;
  }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I now need to add the BT stack to see if all of this plays nicely together.&amp;nbsp; &amp;nbsp;Thanks for all the help so far!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392705?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 20:58:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e71350b9-c94c-460d-b66c-f2d227850a06</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;Actually, looking at the PRESCALER register, it&amp;#39;s only 12 bits wide, so a max value of 4096 makes sense.&amp;nbsp; If I use the compare event, is there a way to auto-reset the counter to zero?&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;That being said, I wanted to set it to a high value for testing -- in my application, I want to sample 8 channels at 1khz each, so this shouldn&amp;#39;t be a problem.&amp;nbsp; Though, with a target rate of 8khz, I&amp;#39;m thinking a timer might be a better trigger than the rtc; with the RTC PRESCALER set to 3, I get a sampler rate of 8192hz.&amp;nbsp; Not sure what the math would be to get RTC to trigger at 8khz using the counter compare.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll go through your logic/feedback and see if that&amp;#39;ll sort out my issues.&amp;nbsp; Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392691?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 16:26:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7fc325f-0974-44ea-9097-21c78f8d70ae</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Just to clarify a bit.&lt;/p&gt;
&lt;p&gt;To sample one analog input channel you need to trigger one SAMPLE task. If you have enabled 2 channels, then you need to trigger SAMPLE task two times&amp;nbsp;to sample both inputs.&lt;/p&gt;
&lt;p&gt;When you call&amp;nbsp;nrfx_saadc_buffer_set() you provide a size that will decide when&amp;nbsp;NRFX_SAADC_EVT_DONE will be executed. Shortly after the&amp;nbsp;NRFX_SAADC_EVT_DONE you will get an NRFX_SAADC_EVT_BUF_REQ event where you need to prepare&amp;nbsp;a new buffer by calling&amp;nbsp;nrfx_saadc_buffer_set().&lt;/p&gt;
&lt;p&gt;When the&amp;nbsp;NRFX_SAADC_EVT_DONE occurs, you will need to trigger a START task again. This can be done by either calling&amp;nbsp;&lt;span&gt;nrf_saadc_task_trigger&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NRF_SAADC&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;NRF_SAADC_TASK_START&lt;/span&gt;&lt;span&gt;), but a better idea might be to make a ppi channel between the SAADC DONE event and the SAADC START task.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I believe the above explain much of your application flow here.&lt;/p&gt;
&lt;p&gt;All that said, I do see a timing problem when using very high values (&amp;gt;4096) with the PRESCALER. I am not entirely sure why that is, it could be an hardware issue of some sort that occur if LFCLK is running at the time the PRESCALER is enabled. I suggest you reduce the PRESCALER (&amp;lt;4096), and instead&amp;nbsp;use COMPARE event to trigger the SAMPLE task.&lt;/p&gt;
&lt;p&gt;Edit: If you want to sample 8 channels at 1kHz. In that case I think it is a good idea to also increase the buffer size when calling&amp;nbsp;&lt;span&gt;nrfx_saadc_buffer_set() by quite a lot (e.g.&amp;nbsp;100 will cause the DONE&amp;amp;REQ events to trigger every&amp;nbsp;100 samples =~100ms).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/392485?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2022 22:12:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9351f7f-841d-4663-836d-e2d6d2a5deff</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;Kenneth,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am using multiple channels.&amp;nbsp; I want to scan up to 8 channels at (ideally) 1ksps.&amp;nbsp; In my code, I am testing with 2 channels.&amp;nbsp; I provided the zip file via a dropbox link in my last message, but I&amp;#39;ll share it here using the method requested as well.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7824.nrfx.zip"&gt;devzone.nordicsemi.com/.../7824.nrfx.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Reza&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/391986?ContentTypeID=1</link><pubDate>Sun, 23 Oct 2022 11:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47cf94af-09f6-4548-8153-2728c018af8a</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not clear if you have one analog input or several analog inputs configured here, can you clarify? Reason for asking is that if you have more than one analog input configured you must refer to scan mode description.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to share your project please drag&amp;amp;drop the zip file into the text box you reply in.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/391960?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 19:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8266fe30-3c80-4ae0-8968-b1adf09b733d</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;I&amp;#39;ve made a bit more progress.&amp;nbsp; I&amp;#39;ve identified that the SAMPLE task is being sent by the PPI, but it&amp;#39;s not sufficient to enable continuous conversions.&amp;nbsp; This is a bit longer of a post than it needs to be, but I thought it might be helpful to others given how little I&amp;#39;m finding documented on using the nrfx sdaac drivers.&lt;/p&gt;
&lt;p&gt;If I call the &lt;strong&gt;nrfx_saadc_mode_trigger()&lt;/strong&gt; with the PPI disabled, I get these callbacks:&lt;/p&gt;
&lt;p&gt;NRFX_SAADC_EVT_READY&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;/p&gt;
&lt;p&gt;with the PPI enabled, issuing &amp;#39;SAMPLE&amp;#39; tasks, I get&lt;/p&gt;
&lt;p&gt;NRFX_SAADC_EVT_READY&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;/p&gt;
&lt;p&gt;So there needs to be another SAMPLE issued after the BUF_REQ (and &lt;strong&gt;nrfx_saadc_buffer_set()&lt;/strong&gt; ).&amp;nbsp; If I issue this manually right after the call to &lt;strong&gt;nrfx_saadc_buffer_set()&lt;/strong&gt;, the DONE callback is received.&amp;nbsp; &amp;nbsp;However, subsequent SAMPLE requests do nothing.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I call&amp;nbsp;&lt;strong&gt;nrfx_saadc_mode_trigger()&amp;nbsp;&lt;/strong&gt;right after&amp;nbsp;&lt;strong&gt;nrfx_saadc_buffer_set()&lt;/strong&gt;, I get NRFX_INVALID_STATE.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Seems my problem is around how to get scan mode sampling at a fixed sampling frequency.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;According to the nrf2832 datasheet (section 37.5.2),&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Continuous sampling can be achieved by using the internal timer in the ADC, or triggering the SAMPLE task from one of the general purpose timers through the PPI&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;But this is obviously not working for me...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I added some debugging logic to see what tasks were being called and how they worked..&amp;nbsp;&lt;/p&gt;
&lt;p&gt;*** Booting Zephyr OS build v3.1.99-ncs1-rc2 ***&lt;br /&gt;TASK: 00000000 [START]&lt;br /&gt;NRFX_SAADC_EVT_READY&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;TASK: 00000004 [SAMPLE]&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;br /&gt;TASK: 00000004 [SAMPLE]&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not getting any subsequent samples taken after the last sample.&amp;nbsp; This is me just trying to trigger events using the callback functions and not use the PPI&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void adc_handler(const nrfx_saadc_evt_t *p_event) { 
  switch (p_event-&amp;gt;type) {
    case NRFX_SAADC_EVT_DONE:      ///&amp;lt; Event generated when the buffer is filled with samples.
      printk(&amp;quot;NRFX_SAADC_EVT_DONE\n&amp;quot;);
      adc_enqueue();
      nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE);
      break;
    case NRFX_SAADC_EVT_LIMIT:         ///&amp;lt; Event generated when one of the limits is reached.
      printk(&amp;quot;NRFX_SAADC_EVT_LIMIT\n&amp;quot;);
      break;
    case NRFX_SAADC_EVT_CALIBRATEDONE: ///&amp;lt; Event generated when the calibration is complete.
      printk(&amp;quot;NRFX_SAADC_EVT_CALIBRATEDONE\n&amp;quot;);
      break;
    case NRFX_SAADC_EVT_BUF_REQ:       ///&amp;lt; Event generated when the next buffer for continuous conversion is requested.
      printk(&amp;quot;NRFX_SAADC_EVT_BUF_REQ\n&amp;quot;);
      nrfx_saadc_buffer_set(adc_samples[DOUBLE_BUFFER].samples, NUM_ADC_CHANS);
      current_adc_buffer = DOUBLE_BUFFER;
      nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE);
      break;
    case NRFX_SAADC_EVT_READY:         ///&amp;lt; Event generated when the first buffer is acquired by the peripheral and sampling can be started.
      printk(&amp;quot;NRFX_SAADC_EVT_READY\n&amp;quot;);
      break;
    case NRFX_SAADC_EVT_FINISHED:
      printk(&amp;quot;NRFX_SAADC_EVT_FINISHED\n&amp;quot;);
      break;
    default:
      printk(&amp;quot;GOT UNKOWN SAAdC EVENT %d&amp;quot;, p_event-&amp;gt;type);
      break;
  }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, if I add a START before the SAMPLE in the case when I get a DONE, then I get continuous conversion&lt;/p&gt;
&lt;p&gt;*** Booting Zephyr OS build v3.1.99-ncs1-rc2 ***&lt;br /&gt;TASK: 00000000&lt;br /&gt;NRFX_SAADC_EVT_READY&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;TASK: 00000004&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;br /&gt;TASK: 00000000&lt;br /&gt;TASK: 00000004&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;TASK: 00000004&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;br /&gt;TASK: 00000000&lt;br /&gt;TASK: 00000004&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;TASK: 00000004&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;br /&gt;TASK: 00000000&lt;/p&gt;
&lt;p&gt;So I guess where I&amp;#39;m stuck is that although the documentation says all I need to do is issue a SAMPLE for continuous conversion, it seems I also need a START per conversion.&amp;nbsp; I&amp;#39;m not sure how to send two tasks via PPI for each event.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;p.s. this cracked me up in nrfx_errors.h&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;/** &lt;/span&gt;&lt;span&gt;@brief&lt;/span&gt;&lt;span&gt; Base number of error codes. */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;NRFX_ERROR_BASE_NUM&lt;/span&gt;&lt;span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;0x0BAD0000&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/391758?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 22:26:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b32cb33-a3f4-4bcd-8013-d5d2c3cf1a48</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;I also tried using a timer instead of the RTC but still no go.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/** TIMER **/
static nrfx_timer_t timer1 = NRFX_TIMER_INSTANCE(1);

void timer_init(void) {
  nrfx_timer_config_t timer_cfg = {
    .bit_width = NRF_TIMER_BIT_WIDTH_32, 
    .frequency = NRF_TIMER_FREQ_1MHz, 
    .interrupt_priority = 6,
    .mode = NRF_TIMER_MODE_TIMER,
    .p_context = NULL
  };
  ERR_CHECK(nrfx_timer_init(&amp;amp;timer1, &amp;amp;timer_cfg, NULL), &amp;quot;timer init&amp;quot;);
  nrfx_timer_extended_compare(&amp;amp;timer1, NRF_TIMER_CC_CHANNEL0, nrfx_timer_ms_to_ticks(&amp;amp;timer1, 1000), NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);

  // PPI 
  nrfx_err_t err_code = nrfx_ppi_channel_alloc(&amp;amp;ppi_channel);
  ERR_CHECK(err_code, &amp;quot;PPI channel allocation error&amp;quot;);

  err_code = nrfx_ppi_channel_assign(ppi_channel, 
        nrfx_timer_event_address_get(&amp;amp;timer1, NRF_TIMER_EVENT_COMPARE0),
        nrf_saadc_task_address_get((void*) DT_REG_ADDR(DT_NODELABEL(adc)), NRF_SAADC_TASK_START));
  ERR_CHECK(err_code, &amp;quot; PPI channel assignment error&amp;quot;);

  err_code = nrfx_ppi_channel_enable(ppi_channel);
  ERR_CHECK(err_code, &amp;quot; PPI channel enable error&amp;quot;);

  nrfx_timer_enable(&amp;amp;timer1);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And I&amp;#39;ve tried to change the init order and put the RTC start at the end (I read that the timer should be started after the PPI is initalized)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  adc_init();
  rtc_init();
  ppi_init();
  nrfx_rtc_enable(&amp;amp;rtc); //i read this should be done after the ppi is initalized&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but I&amp;#39;m still not getting the PPI to start the conversion.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And I tried switching the TASK to the START task instead of the sample task but no change.&lt;/p&gt;
&lt;div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;err_code&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;nrfx_ppi_channel_assign&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;ppi_channel&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;nrfx_rtc_event_address_get&lt;/span&gt;&lt;span&gt;(&amp;amp;&lt;/span&gt;&lt;span&gt;rtc&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;NRF_RTC_EVENT_TICK&lt;/span&gt;&lt;span&gt;), &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;nrf_saadc_task_address_get&lt;/span&gt;&lt;span&gt;((&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt;*) &lt;/span&gt;&lt;span&gt;DT_REG_ADDR&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;DT_NODELABEL&lt;/span&gt;&lt;span&gt;(adc)), &lt;/span&gt;&lt;strong&gt;NRF_SAADC_TASK_START&lt;/strong&gt;&lt;span&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/391756?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 21:43:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8bafdbe-efb3-41f5-aaaa-7be1a7c7db55</guid><dc:creator>the_reza</dc:creator><description>&lt;p&gt;If I decrease the prescaler, the It will go faster for sure.&amp;nbsp; I haven&amp;#39;t bothered hooking it up to a logic analyzer to measure the exact timing but can.&amp;nbsp; In some other posts, I read that only RTC2 can be used for applications to avoid issues if you&amp;#39;re running the BT stack.&amp;nbsp; But I can try a different one to see if that does anything.&lt;/p&gt;
&lt;p&gt;I removed the CONIFG_ADC=y but was presented with these errors&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;warning: ADC_ASYNC (defined at drivers/adc/Kconfig:31) was assigned the value &amp;#39;y&amp;#39; but got the value&lt;br /&gt;&amp;#39;n&amp;#39;. Check these unsatisfied dependencies: ADC (=n). See&lt;br /&gt;&lt;a href="http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_ADC_ASYNC"&gt;docs.zephyrproject.org/.../kconfig.html&lt;/a&gt; and/or look up ADC_ASYNC in the&lt;br /&gt;menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,&lt;br /&gt;and Kconfig - Tips and Best Practices sections of the manual might be helpful too.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;warning: ADC_NRFX_SAADC (defined at drivers/adc/Kconfig.nrfx:25) was assigned the value &amp;#39;y&amp;#39; but got&lt;br /&gt;the value &amp;#39;n&amp;#39;. Check these unsatisfied dependencies: ADC (=n). See&lt;br /&gt;&lt;a href="http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_ADC_NRFX_SAADC"&gt;docs.zephyrproject.org/.../kconfig.html&lt;/a&gt; and/or look up&lt;br /&gt;ADC_NRFX_SAADC in the menuconfig/guiconfig interface. The Application Development Primer, Setting&lt;br /&gt;Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful&lt;br /&gt;too.&lt;/p&gt;
&lt;p&gt;That being said, it seems to be working a bit better now in that my ADC handler is being called.&amp;nbsp; So ADC_NRFX_SAADC and ADC_ASYNC are not needed?&amp;nbsp; What do they do?&lt;/p&gt;
&lt;p&gt;I added a call to&lt;strong&gt; nrfx_saadc_mode_trigger()&lt;/strong&gt;&amp;nbsp;which initiates a the START task, and that gets one conversion complete, but it doesn&amp;#39;t look like any of the RTC based triggers are doing anything via the PPI.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s what&amp;#39;s I&amp;#39;m seeing:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;*** Booting Zephyr OS build v3.1.99-ncs1-rc2 ***&lt;br /&gt;Prescaler = 32767&lt;br /&gt;NRFX_SAADC_EVT_READY&lt;br /&gt;NRFX_SAADC_EVT_BUF_REQ&lt;br /&gt;tick interrupt received&lt;br /&gt;NRFX_SAADC_EVT_DONE&lt;br /&gt;tick interrupt received&lt;br /&gt;tick interrupt received&lt;br /&gt;....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve created a zip file with the project files and uploaded it here:&amp;nbsp;&lt;a href="https://www.dropbox.com/s/gnjsjse63eurjnv/nrfx.zip?dl=0"&gt;https://www.dropbox.com/s/gnjsjse63eurjnv/nrfx.zip?dl=0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know what you find.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRFX  RTC -&gt; PPI -&gt; ADC</title><link>https://devzone.nordicsemi.com/thread/391640?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 11:54:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b40fb7c9-dbe2-473e-9d6b-97d5fa988dba</guid><dc:creator>Kenneth</dc:creator><description>[quote user=""]I can get the RTC to trigger callbacks but it seems to be running way too&amp;nbsp; fast.&amp;nbsp; Prescaler is set to 32767 but I&amp;#39;m getting about 10 ticks per second.&amp;nbsp;&amp;nbsp;[/quote]
&lt;p&gt;Does it scale when changing the prescaler? I notice the&amp;nbsp;CONFIG_LOG_PROCESS_THREAD_SLEEP_MS is 100ms, just wondering if that accidently is the same as the 10Hz you see or not.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not possible to update the PRESCALER if the rtc is already running, can you just check that the rtc is indeed stopped before you configure it (maybe even try a different rtc instance if it&amp;#39;s already in use by &amp;quot;something&amp;quot;).&lt;/p&gt;
[quote user=""]I&amp;#39;m not sure if I need to add an IRQ_CONNECT() for the adc. If I add&amp;nbsp;[/quote]
&lt;p&gt;I suggest you remove CONFIG_ADC=y in this case, since I suspect that may indirectly enable the ADC handler already.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you still have problems maybe you can share your entire project folder so I can build and run on an nRF52-DK.&lt;/p&gt;
&lt;p&gt;Edit:&amp;nbsp;I do believe you also need to call the saadc start task before the sample task will have any action, &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=4_2_0_36_5#saadc_easydma"&gt;see Figure 4 here&lt;/a&gt;&amp;nbsp;and nrfx_saadc_mode_trigger() api.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>