<?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 + BLE IN ADC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78218/adc-ble-in-adc</link><description>Hello All, 
 I configure ADC &amp;amp; BLE UART in one code. we are using 4 ADC channels. but I observed that there is a timing delay approx 2-3 sec to update ADC. we are using a 1 kb buffer for each ADC. to calculate voltage and current values. anyone can suggest</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 30 Oct 2021 10:00:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78218/adc-ble-in-adc" /><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/336746?ContentTypeID=1</link><pubDate>Sat, 30 Oct 2021 10:00:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:667538ad-cbe3-488d-a46c-f41c35415d6d</guid><dc:creator>pavan_142297</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If there is an increment or decrement in the measuring voltage signal, those changes are being reflected with some delay.&lt;/p&gt;
&lt;p&gt;Sensing signal before conversion&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/521e6ed1757b7fcc778b456a.png" /&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sensing signal after conversion&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/VC.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;We are trying to measure this signal using nordic ADC and we need help on collecting 250-500 samples of this wave in (full cycle) 20ms time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/336683?ContentTypeID=1</link><pubDate>Fri, 29 Oct 2021 12:45:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53446e5c-8093-4588-b121-d1d9e625b8c9</guid><dc:creator>Jared</dc:creator><description>[quote user="pavan_142297"] But I observed that when voltage is being increased or decreased nordic chip is taking time to reflect those signal changes.[/quote]
&lt;p&gt;The supply voltage of the nRF52 or the measured voltage? Also, how do you measure the elapsed time it takes to take a sample?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/336670?ContentTypeID=1</link><pubDate>Fri, 29 Oct 2021 11:43:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85d94a97-5d05-4309-8255-d6e9c0d0e073</guid><dc:creator>pavan_142297</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We are trying to measure 240VAC 50Hz supply and also Current being consumed using a CT.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;240VAC is dropped down and oscillates between&amp;nbsp;600mV to 1.8V with 50Hz frequency using a resistor bank &amp;amp; a capacitor filter. Each cycle of our 50Hz signal is 20ms.&amp;nbsp;This AC signal is being read by an ADC of nRF52810. But I observed that when voltage is being increased or decreased nordic chip is taking time to reflect those signal changes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/336465?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 12:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fea18bf6-ff89-4379-8404-8ddd97d1dbda</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;The code looks somewhat ok.&amp;nbsp; What point do you measure 2-3 seconds from?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/336365?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 08:47:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67102fa0-61ba-4617-bf29-cb3fc4c75e3e</guid><dc:creator>pavan_142297</dc:creator><description>&lt;p&gt;hi Jared,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;please check the configuration, I am sharing here,&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void saadc_sampling_event_init(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);

    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;

    err_code = nrf_drv_timer_init(&amp;amp;m_timer, &amp;amp;timer_cfg, timer_handler);
    APP_ERROR_CHECK(err_code);
  

    /* setup m_timer for compare event every 400ms */
    uint32_t ticks = nrf_drv_timer_us_to_ticks(&amp;amp;m_timer, 200);

    nrf_drv_timer_extended_compare(&amp;amp;m_timer,
                                   NRF_TIMER_CC_CHANNEL0,
                                   ticks,
                                   NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
                                   false);  
    nrf_drv_timer_enable(&amp;amp;m_timer);    
    uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0);       
    uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();
    /* setup ppi channel so that timer compare event is triggering sample task in SAADC */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,
                                          timer_compare_event_addr,
                                          saadc_sample_task_addr);
}

static void saadc_sampling_event_enable(void)
{
    ret_code_t err_code;
    err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
    APP_ERROR_CHECK(err_code);
}


static void saadc_sampling_event_disable(void)
{
 ret_code_t err_code;
 err_code = nrf_drv_ppi_channel_disable(m_ppi_channel);
  APP_ERROR_CHECK(err_code);
}

static void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {
       ret_code_t err_code;

       err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAMPLES_IN_BUFFER);
       APP_ERROR_CHECK(err_code);

       int i,j;
       switch(ADCChannel)
      { 
        case Vchannel:
            for(i=0;i&amp;lt;=SAMPLE_COUNT;i+=4)
              {
                 adc_data[adc_count]= p_event-&amp;gt;data.done.p_buffer[i]-voltage_thershold_value;
                 adc_count+=1;
               }
             break;
       case Cchannel0:
             for(i=0;i&amp;lt;=SAMPLE_COUNT;i+=4)
              {
                 adc_data[adc_count]= p_event-&amp;gt;data.done.p_buffer[i+1]-current_thershold_value;
                 adc_count+=1;
               }
             break;
       case Cchannel1:
              for(i=0;i&amp;lt;=SAMPLE_COUNT;i+=4)
              {
                 adc_data[adc_count]= p_event-&amp;gt;data.done.p_buffer[i+2]-current_thershold_value;
                 adc_count+=1;
               }
             break;
       case Cchannel2:
              for(i=0;i&amp;lt;=SAMPLE_COUNT;i+=4)
              {
                 adc_data[adc_count]= p_event-&amp;gt;data.done.p_buffer[i+3]-current_thershold_value;
                 adc_count+=1;
               }
             break;

      }
       }
        if(adc_count&amp;gt;=BUFFER_COUNT)
       {
       start_calc = 1;
       adc_count =0;
       }
    }



static void saadc_init(void)
{
    ret_code_t err_code;

    nrf_saadc_channel_config_t channel_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN2);    //P0.04

   nrf_saadc_channel_config_t channel_config1 =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN4);    //P0.28

    nrf_saadc_channel_config_t channel_config2 =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN6);    //P0.30

    nrf_saadc_channel_config_t channel_config3 =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3);    //P0.05

    err_code = nrf_drv_saadc_init(NULL, saadc_callback);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(0, &amp;amp;channel_config);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(1, &amp;amp;channel_config1);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(2, &amp;amp;channel_config2);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(3, &amp;amp;channel_config3);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;pavan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC + BLE IN ADC</title><link>https://devzone.nordicsemi.com/thread/323311?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 12:13:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7dbf179-e2b2-4e16-8720-66efe732dbfb</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you share your code and specify from what point you measure 2-3 seconds?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>