This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SAADC - NRF_DRV_SAADC_EVT_DONE

Hello,

I'm currently working with sdk 11 on nRF52832.

I'm trying to acquire 20 value from SAADC every 10ms during 300uS.

I think that the rate is too high because p_event->type == NRF_DRV_SAADC_EVT_DONE occur only once per 20 value.

Is it normal ? Is it too fast ?

Thank you, Nabil

Parents
  • Hi Nabil,

    Whether or not this is normal depends on how you have configured your buffer(s). You will only get a NRF_DRV_SAADC_EVT_DONE event when a buffer is filled, so if your buffer size is 20 samples, this behavior is normal.

    To say something about what sample rate you can achieve, you will have to provide some more details about your application and SAADC setting. The SAADC peripheral can support up to 200 ksps, so your 20 values every 10 ms should be achievable (I'm not sure I understand what you mean by "during 300uS"). What aquisition time do you use? Do you use BLE in your application? Do you do any processing on the samples? The SAADC support EasyDMA and double buffering, meaning it can sample directly to RAM and you can process one buffer while sampling to a separate buffer.

    Best regards,

    Jørgen

  • Like that ?

     if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
        {
            ret_code_t err_code;
         
         
    
            int i;
    
            //printf("ADC event number: %d\r\n",(int)m_adc_evt_counter);
            for (i = 0; i < SAMPLES_IN_BUFFER; i++)
                {
                   // printf("%d\r\n", p_event->data.done.p_buffer[i]);
                  adc_measure = adc_measure + p_event->data.done.p_buffer[i];
                  nrf_drv_gpiote_out_toggle(27);
    
                }
            m_adc_evt_counter++;
       err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
            APP_ERROR_CHECK(err_code);
            if(m_adc_evt_counter==3)
                {
                    nrf_gpio_pin_toggle(LED_3);
                }
        }
    
Reply
  • Like that ?

     if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
        {
            ret_code_t err_code;
         
         
    
            int i;
    
            //printf("ADC event number: %d\r\n",(int)m_adc_evt_counter);
            for (i = 0; i < SAMPLES_IN_BUFFER; i++)
                {
                   // printf("%d\r\n", p_event->data.done.p_buffer[i]);
                  adc_measure = adc_measure + p_event->data.done.p_buffer[i];
                  nrf_drv_gpiote_out_toggle(27);
    
                }
            m_adc_evt_counter++;
       err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
            APP_ERROR_CHECK(err_code);
            if(m_adc_evt_counter==3)
                {
                    nrf_gpio_pin_toggle(LED_3);
                }
        }
    
Children
No Data
Related