<?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>nRF52832: how to trigger SAADC sampling externally via PPI event?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93869/nrf52832-how-to-trigger-saadc-sampling-externally-via-ppi-event</link><description>Hello, 
 thank you for your help to solve my previous issue with resetting the RTC event ( ). I&amp;#39;m glad to move to the next problem with my task, which is triggering the SAADC sampling every time an RTC event occurs. 
 Description: 
 I would like to use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Nov 2022 14:36:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93869/nrf52832-how-to-trigger-saadc-sampling-externally-via-ppi-event" /><item><title>RE: nRF52832: how to trigger SAADC sampling externally via PPI event?</title><link>https://devzone.nordicsemi.com/thread/396020?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 14:36:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9542243c-d658-4463-9bb9-14990de0d919</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Good to hear that the example was helpful, and thanks for sharing the specifics you needed to change in order to make it work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Triggering SAMPLE will not invoke START unfortunately, so START has to be called first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832: how to trigger SAADC sampling externally via PPI event?</title><link>https://devzone.nordicsemi.com/thread/395952?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2022 11:21:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a7f4435-ae72-4748-be21-81598f52d149</guid><dc:creator>ISH</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The link you provided helped, I managed to get the SAADC to perform a conversion on every COMPARE0-event. I shall provide my solution here just to avoid a situation in the future where the link is not usable.&lt;/p&gt;
&lt;p&gt;I followed the sample, and was pleased that my approach was quite similar in comparison. The only steps I didn&amp;#39;t do with my SAADC code was to use the task START. I was under the impression that when you use task SAMPLE it would trigger START automatically. These are the changes I made to my code to get it working:&lt;/p&gt;
&lt;p&gt;mm_saadc.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define MM_SAADC_CH_CNT 1

static nrf_saadc_value_t buffer[MM_SAADC_CH_CNT];
static nrfx_saadc_channel_t channels[MM_SAADC_CH_CNT] = {
    NRFX_SAADC_DEFAULT_CHANNEL_SE(NRF_SAADC_INPUT_AIN0, 0),
    //NRFX_SAADC_DEFAULT_CHANNEL_SE(NRF_SAADC_INPUT_AIN1, 1),
};

uint32_t mm_saadc_address_event_started()
{
    return nrf_saadc_event_address_get(NRF_SAADC, NRF_SAADC_EVENT_STARTED);
}

uint32_t mm_saadc_address_task_start()
{
    return nrf_saadc_task_address_get(NRF_SAADC, NRF_SAADC_TASK_START);
}

static void event_handler(nrfx_saadc_evt_t const * p_event)
{
    nrfx_err_t err;
    switch (p_event-&amp;gt;type)
    {
        case NRFX_SAADC_EVT_DONE:
            for (int i = 0; i &amp;lt; p_event-&amp;gt;data.done.size; i++) {
                LOG_INF(&amp;quot;CH%d: %d&amp;quot;, i, p_event-&amp;gt;data.done.p_buffer[i]);
            }
            err = nrfx_saadc_buffer_set(&amp;amp;buffer[0], MM_SAADC_CH_CNT);
            break;
/*
        case NRFX_SAADC_EVT_BUF_REQ:
            LOG_INF(&amp;quot;NRFX_SAADC_EVT_BUF_REQ&amp;quot;);
            err = nrfx_saadc_buffer_set(&amp;amp;buffer[next_free_buf_index()], MM_SAADC_CH_CNT);
            LOG_INF(&amp;quot;NRFX_SAADC_EVT_BUF_REQ err: %x&amp;quot;, err);
            break;
*/
        case NRFX_SAADC_EVT_READY:
            LOG_INF(&amp;quot;Stopping SAADC&amp;quot;);
            nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP);
            break;
        default:
            LOG_INF(&amp;quot;default: event type %x&amp;quot;, p_event-&amp;gt;type);
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;mm_ppi.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void mm_ppi_set()
{
    nrfx_err_t err = NRFX_SUCCESS;

    err = nrfx_ppi_channel_alloc(&amp;amp;mm_ppi_ch0);
    err = nrfx_ppi_channel_assign(mm_ppi_ch0, mm_rtc_address_event_comp0(), mm_saadc_address_task_start());
    err = nrfx_ppi_channel_fork_assign(mm_ppi_ch0, mm_rtc_address_task_clear());
    err = nrfx_ppi_channel_enable(mm_ppi_ch0);

    err = nrfx_ppi_channel_alloc(&amp;amp;mm_ppi_ch2);
    err = nrfx_ppi_channel_assign(mm_ppi_ch2, mm_saadc_address_event_started(), mm_saadc_address_task_sample());
    err = nrfx_ppi_channel_enable(mm_ppi_ch2);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Further development:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I might need to add more SAADC channels to the project, but as long as the configurations are done correctly, this solution should work with minimal modifications.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832: how to trigger SAADC sampling externally via PPI event?</title><link>https://devzone.nordicsemi.com/thread/395803?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2022 13:41:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c961b34-b242-40df-91b1-b067211f1bd3</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My colleague Jørgen made an example that sounds very similar to what you are doing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you start by taking a look at that and see if you can spot the issue with your own example?&lt;br /&gt;&lt;a href="https://github.com/jorhol/NCS-SAADC-samples/tree/main/nrfx_saadc_advanced_nrfx_rtc_ppi/"&gt;https://github.com/jorhol/NCS-SAADC-samples/tree/main/nrfx_saadc_advanced_nrfx_rtc_ppi/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you still have questions or concerns after checking out his example just let me know, and I will do my best to help out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>