This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/CC2640R2F: ADC sampling issue

Part Number: CC2640R2F

Tool/software: TI C/C++ Compiler

Hi,

I am working on an ultra low power application on CC2640R2 and I have an issue with the ADC. 

Requirements are:

  • Sampling of three channels in sequence.
  • One sample from each channel as fast as possible.
  • Non-blocking.
  • Sampling interval: 1 second.

My configuration is as follows:

static ADCBuf_Handle handle;

static ADCBuf_Params params;

static ADCBufCC26XX_ParamsExtension customParams;

static ADCBuf_Conversion conv1;

static ADCBuf_Conversion conv2;

static ADCBuf_Conversion conv3;

static uint16_t conv1Buf;

static uint16_t conv2Buf;

static uint16_t conv3Buf;

 

ADCBuf_init();

 

ADCBuf_Params_init(&params);

params.returnMode = ADCBuf_RETURN_MODE_CALLBACK;

params.blockingTimeout = 25000;

params.callbackFxn = GF_Adc_AdcBufCb;

params.recurrenceMode = ADCBuf_RECURRENCE_MODE_ONE_SHOT;

params.samplingFrequency = XXXXX;

 

customParams.samplingDuration = ADCBufCC26XX_SAMPLING_DURATION_5P3_US;

customParams.refSource = ADCBufCC26XX_FIXED_REFERENCE;

customParams.samplingMode = ADCBufCC26XX_SAMPING_MODE_SYNCHRONOUS;

customParams.inputScalingEnabled = true;

params.custom = &customParams;

conv1.samplesRequestedCount = NO_OF_NTC_SAMPLES;  // 1

conv1.sampleBuffer = &conv1Buf;

conv1.sampleBufferTwo = NULL;

conv1.arg = NULL;

conv1.adcChannel = Board_ADCBUF0CHANNEL5;

  

conv2.samplesRequestedCount = NO_OF_NTC_SAMPLES;  // 1

conv2.sampleBuffer = &conv2Buf;

conv2.sampleBufferTwo = NULL;

conv2.arg = NULL;

conv2.adcChannel = Board_ADCBUF0CHANNEL6;

 

conv3.samplesRequestedCount = NO_OF_NTC_SAMPLES;  // 1

conv3.sampleBuffer = &conv3Buf;

conv3.sampleBufferTwo = NULL;

conv3.arg = NULL;

conv3.adcChannel = Board_ADCBUF0CHANNEL7;

The sampling sequence is as follows:

  1. Open ADC (in main thread): ADCBuf_Handle handle = ADCBuf_open(Board_ADCBUF0, &params)
  2. If handle != NULL (in main thread): ADCBuf_convert(ADCBuf_Handle handle, ADCBuf_Conversion conv1, SINGLE_CHANNEL)
  3. In ADC callback: ADCBuf_convert(ADCBuf_Handle handle, ADCBuf_Conversion conv2, SINGLE_CHANNEL)
  4. In ADC callback: ADCBuf_convert(ADCBuf_Handle handle, ADCBuf_Conversion conv3, SINGLE_CHANNEL)
  5. In ADC callback: Enqueue ADC finished event.
  6. Handle ADC finished event - Close ADC (in main thread): ADCBuf_close(handle)

The issue is that the call to ADCBuf_convert() does not always return. It can be fixed by drastically reducing the 'params.samplingFrequency' parameter. This is not acceptable as the CC2640R2 is not in sleep mode for a very long time (several ms) during sampling of the three ADC channels.

How can I fix this issue?

Looking forward to hear from you.

-Annette

  • HI Annette,

    There is a know-issue with the older version of the ADCBuf driver where it could stop working if the sampling frequency was to high. This has been addressed and fixed in the latest 2.10 SDK but as you are using CC2640R2F this is yet rolled out. This fix will be included in the up coming CC2640R2F SDK but in the meanwhile you could try to implement the workaround and see if this fixes your issue, have a look into the linked thread for more details on how to do this.

    e2e.ti.com/.../683658