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.

MSP430 ADC10 Accuracy

Other Parts Discussed in Thread: MSP430FR5739

I am attempting to write code for the ADC10 registers that contain gain and offset correction for improved accuracy. In the user manual, it says I should be using "CAL_25VREF_FACTOR" with the 2.5V reference however I cannot find a register by this name in the .h file. How do I use the calibration settings properly in CCS6.0.0 ?

 

CAL_ADC = CAL_25VREF_FACTOR * ADC10MEM0;

CAL_ADC = CAL_ADC / 0x8000;

CAL_ADC = CAL_ADC + CAL_ADC_OFFSET;

 

(CAL_ADC is just a variable I use to compute the accurate results) 

  • Hello Sean,

    I am attempting to contact you via email where we can further discuss this matter.

    Regards,

    Ryan

  • Email can be found on my user information, however do you have any suggestions?  I would like to use the devices' internal calibration values found in the TLV structure with CCS 6.0.0, however I cannot find the proper registers in the .h file or datasheet for the MSP430FR5739

  • Although answered offline, following up on the answer to this thread:

    To clear up some confusion, CAL_25VREF_FACTOR is not a register but rather a tag-length-value (TLV) device descriptor, hence why it is not defined in any .h file. In order to access the ADC10 & REF calibration device descriptors we must declare a pointer that accesses the specific address desired ADC/REF calibration tag. In order to get a solid ADC calibration, we will require tags CAL_ADC_25VREF_FACTOR, CAL_ADC_GAIN_FACTOR, and CAL_ADC_OFFSET at addresses 0x1A2C, 0x1A16, and 0x1A18, respectively. So inside of your code after including the h file you should have the following pointers defined:

    #define CAL_ADC_25VREF_FACTOR *((unsigned int *)0x1A2C)
    #define CAL_ADC_GAIN_FACTOR *((unsigned int *)0x1A16)
    #define CAL_ADC_OFFSET*((unsigned int *)0x1A18)

    Once again, the naming conventions are nominal and can be re-worded in any way that you decide best. Generally it is advised to apply the VREF calibration first followed by the gain calibration and then the offset calibration. Therefore, assuming that your raw ADC conversion is stored in ADC10MEM0, your calibration equation should look as such:

    raw_ADC = ADC10MEM0; // Variable to store raw ADC value
    CAL_ADC = ((raw_ADC*CAL_ADC_25VREF_FACTOR/0x8000)*(CAL_ADC_GAIN_FACTOR/0x8000)) + CAL_ADC_OFFSET; //Calibration equation

    It is always good to add a temporary variable to be used as a placeholder for ADC10MEM0 as this register will cause an incorrect result if used inside of the equation. If done properly, you should have a properly calibrated ADC that will eliminate that 5% variance you noticed before.

    Regards,
    Ryan

**Attention** This is a public forum