<?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>ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69662/adc-sampling-while-the-radio-is-transmitting</link><description>The project I&amp;#39;m working on is running off of a CR2032 battery. I want to measure the battery voltage while the radio is transmitting to determine when the battery dips down close to BOR voltage (1.8V). I have tried radio notification, but it does not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Dec 2020 16:07:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69662/adc-sampling-while-the-radio-is-transmitting" /><item><title>RE: ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/thread/286876?ContentTypeID=1</link><pubDate>Tue, 29 Dec 2020 16:07:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62c94a12-c066-4873-a7df-bf997950b53b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Ken&lt;/p&gt;
&lt;p&gt;That is great news, I will close the case then &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&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: ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/thread/286391?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 21:56:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2de725e-deb5-491c-978e-f72b3f747528</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I initialized my SAADC wrong.&amp;nbsp; I checked it again when you mentioned it and fixed it. It&amp;#39;s working now.&lt;/p&gt;
&lt;p&gt;Thank you for the suggestions.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ken&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/thread/286294?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 13:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1de6d52b-8d72-4f77-a04f-871fc8776aa0</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t see anywhere in your code snippets how you set up the ADC DMA buffers, and if you start the ADC anywhere (through the START task).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you doing this somewhere else, or is this not included?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/thread/286183?ContentTypeID=1</link><pubDate>Mon, 21 Dec 2020 23:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:088bf4c6-5ac2-4983-9b39-9268086af00f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;So this is how I set up PPI&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ppi_init(void)
{
    uint32_t err_code = NRF_SUCCESS;


    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);

    /* Configure 1st available PPI channel to stop TIMER0 counter on TIMER1 COMPARE[0] match,
     * which is every even number of seconds.
     */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel1);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel1,
                                          (uint32_t)&amp;amp;NRF_RADIO-&amp;gt;EVENTS_TXREADY,
                                          (uint32_t)&amp;amp;NRF_SAADC-&amp;gt;TASKS_START);
    APP_ERROR_CHECK(err_code);

    /* Configure 2nd available PPI channel to start TIMER0 counter at TIMER2 COMPARE[0] match,
     * which is every odd number of seconds.
     */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel2);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel2,
                                          (uint32_t)&amp;amp;NRF_RADIO-&amp;gt;EVENTS_TXREADY,
                                          (uint32_t)&amp;amp;NRF_SAADC-&amp;gt;TASKS_SAMPLE);
    APP_ERROR_CHECK(err_code);

    // Enable both configured PPI channels
    err_code = nrf_drv_ppi_channel_enable(m_ppi_channel1);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_ppi_channel_enable(m_ppi_channel2);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;SAADC init&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void Adc14bitPolledInitialise(void)
{
    uint32_t timeout = 10;  
    //Setup C
    nrf_saadc_channel_config_t myConfig =
    {
        .resistor_p = NRF_SAADC_RESISTOR_DISABLED,
        .resistor_n = NRF_SAADC_RESISTOR_DISABLED,
        .gain       = NRF_SAADC_GAIN1_6,
        .reference  = NRF_SAADC_REFERENCE_INTERNAL,
        .acq_time   = NRF_SAADC_ACQTIME_3US,
        .mode       = NRF_SAADC_MODE_SINGLE_ENDED,
        .burst      = NRF_SAADC_BURST_DISABLED,
        .pin_p      = NRF_SAADC_INPUT_VDD,
        .pin_n      = NRF_SAADC_INPUT_DISABLED
    };

    nrf_saadc_resolution_set((nrf_saadc_resolution_t) NRF_SAADC_RESOLUTION_14BIT);   // 2 is 12-bit
    nrf_saadc_oversample_set((nrf_saadc_oversample_t) 0);   // 0 no oversampling
    nrf_saadc_int_disable(NRF_SAADC_INT_ALL);
    nrf_saadc_event_clear(NRF_SAADC_EVENT_END);
    nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED);
    nrf_saadc_enable();

    NRF_SAADC-&amp;gt;CH[1].CONFIG =
              ((myConfig.resistor_p &amp;lt;&amp;lt; SAADC_CH_CONFIG_RESP_Pos)   &amp;amp; SAADC_CH_CONFIG_RESP_Msk)
            | ((myConfig.resistor_n &amp;lt;&amp;lt; SAADC_CH_CONFIG_RESN_Pos)   &amp;amp; SAADC_CH_CONFIG_RESN_Msk)
            | ((myConfig.gain       &amp;lt;&amp;lt; SAADC_CH_CONFIG_GAIN_Pos)   &amp;amp; SAADC_CH_CONFIG_GAIN_Msk)
            | ((myConfig.reference  &amp;lt;&amp;lt; SAADC_CH_CONFIG_REFSEL_Pos) &amp;amp; SAADC_CH_CONFIG_REFSEL_Msk)
            | ((myConfig.acq_time   &amp;lt;&amp;lt; SAADC_CH_CONFIG_TACQ_Pos)   &amp;amp; SAADC_CH_CONFIG_TACQ_Msk)
            | ((myConfig.mode       &amp;lt;&amp;lt; SAADC_CH_CONFIG_MODE_Pos)   &amp;amp; SAADC_CH_CONFIG_MODE_Msk)
            | ((myConfig.burst      &amp;lt;&amp;lt; SAADC_CH_CONFIG_BURST_Pos)  &amp;amp; SAADC_CH_CONFIG_BURST_Msk);

    NRF_SAADC-&amp;gt;CH[1].PSELN = myConfig.pin_n;
    NRF_SAADC-&amp;gt;CH[1].PSELP = myConfig.pin_p;

}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and in main, I just initiate both, and read the buffer if the address for saadc indicate finished.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;log_init();
lfclk_config();
timers_init();
Adc14bitPolledInitialise();
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
peer_manager_init();
services_init();
sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
advertising_init();
conn_params_init();

ppi_init();

advertising_start(false);
// main loop.
for (;;)
{

    if( NRF_SAADC-&amp;gt;EVENTS_DONE )
    {
        NRF_LOG_INFO(&amp;quot;radio RX&amp;quot;);
        stopAnalogSample(&amp;amp;vbat);
        advertisingUpdateMfgData();
    }

    idle_state_handle(); 
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;it just never get to the stopAnalogSample() function.&lt;/p&gt;
&lt;p&gt;Am I doing something wrong here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC sampling while the radio is transmitting</title><link>https://devzone.nordicsemi.com/thread/285863?ContentTypeID=1</link><pubDate>Fri, 18 Dec 2020 14:21:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:251c4e23-fae2-46c1-9735-c6427fcb4d6a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;It is possible to use the PPI controller to connect one of the radio events to the ADC SAMPLE task, so that the ADC sampling will be synchronized to the operation of the radio.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An overview of all the events in the radio can be found &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52811/radio.html?cp=4_4_0_5_13_14#topic"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Possible events of interest are the TXREADY or RXREADY events, which occur once the radio is started in TX or RX mode respectively.&amp;nbsp;&lt;br /&gt;You could also use the END event, which is triggered when a packet is successfully sentor received.&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>