AnsweredAssumed Answered

Reasons for large ADC quantization error (TWR-K60D100M) ?

Question asked by Jerry Lian on Jun 9, 2017
Latest reply on Jun 12, 2017 by Jerry Lian

I am copying codes from KSDK demo with the following ADC setting and configurations:

* ADC input: ramp-up wave at 1Hz, 0 - 3 volt

* Calibration: roughly 0v == -32768; 3v == +32768

* Sampling frequency: 1 KHz

* As can be seen, there are only 33 quantization steps, instead of 65536 (2^16) steps .

              (or should at least have 1000 steps, as the sampling frequency is 1 KHz, right?)

 

Anything wrong with my ADC configurations?

 

Thanks,

Jerry

===== ADC configuration: 16 bit, single-end, long sample time disabled, high speed enabled, ... ============

{
adc16_config_t adc16ConfigStruct;
adc16_channel_config_t adc16ChannelConfigStruct;

/*
* adc16ConfigStruct.referenceVoltageSource = kADC16_ReferenceVoltageSourceVref;
* adc16ConfigStruct.clockSource = kADC16_ClockSourceAsynchronousClock;
* adc16ConfigStruct.enableAsynchronousClock = true;
* adc16ConfigStruct.clockDivider = kADC16_ClockDivider8;
* adc16ConfigStruct.resolution = kADC16_ResolutionSE12Bit;
* adc16ConfigStruct.longSampleMode = kADC16_LongSampleDisabled;
* adc16ConfigStruct.enableHighSpeed = false;
* adc16ConfigStruct.enableLowPower = false;
* adc16ConfigStruct.enableContinuousConversion = false;
*/
ADC16_GetDefaultConfig(&adc16ConfigStruct);
adc16ConfigStruct.clockDivider = kADC16_ClockDivider1;
adc16ConfigStruct.enableHighSpeed = true;
adc16ConfigStruct.resolution = kADC16_ResolutionSE16Bit;
ADC16_Init(DEMO_ADC_BASE, &adc16ConfigStruct);
#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
       ADC16_EnableHardwareTrigger(DEMO_ADC_BASE, false);
       if (kStatus_Success == ADC16_DoAutoCalibration(DEMO_ADC_BASE))
              PRINTF("ADC16_DoAutoCalibration() Done.\r\n");
      else PRINTF("ADC16_DoAutoCalibration() Failed.\r\n");

#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */

ADC16_EnableDMA(DEMO_ADC_BASE, true);

adc16ChannelConfigStruct.channelNumber = DEMO_ADC_USER_CHANNEL;
adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = false; /* Enable the interrupt. */
#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE
     adc16ChannelConfigStruct.enableDifferentialConversion = false;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */
ADC16_SetChannelConfig(DEMO_ADC_BASE, DEMO_ADC_CHANNEL_GROUP, &adc16ChannelConfigStruct);
}

======================================================================================

 

Outcomes