Nrf52832 Internal ADC is taking approx 35us. Need help to minimize it withing 10us

Hello,

I am working with nRF5 SDK v17.1.0 and using nRF52832DK board. While working with SAADC module I found that nrfx_saadc_sample_convert() API is taking almost 35us (I have verified by driving GPIO low before this API call and high after this API call) using DSO. 

Someone, please help me to reduce the timing. I want to minimize this time  within 10us for two-channel read back to back (i.e read channel 0 and read channel 1 should be done within 10us when acq_time is set to 3us or 5us)

Please check my SAADC configuration code:

void saadc_init(void)
{
    ret_code_t err_code;

    nrfx_saadc_config_t saadc_config;

    /* Configure SAADC in low power mode */
    saadc_config.low_power_mode = true;
    saadc_config.resolution = NRF_SAADC_RESOLUTION_10BIT;
    saadc_config.oversample = NRF_SAADC_OVERSAMPLE_DISABLED;
    saadc_config.interrupt_priority = NRFX_SAADC_CONFIG_IRQ_PRIORITY;

    nrf_saadc_channel_config_t channel_config0 =
        NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN2);
        channel_config0.gain = NRF_SAADC_GAIN1_4; 
        channel_config0.reference = NRF_SAADC_REFERENCE_INTERNAL;
        channel_config0.burst = 1;
        channel_config0.acq_time = NRF_SAADC_ACQTIME_5US; //NRF_SAADC_ACQTIME_3US

    nrf_saadc_channel_config_t channel_config1 =
        NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3);
        channel_config1.gain = NRF_SAADC_GAIN1_4;
        channel_config1.reference = NRF_SAADC_REFERENCE_INTERNAL;
        channel_config1.burst = 1;
        channel_config1.acq_time = NRF_SAADC_ACQTIME_5US;


    err_code = nrfx_saadc_init(&saadc_config, saadc_callback);
    APP_ERROR_CHECK(err_code);


    err_code = nrfx_saadc_channel_init(0, &channel_config0);
    APP_ERROR_CHECK(err_code);

    err_code = nrfx_saadc_channel_init(1, &channel_config1);  
    APP_ERROR_CHECK(err_code);
}

void read_adc()
{

  static nrf_saadc_value_t  adc_ch_val;
  static uint8_t toggle = 0;
  //alternate read the ADC channel 0 & 1
  toggle ^= 1;
  adc_ch_val = 0;

  //only for testing of timing  
  NRF_P0->OUTCLR = 1<<6;  //clear gpio p0.6
  if(toggle)
  {
        nrfx_saadc_sample_convert(0, &adc_ch_val);
        printf("Channel  Volts -  %f\n", ((2.4 * adc_ch_val)/1024)  );
  }
  else
  {
        nrfx_saadc_sample_convert(1, &adc_ch_val);
        printf("Channel  Volts -  %f\n", ((2.4 * adc_ch_val)/1024)  );
  }
  //only for testing
  NRF_P0->OUTSET = 1<<6;  //set gpio 0.6
}

Thanks & Regards,

SC

Parents Reply Children
No Data
Related