Does ADC_16_DRV_GetAutoCalibrationParam calibrate the ADC?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does ADC_16_DRV_GetAutoCalibrationParam calibrate the ADC?

602 Views
georgeleszko
Contributor I

In the KSDK 1.2, I initialize and calibrate an ADC channel by drivers I found in the component list:

 

46044_46044.jpgdrivers.jpg

  ADC16_DRV_Init (0, &ADC0_CalConvConfig); //set ADC to s/w trigger mode for calibration

  ADC16_DRV_GetAutoCalibrationParam(0, &ADC0_CalConfig); //calibrate ADC0

  ADC16_DRV_SetCalibrationParam(0, &ADC0_CalConfig);

 

  … but there is no mention of this function in the API Reference Manual. I have been told this function actually calibrates the ADCs. Is it really this easy? I can’t determine certainly from setting breakpoints if any of the offset, gain or calibration register values actually changed from those that are already in them (from previously issuing this command). Is there any documentation on these driver calls and parameter structure?

Labels (1)
0 Kudos
1 Reply

356 Views
EarlOrlando
Senior Contributor II

Hello George,

You are right, this function is not documented in the API Reference Manual but you can see the description about this function in the file fsl_adc16_driver.c. The function description is:

/*Function Name : ADC16_DRV_SetCalibrationParam

* Description  : Set the calibration parameters for ADC module. These

* parameters can be fetched by launching the process of auto calibration

* or to use some predefined values that filled in the structure of

* "adc16_calibration_param_t". For higher precision,  it is recommended to

* execute the process of calibration before initializing the ADC module.

* Since this API may be called before the initialization, it enables the ADC

* clock internally.

*/

Also, you need to call the function ADC16_DRV_GetAutoCalibrationParam before ADC16_DRV_SetCalibrationParam. Its description is above.

/* Function Name : ADC16_DRV_GetAutoCalibrationParam

* Description   : Execute the the process of auto calibration and fetch

* the calibration parameters that would be kept in "adc16_calibration_param_t"

* type variable. When executing the process of auto calibration, the ADC

* has been configured internally to work in the situation with highest

* precision. Since this API may be called before the initialization, it enables

* the ADC clock internally.

*/

You can calibrate your ADC just by calling the below code snippet.

#define ADC_INSTANCE     (0)

adc16_calibration_param_t userCalConfig;

ADC16_DRV_GetAutoCalibrationParam(ADC_INSTANCE, &userCalConfig);

ADC16_DRV_SetCalibrationParam(ADC_INSTANCE, &userCalConfig);

Please let me know if this information is useful or if I can do anything else for you.

Best regards,

Earl Orlando.

​/* If this post answers your question please click over the ​Correct answer button. */

0 Kudos